|
Re: url-pattern in servlet mapping in web.xml [message #995070 is a reply to message #993369] |
Sat, 29 December 2012 01:45 |
Roberto Sanchez Herrera 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.
|
|
|
Powered by
FUDForum. Page generated in 0.03529 seconds