jQuery in Action, 2nd edition*
The moose likes Servlets 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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Calling servlet from jsp" Watch "Calling servlet from jsp" New topic
Author

Calling servlet from jsp

sing
Ranch Hand

Joined: Nov 29, 2001
Posts: 121
I use <jsp:forward> to calling my servlet but an error come out. My servlet has only doGet().
This is my code.
<jsp:forward page="/servlet/TestingServlet" />
<jsp aram name="name" value="value" />
</jsp:forward>
Error:
HTTP method POST is not supported by this URL
steffy
[ September 23, 2002: Message edited by: Steffy Sing ]
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
Originally posted by Steffy Sing:
I use <jsp:forward> to calling my servlet but an error come out. My servlet has only doGet().
This is my code.
<jsp:forward page="/servlet/TestingServlet" />
<jsp aram name="name" value="value" />
</jsp:forward>
Error:
HTTP method POST is not supported by this URL
steffy
[ September 23, 2002: Message edited by: Steffy Sing ]

that means that the HTTP method POST is not supported by this URL.
try putting a doPost method in your servlet and inside that method call the doGet method. What I usually do is to have a method like this one:

cheers


I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
chanoch wiggers
Author
Ranch Hand

Joined: May 24, 2001
Posts: 245
alternatively, you can also add
method="GET" to force the form to be submitted using get rather than post


chanoch<p><a href="http://www.amazon.com/exec/obidos/ASIN/1861007736/" target="_blank" rel="nofollow">Author of Professional Apache Tomcat</a></p>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling servlet from jsp
 
Similar Threads
calling servlet from jsp
call servlet from a jsp
Calling servlet from JSP
Error passing data from jsp to servlet
servlet and jsp in weblogic 5.1