aspose 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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies 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
internet detective
Marshal

Joined: May 26, 2003
Posts: 29220
    
135

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
 
Similar Threads
variable in scriplet and declaration
JSP in Struts
Pass a Variable from JSP via JSP to an Action Servlet
Function call inside struts tags
assign return value of function from javascript to variable in jsp