This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can this be done better (html:link)

 
Ray Beaumont
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 192
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic