| Author |
Application attribute in struts 1
|
divya kundapur
Ranch Hand
Joined: Aug 21, 2007
Posts: 110
|
|
|
I want to set application context attirbute in my struts action class and use it later in another jsp. I m using struts 1.
|
SCJP - 5.0
|
 |
Sagar Rohankar
Ranch Hand
Joined: Feb 19, 2008
Posts: 2896
|
|
divya kundapur wrote:set application context attirbute
Either define the context variable in DD (web.xml)
OR get the instance of javax.servlet.ServletContext and use "setAttribute()" method.
HTH
|
[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
|
 |
Shailesh Narkhede
Ranch Hand
Joined: Jul 10, 2008
Posts: 356
|
|
You can use following code,
this.getServlet().getServletContext().setAttribute("name",value);
|
Thanks,
Shailesh
|
 |
Sagar Rohankar
Ranch Hand
Joined: Feb 19, 2008
Posts: 2896
|
|
|
Not a good thing by directly providing a code, let them search the API and come up with their solution.
|
 |
Shailesh Narkhede
Ranch Hand
Joined: Jul 10, 2008
Posts: 356
|
|
OK, sagar.
|
 |
 |
|
|
subject: Application attribute in struts 1
|
|
|