This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Struts and the fly likes how to insert static variable with struts tags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to insert static variable with struts tags" Watch "how to insert static variable with struts tags" New topic
Author

how to insert static variable with struts tags

Shankar Narayana
Ranch Hand

Joined: Jan 08, 2003
Posts: 134
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?


"Failure is not when you fall down; its only when you fail to get up again."
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 32603
    
215

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.


[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to insert static variable with struts tags
 
It's not a secret anymore!