• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Mapping

 
italo matos
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have in my web.xml:

...
<servlet>
<servlet-name>LoginController</servlet-name>
<servlet-class>scwcd.controller.LoginController</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LoginController</servlet-name>
<url-pattern>/Login.do</url-pattern>
</servlet-mapping>


The Application URL is : http://localhost:8080/scwcdApp/ ok ?
in my form, i have:
...
<form action="/Login.do">
...
</form>

but, when i submit the form, i get page not found, because it sends to http://localhost:8080/Login.do

How can to do, form submit to http://localhost:8080/scwcd/Login.do ?





 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Sends it to your server root, not web app root.

you would have to use /scwcdApp/Login.do (given scwcdApp is your web app name)
 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4496
267
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sebastian Janisch wrote:you would have to use /scwcdApp/Login.do (given scwcdApp is your web app name)

You can simply use <form action="Login.do">
 
italo matos
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, but then i will to change all /Login.do to /scwcdApp/Login.do , and when i will do deploy, i will change again ?



 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4496
267
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
italo matos wrote:Ok, but then i will to change all /Login.do to /scwcdApp/Login.do , and when i will do deploy, i will change again ?

Again, you can simply use <form action="Login.do">
No need to mention the web application root name explicitly.
 
italo matos
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Devaka Cooray wrote:
italo matos wrote:Ok, but then i will to change all /Login.do to /scwcdApp/Login.do , and when i will do deploy, i will change again ?

Again, you can simply use <form action="Login.do">
No need to mention the web application root name explicitly.


but my jsp page, is in other directory (/scwcd/pages/)

 
Devaka Cooray
ExamLab Creator
Marshal
Pie
Posts: 4496
267
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to change the action as <form action="../Login.do"> it may work.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use ${pageContext.request.contextPath}/Login.do
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic