Solved

in struts how can i set/get application value?

Posted on 2004-08-17
4
323 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
getting Http 404 error in jsp forms 8 73
java cigar challenge 58 206
Can't access image with tomcat/html 6 95
mask rule in struts validation.xml 5 85
There are many Password Managers (PM) out there to choose from. PM's can help with your password habits and routines, but they should not be a crutch you rely on too heavily. I also have an article for company/enterprise PM's.
Knowledge base software has turned out to be a quite reliable method for storing information, promoting collaborative work and for sharing valuable input and solutions.However, some organizations are trying to develop a knowledge base that works wit…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

896 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

13 Experts available now in Live!

Get 1:1 Help Now