2016-07-01 2 views
0

tomcat 8/spring 5.4.1/Tapestry 5.4.1 설치를 실행 중입니다. 레이아웃 용 구성 요소가있는 간단한 템플릿이 있습니다. 템플릿은 사람들의 수를 가져 오는 스프링 서비스를 호출합니다. 단순한. 이상한 점은 인덱스 템플릿이 두 번로드되고 있으며 레이아웃 구성 요소를 참조하는 index.tml 페이지의 t : type = "layout"태그 때문인 것 같습니다. 이걸 제거하면 한 번만 호출됩니다.각 요청에 대해 두 번 호출 된 태피스 트리 템플릿

이것은 Tomcat에서 가져온 로그로, 색인이 두 번 호출되었음을 분명하게 보여줍니다.

>  2016-07-01 09:47:39 INFO PageLoader:213 - Loaded page 'Index' (en) in 302.278 ms 
>  2016-07-01 09:47:39 INFO Index:25 - [Index] onActivate 
>  2016-07-01 09:47:39 INFO Index:20 - [Index] setupRender 
>  2016-07-01 09:47:39 INFO Index:31 - [Layout] setupRender 
>  2016-07-01 09:47:39 INFO Index:30 - [Index] getPersonCount 
>  2016-07-01 09:47:40 INFO QueryTranslatorFactoryInitiator:47 - HHH000397: Using ASTQueryTranslatorFactory 
>  Hibernate: select count(*) as col_0_0_ from person person0_ 
>  2016-07-01 09:47:40 INFO Index:25 - [Index] onActivate 
>  2016-07-01 09:47:40 INFO Index:20 - [Index] setupRender 
>  2016-07-01 09:47:40 INFO Index:31 - [Layout] setupRender 
>  2016-07-01 09:47:40 INFO Index:30 - [Index] getPersonCount 
>  Hibernate: select count(*) as col_0_0_ from person person0_ 

Index.tml

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html t:type="layout" t:pageTitle="Admin Main" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd" xmlns:p="tapestry:parameter"> 
    <head> 
     <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
     <meta content="width=device-width, initial-scale=1.0" name="viewport"/> 
     <title></title>  
    </head> 
    <body> 
     ${personCount} 
    </body> 
</html> 

Layout.tml는

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" xmlns:p="tapestry:parameter"> 
    <head> 
     <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
     <meta content="width=device-width, initial-scale=1.0" name="viewport"/> 
     <title></title> 

     <link rel="stylesheet" type="text/css" href="dev/css/bootstrap.css"/> 
     <link rel="stylesheet" type="text/css" href="dev/css/main.css"/> 
     <script src="dev/js/jquery-2.2.4.js"></script> 
     <script src="dev/js/bootstrap.js"></script> 

    </head> 

<!-- Page Body --> 
    <body> 
     <div id="mainContainer" class="container"> 
      <t:body/> 
     </div> 
    </body> 
</html> 
+0

템플릿의 자바 코드를 공유 할 수 있습니까? – joostschouten

답변

0

는 최대 절전 모드 호출이 실행 된 후 홈페이지를 반환하려고 할 수 있습니다. Hibernate 호출 실행 후 페이지가 다시로드되는 것을 관찰하면

관련 문제