• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Servlet Mapping

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?





 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Sheriff
Posts: 7134
1360
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 7134
1360
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 7134
1360
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try to change the action as <form action="../Login.do"> it may work.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could use ${pageContext.request.contextPath}/Login.do
 
Would you turn that thing down? I'm controlling a mind here! Look ... look at the tiny ad ...
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic