File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
    Bookmark Topic Watch Topic
  • New Topic

how to map url in java

 
Nuha Iqbal
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • 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>
 
shivam singhal
Ranch Hand
Posts: 231
Java Notepad Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • 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>
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
 
I agree. Here's the link: http://aspose.com/file-tools
    Bookmark Topic Watch Topic
  • New Topic