• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

bean:define not working

 
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 ]
 
author & internet detective
Posts: 40200
816
Eclipse IDE VI Editor Java
  • 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 ]
 
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
 
These are the worst of times and these are the best of times. And this is the best tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic