Link to home
Start Free TrialLog in
Avatar of hgbdelphi
hgbdelphi

asked on

in struts how can i set/get application value?

hi,experts now i hava a struts page like this
,how can i get the application value???
thanks!
      public ActionForward execute(
            ActionMapping mapping,
            ActionForm form,
            HttpServletRequest request,
            HttpServletResponse response)
            throws Exception {
                        //in servlet i can do this get the application "application" value,but when i use struts,how can i get the application value???
            //getServletContext().setAttribute("application","testvalue");  //can get application value in servlet,but not get value in it.
      }
Avatar of hgbdelphi
hgbdelphi

ASKER

i can set session like this in Struts's action
      request.getSession().setAttribute("aa","test")

but how can i set application in Sturts 's action??

thanks very much!
struts comes with a class TagUtils wich have your function. (or you can study the source if you need a diffrent implementation)

look at: http://struts.apache.org/api/index.html 
the classname is  org.apache.struts.taglib.tiles.util.TagUtils
ASKER CERTIFIED SOLUTION
Avatar of sbockelman
sbockelman

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thank for your help,
hi,sbockelman ,your code can help me ,thank!