File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Problem using struts bean tag in tiles put tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem using struts bean tag in tiles put tag" Watch "Problem using struts bean tag in tiles put tag" New topic
Author

Problem using struts bean tag in tiles put tag

Shailesh Welankar
Ranch Hand

Joined: Dec 30, 2002
Posts: 35
Hi

I have a question : I have a tiles base jsp page and wanted to have one of the "put" item in it to get its value by using the struts bean tag with the message attribute. Something like this -

<tiles:insert page="/layout/BasicLayout.jsp" flush="true">
. . .
<tiles : put name="title" value="<bean:message key="FAQ.title.display"/>" type="String" />
. . .
</tiles:insert>

and the BasicLayout.jsp is getting the "title" as -

<head>
<html:base />
<title><tiles:getAsString name="title" /></title>

I am using MyEclipse IDE with BEA Weblogic plugged in, Struts 1.1.
All the config is done properly and the files ar located correctly.
If I do a 'view source' on the browser (IE 6.0.x) I can see the first line as - <tiles : put name="title" value="Frequently Asked Questions" type="String" />, so it can get the value but the page is getting errors and redirected to custom Error Page. If I remove the bean tag and hard code it to a value, it works fine.
Anybody, any idea why this is happening or whether it is possible at all to do this ?! I just wanted to reduce hard coding in my code and let the resources.properties be the only location that needs changes if at all needed !

thanks in advance and have a gr8 weekend !

--Shailesh Welankar

[ July 01, 2005: Message edited by: Shailesh Welankar ]

[ July 01, 2005: Message edited by: Shailesh Welankar ]
[ July 01, 2005: Message edited by: Shailesh Welankar ]

--Shailesh Welankar
SCDJWS 1.4 | SCBCD 5.0 | SCWCD 1.4 | SCJP 1.4 | Preparing for SCEA 5
Ken Loh
Ranch Hand

Joined: Feb 16, 2005
Posts: 190
I didn't know one can do the way you did.

What I normally do is ask the resource manager to get the message for the key and then do the value="<%=myMessageValue%>" thingy.

Originally posted by Shailesh Welankar:
Hi

<tiles : put name="title" value="<bean:message key="FAQ.title.display"/>" type="String" />

[ July 03, 2005: Message edited by: Ken Loh ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem using struts bean tag in tiles put tag
 
Similar Threads
confusion on struts tile
Struts Tiles and Internationalization
Passing Tiles into an IFRAME.
Access resources from jsp without using "bean:message" tag
Tiles Context is there and is not there?