• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

calling a servlet

 
Ranch Hand
Posts: 1162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I thought that If I had mapped my servlet in the web.xml as

I could just call it directly without using a slash or anything like that in my JSP like:
<form action="ProcessNewCust" method="get">

but It turned out my belief was wrong. To get this to work I had to do:
<form action="../ProcessNewCust" method="get">
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where is the page that contains the form?
Is it in the root directory of the app?
Is it in a JSP or a static HTML file?
 
Arvind Mahendra
Ranch Hand
Posts: 1162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ben Souther:
Where is the page that contains the form?
Is it in the root directory of the app?
Is it in a JSP or a static HTML file?



It is its own JSP page that is in a folder called newCust.
I guess calling the servlet with a ../ takes me to the root of the web app?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It does. the '../' symbol means 'parent directory'.

This is not the best way to build paths in a Servlet/JSP app.
See:
http://faq.javaranch.com/java/RelativeLinks
for a very complete and detail description of the contextPath and how best to add it to your URLs.
[ November 22, 2007: Message edited by: Ben Souther ]
 
Arvind Mahendra
Ranch Hand
Posts: 1162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ben Souther:
It does. the '../' symbol means 'parent directory'.

This is not the best way to build paths in a Servlet/JSP app.
See:
http://faq.javaranch.com/java/RelativeLinks
for a very complete and detail description of the contextPath and how best to add it to your URLs.

[ November 22, 2007: Message edited by: Ben Souther ]



Hi Ben,
Thanks a lot for the link you directed me too. After reading it I am trying to build a link as depicted in that document, although I believe its discouraged but Id still like to try to use the domain name method.

In my header.html file. I tried doing something like this
<img src="http://localhost:8084/Abc_Autos/images/logo.jpg" >
where Abc_Autos is the name of my web app. But this technique doesn't work. I am using netbeans. I can see the images folder when I tab the 'files view' in netbeans. And I can also see the images folder and the image when I physically navigate to the directory.
 
Don't MAKE me come back there with this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic