Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

bean:define not working

 
Sandeep Awasthi
Ranch Hand
Posts: 597
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am devloping one small application for learning.

I have tile definition

<definition name=".mainLayout" path="/layouts/mainLayout.jsp">
<put name="title" value="0101 Application"/>
<put name="header" value="/includes/header.jsp"/>
<put name="menu" value=".mainMenu"/>
<put name="footer" value="/includes/footer.jsp"/>
<put name="body" value=".main.body"/>
</definition>
<definition name=".mainMenu" path="/layouts/menuLayout.jsp">
<putList name="list">
<item link="/Employee" value="Employee" classtype="org.apache.struts.tiles.beans.SimpleMenuItem"/>
<item link="/Welcome" value="Department" classtype="org.apache.struts.tiles.beans.SimpleMenuItem"/>
<item link="/Welcome" value="Exit" classtype="org.apache.struts.tiles.beans.SimpleMenuItem"/>
</putList>
</definition>
<definition name=".main.body" path="/includes/mainBody.jsp">



my menuLayout.jsp is


Please help me

Regards

Rajesh
[ May 02, 2007: Message edited by: Rajesh Thakare ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34178
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rajesh,
Where do you define "test" ?
 
Sandeep Awasthi
Ranch Hand
Posts: 597
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeanne


<%@ page contentType="text/html; charset=Cp1252" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-nested" prefix="nested" %>
<%@ taglib uri="/tags/struts-tiles" prefix="tile" %>

<tile:importAttribute />
<logic:iterate id="item" name="list" type="org.apache.struts.tiles.beans.MenuItem" >

<br>
<bean:define id="test" name="item" property="link" /><html:link action="<%=test %>" >
<bean:write name="item" property="value" />
</html:link>
</logic:iterate>
[ May 02, 2007: Message edited by: Rajesh Thakare ]
 
Sumit Malik
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rajesh,

You can give a try with specifying type attribute in bean efine tag as

<bean efine id="test" name="item" property="link" type="java.lang.String"/>

or try like <%=item.getLink()%> without specifying bean


Cheers !!!
Sumit Malik
 
Sandeep Awasthi
Ranch Hand
Posts: 597
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sumit,

It worked with <%=item.getLink()%> but why bean:define do not define scripting varibale that I could not understand.

thanks for reply.

Regards

Rajesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic