Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to insert static variable with struts tags

 
Shankar Narayana
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is there any way I can use the struts tag library to put the value of a static variable in the jsp.

for ex:


I want to put the value of REQUEST_TYPE in the jsp, how?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34178
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shankar,
There are two ways of doing this, both a bit messy:

1) Use a partial scriptlet:
<bean efine id="staticField" value="<%= new String(ReqSessConstants.REQUEST_TYPE) %>" />
<bean:write name="staticField" />

2) Wrap the constant in a getter method of a bean.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic