Solved

in struts how can i set/get application value?

Posted on 2004-08-17
4
320 Views
Last Modified: 2012-05-05
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.
      }
0
Comment
Question by:hgbdelphi
  • 2
4 Comments
 

Author Comment

by:hgbdelphi
ID: 11818678
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!
0
 
LVL 4

Expert Comment

by:Oliver_Dornauf
ID: 11819069
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
0
 
LVL 3

Accepted Solution

by:
sbockelman earned 50 total points
ID: 11823567
in the action you can do what you want like this:

getServlet().getServletContext().getAttribute( "foo" )

0
 

Author Comment

by:hgbdelphi
ID: 11826613
thank for your help,
hi,sbockelman ,your code can help me ,thank!

0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Is your company's data protection keeping pace with virtualization? Here are 7 dynamic ways to adapt to rapid breakthroughs in technology.
We have come a long way with backup and data protection — from backing up to floppies, external drives, CDs, Blu-ray, flash drives, SSD drives, and now to the cloud.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now