This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design 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