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 to insert static variable with struts tags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
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: 31079
    
163

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, 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