在使用tiles时,如何在ie中显示动态的标题

03-10-26 licky
比如tiles的定义文件:

  <definition name="news.detail.page" extends="home.page">
    <put name="title" beanName="resource" beanProperty="title" beanScope="request" />
    <put name="menu" value="/tiles/common_tile/hitTop10.jsp" />
    <put name="body" value="/tiles/publish_tile/news_detail_body.jsp" />
    <put name="right_menu" value="/tiles/common_tile/picNews.jsp" />
  </definition>
<p>

注意 <put name="title" ... 这一段,在页面上显示的时候,我不想每个不同的新闻都用同样的ie标题,而是要根据resource.title的不同而变化。

可是在启动tomcat的时候出现如下错误:

[ERROR] Digester - -Parse Error at line 66 column 86: Attribute "beanName" must be declared for element type "put".

不知大家有什么办法。感激先!

banq
2003-10-26 18:26
标题不是在Tiles定义文件定义,而是在Jsp中作为参数输入,Tiles Samples中也是这么做的。

licky
2003-10-26 19:47
但是tiles文档中说明了可以这样做,为什么我的总是不成功?

licky
2003-10-26 20:10
and can u tell me where i can download the Tiles Samples? thx

GreateWei
2003-10-26 22:55
我做了一个相对通用的tiles动态标题的显示,我将具体要显示的内容放到资源文件里面,以方便多语言的设置。然后在tiles定义的属性中存放资源文件的健值。如:

  <definition name="application.dynamic.basic" path="/layouts/dynamic/dynamicClassicLayout.jsp">
    <put name="submenuParameterName"     value="submenu" /> <!-- the mainmenu selected index parameter name   -->
    <put name="mainmenuParameterName"    value="mainmenu"/> <!-- the submenu selected index parameter name    -->
    <put name="defaultMainmenuIndex"     value="0"/>     <!-- the default value of mainmenu selected index -->
    <put name="defaultSubmenuIndex"      value="1" />    <!-- the default value of submenu selected index  -->
    <put name="isShow"                   value="true"/>  <!-- wheather or not show query parameters, the default value is true        -->
    <put name="title"     value="Tiles 1.1 Examples" />
    <put name="header"    value="/components/common/header.jsp" />
    <put name="menu"      value="application.dynamic.mainmenu" />
    <put name="submenu"   value="application.dynamic.submenu" />
    <put name="errors"    value="/components/common/errors.jsp" />
    <put name="footer"    value="/components/common/footer.jsp" />
  </definition>

  <!--extend appliction.dynamic.classic, content dynamic layout -->
  <definition name="application.dynamic.classic" extends="application.dynamic.basic">
    <put name="content" value="/components/common/login.jsp"/>
  </definition>
  <!-- =======================================================  -->
  <!-- tabs menu definitions  				        -->
  <!-- =======================================================  -->
  <definition name="application.dynamic.mainmenu" path="/layouts/dynamic/dynamicMainmenuLayout.jsp" >
    <putList name="menuList" >
      <item value="tiles.mainmenu.item0.value"	 link="/middleUserForwardAction.do?defaultMainIndex=0" tooltip="tiles.mainmenu.item0.tooltip" />
      <item value="tiles.mainmenu.item1.value"	 link="/middleServiceForwardAction.do?defaultMainIndex=1" tooltip="tiles.mainmenu.item1.tooltip" />
      <item value="tiles.mainmenu.item2.value"	 link="/middleRouteForwardAction.do?defaultMainIndex=2" tooltip="tiles.mainmenu.item2.tooltip" />
      <item value="tiles.mainmenu.item3.value"	 link="/middleCountermandForwardAction.do?defaultMainIndex=3&amp;defaultSubIndex=1" tooltip="tiles.mainmenu.item3.tooltip" />
      <item value="tiles.mainmenu.item4.value"	 link="/middleOthersForwardAction.do?defaultMainIndex=4&amp;defaultSubIndex=1" tooltip="tiles.mainmenu.item4.tooltip" />
    </putList>
  </definition>

  <!-- =======================================================  -->
  <!-- submenu definitions  				        -->
  <!-- =======================================================  -->
  <definition name="application.dynamic.submenu" path="/layouts/dynamic/dynamicSubmenuLayout.jsp" >
    <put name="menuCount" value="6"/>
    <put name="submenuTitle0"  value="tiles.mainmenu.item0.title" />
    <put name="submenuTitle1"  value="tiles.mainmenu.item1.title" />
    <put name="submenuTitle2" value="tiles.mainmenu.item2.title" />
    <put name="submenuTitle3"  value="tiles.mainmenu.item3.title" />
    <put name="submenuTitle4"  value="tiles.mainmenu.item4.title" />
    <putList name="leftList3">
       <item value="tiles.mainmenu.item3.submenu.left.item0.value" link="/middleAppForwardAction.do?defaultMainIndex=3&amp;defaultSubIndex=1" tooltip="tiles.mainmenu.item3.submenu.left.item0.tooltip"/>
       <item value="tiles.mainmenu.item3.submenu.left.item1.value" link="/middleAppQuitAdminForwardAction.do?defaultMainIndex=3&amp;defaultSubIndex=2" tooltip="tiles.mainmenu.item3.submenu.left.item1.tooltip"/>
       <item value="tiles.mainmenu.item3.submenu.left.item2.value" link="/middleAppQuitRouteForwardAction.do?defaultMainIndex=3&amp;defaultSubIndex=3" tooltip="tiles.mainmenu.item3.submenu.left.item2.tooltip"/>
       <item value="tiles.mainmenu.item3.submenu.left.item3.value" link="/middleAppUserForwardAction.do?defaultMainIndex=3&amp;defaultSubIndex=4" tooltip="tiles.mainmenu.item3.submenu.left.item4.tooltip"/>
    </putList>

    <putList name="leftList4">
        <item value="tiles.mainmenu.item4.submenu.left.item0.value"    link="/middleBlackPhoneForwardAction.do?defaultMainIndex=4&amp;defaultSubIndex=1" tooltip="tiles.mainmenu.item4.submenu.left.item0.tooltip" />
        <item value="tiles.mainmenu.item4.submenu.left.item1.value"    link="/middleTestPhoneForwardAction.do?defaultMainIndex=4&amp;defaultSubIndex=2"       tooltip="tiles.mainmenu.item4.submenu.left.item1.tooltip"/>
        <item value="tiles.mainmenu.item4.submenu.left.item2.value"    link="/middleReplacePhoneForwardAction.do?defaultMainIndex=4&amp;defaultSubIndex=3"       tooltip="tiles.mainmenu.item4.submenu.left.item2.tooltip"/>
        <item value="tiles.mainmenu.item4.submenu.left.item3.value"    link="/middleFilterForwardAction.do?defaultMainIndex=4&amp;defaultSubIndex=4"       tooltip="tiles.mainmenu.item4.submenu.left.item3.tooltip"/>
    </putList>
  </definition>
<p>

将菜单分成两级,如果菜单要修改,只要修改菜单中的item的设置,如果不需要子菜单,只要将submenu中的相应的List不设置就可以了。

至于具体的显示效果,你要修改jsp文件就可以了。

猜你喜欢