• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

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: 6959
1317
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: 6959
1317
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: 6959
1317
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
 
This parrot is no more. It has ceased to be. Now it's a tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic