• 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
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Virtual path not working in url

 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi I as trying a sample application as in HFJS book chapter 3.
I have a form.html which says action="SelectBeer.do"

and the web.xml mapping is like:
<servlet>

<servlet-name>CH3 Beer</servlet-name>
<servlet-class>com.example.web.SelectBeer<servlet-class>

</servlet>

<servlet-mapping>
<servlet-name>CH3 Beer</servlet-name>
<url-pattern>/SelectBeer.do</url-pattern>
</servlet-mapping>


NOw this works fine when my form is submitted.
But I want to have a virtual URL in the DD as well as the URL in addressbar.I tried to change the DD and action with "/virtual/mydir/SelectBeer.do" at both the places ie. form.html and DD url-pattern,but it did not work.It gave 404 error.
How can I change the URl pattern to anything virtual and still call the s
ame servlet?
 
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
What are you calling a virtual URL ?
 
amarkirt saroay
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
/virtual/mydir/ directories do not exist in my webapp structure,its just made up and appears in the URL pattern only.
 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can call servlet with any virtual name by simply changing your url pattern value in DD as *.do
 
Ew. You guys are ugly with a capital UG. Here, maybe this tiny ad can help:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic