Awesome find. Thanks David!

David Friedman <[EMAIL PROTECTED]> wrote: My bad, what was I thinking? LOL.  
Try this:

servlet.getServletConfig().getServletContext().getAttribute(Globals.SERVLET_
KEY));

As in this example where I print out an error message:
public class DavidAction extends Action {
 @Override
 public ActionForward execute(ActionMapping mapping, ActionForm form,
   HttpServletRequest request, HttpServletResponse response) throws
Exception {

  System.out.println("Hello Paul, the Struts prefix or suffix mapping is: "
    + servlet.getServletConfig().getServletContext().getAttribute(
      Globals.SERVLET_KEY));
  return (mapping.findFoward("success"));
 }

And my logged response was:

> Hello Paul, the Struts prefix or suffix mapping is: *.do

Regards,
David

-----Original Message-----
From: Paul Benedict [mailto:[EMAIL PROTECTED]
Sent: Saturday, August 19, 2006 11:49 PM
To: user@struts.apache.org
Subject: Struts URL Pattern


Does anyone know how to get the Struts servlet pattern at runtime? I want to
get what the servlet is mapped for, like *.do or /do/, etc.

Paul


---------------------------------
Do you Yahoo!?
 Next-gen email? Have it all with the  all-new Yahoo! Mail Beta.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



                
---------------------------------
Stay in the know. Pulse on the new Yahoo.com.  Check it out. 

Reply via email to