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

how to map url in java

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi,

I am beginner in Java, I had a problem in mapping the url with action attribute.

for example i have this web.xml

<servlet-map>
<servlet-name>example</servlet-name>
<url-pattern>pack/*</url-pattern>
</servlet-map>

then how can i call this servlet from jsp?
what to write in action?

<form action="??" method="get" >
....
</form>
 
Ranch Hand
Posts: 231
Tomcat Server Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
this "web.xml" is not your servlet...
web.xml passes the clients request to servlet hiddenly...
so, that the client get no idea where your servlet is placed..

for clearification suppose..

<form method="post" action="foo.do">
.
.
.
</form>


in web.xml
<servlet-mapping>
<url-pattern>foo.do</url-pattern>
<servlet-name>foo file<servlet-name> //this is any name by your choice so, that your xml file knows this
</servlet mapping>

<servlet>
<servlet-name>foo file</servlet-name>
<servlet-class>com.example.foo<servlet-class> // this is the actual path of your servlet in com.example package
</servlet>
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
This was discussed in this topic just yesterday. Please SearchFirst.
 
There were millions of the little blood suckers. But thanks to this tiny ad, I wasn't bitten once.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
    Bookmark Topic Watch Topic
  • New Topic