• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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
 
We can walk to school together. And we can both read this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic