Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » url-pattern in servlet mapping in web.xml(url-pattern in servlet mapping in web.xml)
url-pattern in servlet mapping in web.xml [message #993369] Mon, 24 December 2012 02:13 Go to next message
g kumar is currently offline g kumar
Messages: 5
Registered: December 2012
Junior Member
The servlet is in the server location <application folder>/WEB-INF/classes/<package>.
In the web.xml what should be the url-pattern in servlet mapping so that that servlet can be executed when mentioned in the ACTION of a jsp file.

When the jsp page is running, it is showing the error that the respective servlet is not found.

regards,
gkumar
Re: url-pattern in servlet mapping in web.xml [message #995070 is a reply to message #993369] Fri, 28 December 2012 20:45 Go to previous message
Roberto Sanchez Herrera is currently offline Roberto Sanchez Herrera
Messages: 28
Registered: January 2011
Junior Member
Hello,
What do you mean by Action in a JSP file? do you mean the action attribute of a form?

If your web project is version 2.4 or earlier, and you use the new servlet wizard to create your servlet, a servlet mapping is added to the web.xml file, something like this:

<servlet-mapping>
        <servlet-name>MyServlet</servlet-name>
        <url-pattern>/MyServlet</url-pattern>
</servlet-mapping>


If you want to use this servlet as the target of a form, using the action attribute of the form, you can use something like this:

<form action="MyServlet">


It is important to use the relative path, and not absolute path (i.e., you should not use <form action="/MyServlet">), so the context root of the application is used.

I hope this helps. If it does not, please provide more details, for example, what is the version of your web app, what actions you are using in your JSP, what is the resulting URL, etc.
Previous Topic:web.xml model utilities?
Next Topic:Support for profile specific dependencies in m2e-wtp
Goto Forum:
  


Current Time: Fri Aug 29 20:21:39 EDT 2014

Powered by FUDForum. Page generated in 0.06491 seconds