I am trying to setup an application XML config file that I want to place in the "WEB-INF" directory. I'm having trouble getting the server to see the file. If I were using a normal servlet, I'd use .getServletContext(). However, I don't think this is how Struts works.
Any help would be appreciated.
Thanks,
Chris
Discussions
Web tier: servlets, JSP, Web frameworks: What is the equivalent of .getServletContext() in Struts?
-
What is the equivalent of .getServletContext() in Struts? (3 messages)
- Posted by: Chris Smith
- Posted on: August 06 2004 09:07 EDT
Threaded Messages (3)
- reply by Jin Kuang on August 06 2004 10:38 EDT
- What is the equivalent of .getServletContext() in Struts? by Jon Crater on August 06 2004 22:08 EDT
- The equivalent of .getServletContext() in Struts by Suriyanarayanan Selvaraj on August 10 2004 03:57 EDT
-
reply[ Go to top ]
- Posted by: Jin Kuang
- Posted on: August 06 2004 10:38 EDT
- in response to Chris Smith
I thought the action in Struts is just an extention to the normal servlet and all methods you could get in servlet is available to the action. -
What is the equivalent of .getServletContext() in Struts?[ Go to top ]
- Posted by: Jon Crater
- Posted on: August 06 2004 22:08 EDT
- in response to Chris Smith
i assume you're trying to get a reference to the servlet context from within an action class? if so, you can use the protected instance variable of the Action superclass or the public getter, like so:
servlet.getServletContext();
or
getServlet().getServletContext() -
The equivalent of .getServletContext() in Struts[ Go to top ]
- Posted by: Suriyanarayanan Selvaraj
- Posted on: August 10 2004 03:57 EDT
- in response to Chris Smith
Hi christopher
The following must be a solution for Urs I think.
Try Ur luck.
public ActionForward execute(ActionMapping map, ActionForm form,HttpServletRequest req, HttpServletResponse resp) throws Exception {
//***********************************
req.getSession().getServletContext();
//***********************************
Bye for now
suriya