This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Servlets and the fly likes how to map url in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Servlets
Reply locked New topic

how to map url in java

Nuha Iqbal

Joined: Jul 24, 2012
Posts: 2

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

for example i have this web.xml


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

<form action="??" method="get" >
shivam singhal
Ranch Hand

Joined: Jul 15, 2012
Posts: 231

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="">

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

<servlet-name>foo file</servlet-name>
<servlet-class><servlet-class> // this is the actual path of your servlet in com.example package
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63349

This was discussed in this topic just yesterday. Please SearchFirst.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: how to map url in java
It's not a secret anymore!