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 How can this be done better (html:link) 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 "How can this be done better (html:link) " Watch "How can this be done better (html:link) " New topic
Author

How can this be done better (html:link)

Ray Beaumont
Greenhorn

Joined: Nov 25, 2003
Posts: 7
I've got a generic page and I'd like to pass text in to be displayed at the top. My Action class puts the Resource into the session:
HttpSession session = request.getSession();
session.setAttribute("logon_message", "k35.logon.postad");
I'd ideally like to be able to write a single tag that would write the String that corresponds to k35.logon.postad in my Application Resources file. Can anybody suggest an improvement on the following?
<logic resent name="logon_message">
<p class="heading">
<bean:message key="<%=session.getParameter("logon_message")%>"/>
</p>
</logic resent>
David Yutzy
tumbleweed and gunslinger
Ranch Hand

Joined: Jun 29, 2001
Posts: 192
Why not have your action class hit the resource bundle and place the actual "message" in session, rather than the name?
That way, in the JSP file, you would just have:

Better yet, place it in page or request scope, unless you have a specific reason to place it in session.
[ December 12, 2003: Message edited by: David Yutzy ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can this be done better (html:link)
 
Similar Threads
Problem with a select tag
Problem with session
Logic iterate
session variable in presentation layer
populating jsp page dynamically using form beans