This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JSP and the fly likes calling servlet from jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "calling servlet from jsp" Watch "calling servlet from jsp" New topic
Author

calling servlet from jsp

luca cillo
Greenhorn

Joined: Aug 27, 2002
Posts: 2
how can i call a servlet from a jsp?
i can set the action property of the form, i tried but didn't work out...
can i map my servlet in the web.xml file or something like that??
thanxs
Ivan Matmati
Ranch Hand

Joined: Feb 26, 2003
Posts: 41
Hello,
if you can't call a servlet from a form, it is not a matter of jsp.Either your url or your mapping of the url path to the servlet is wrong.Have a look.


No Gates!<p>SCPJ 1.4<br />SCWCD 1.4
Peekaboo Switchback
Ranch Hand

Joined: Feb 18, 2003
Posts: 33
You can use jsp:forward or you can use a redirect/forward enclosed in scriptlets.
<jsp:forward page="some relative URL"/>
or
<% request.getRequestDispatcher("your jsp/servlet url here").forward/redirect.
Since scriptlets get executed in _jspService(), they can forward requests to a servlet or jsp.
Parsuram panigrahi
Greenhorn

Joined: Feb 18, 2003
Posts: 17
You can call a servlet from a JSP by forwarding the request to the JSP.

<JSP:forward page="/foo.servlet"/>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: calling servlet from jsp
 
Similar Threads
servlet
Servlets interview questions . . .
Servlet to Jsp parameter calling
Getting the div values
pass the control from jsp to Servlet?