File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes bean:define not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "bean:define not working" Watch "bean:define not working" New topic

bean:define not working

Sandeep Awasthi
Ranch Hand

Joined: Oct 23, 2003
Posts: 597
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 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"/>
<definition name=".main.body" path="/includes/mainBody.jsp">

my menuLayout.jsp is

Please help me


[ May 02, 2007: Message edited by: Rajesh Thakare ]

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33124

Where do you define "test" ?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Sandeep Awasthi
Ranch Hand

Joined: Oct 23, 2003
Posts: 597
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" >

<bean:define id="test" name="item" property="link" /><html:link action="<%=test %>" >
<bean:write name="item" property="value" />
[ May 02, 2007: Message edited by: Rajesh Thakare ]
Sumit Malik
Ranch Hand

Joined: Jan 05, 2007
Posts: 84
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

If at first you don't succeed, don't try skydiving
Sandeep Awasthi
Ranch Hand

Joined: Oct 23, 2003
Posts: 597
Hi Sumit,

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

thanks for reply.


I agree. Here's the link:
subject: bean:define not working
It's not a secret anymore!