Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (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 07:13 Go to next message
g kumar is currently offline g kumarFriend
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] Sat, 29 December 2012 01:45 Go to previous message
Roberto Sanchez Herrera is currently offline Roberto Sanchez HerreraFriend
Messages: 36
Registered: January 2011
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: Thu Apr 25 19:28:10 GMT 2024

Powered by FUDForum. Page generated in 0.02990 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top