This week's book giveaway is in the
General Computing
forum.
We're giving away four copies of
Arduino in Action
and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See
this thread
for details.
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
Arduino in Action
this week in the
General Computing
forum!
A special promo:
Enter your blog post or vote on a blogger to be featured in an upcoming Journal
JavaRanch
»
Java Forums
»
Java
»
Servlets
Author
HTTP method GET is not supported by this URL
vineet walia
Ranch Hand
Joined: Feb 16, 2008
Posts: 138
posted
Mar 11, 2010 07:58:39
0
my code is :
import java.io.*; import java.io.IOException; import java.net.*; import javax.servlet.*; import javax.servlet.http.*; public class loginservlet extends HttpServlet { public void doget(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { sendloginform(response,false); } public void dopost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String userName=request.getParameter("username"); String passWord=request.getParameter("password"); if(userName!=null && passWord!=null&& userName.equals("abc") && passWord.equals("123")) { response.sendRedirect("http://localhost:8084/ap_07/index.jsp"); } else { sendloginform(response,true); } } private void sendloginform(HttpServletResponse response, boolean witherrormessage)throws ServletException,IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<html>"); out.println("<head>"); out.println("<title>Log-In</title>"); out.println("</head>"); out.println("<body>"); if(witherrormessage) out.println("Login fail plz try again"); out.println("<BR>"); out.println("<BR> Please enter your usename and password"); out.println("<BR><FORM METHOD=POST>"); out.println("<BR> uSER nAME:<INPUT TYPE=TEXT NAME=username>"); out.println("<BR> pASSWORD:<INPUT TYPE=PASSWORD NAME=password>"); out.println("<BR> <INPUT TYPE=SUBMIT VAMUE=submit>"); out.println("</FORM>"); out.println("</body>"); out.println("</html>"); } }
url:http://localhost:8084/ap_08/loginservlet
output:
--------------------------------------------------------------------------------
type Status report
message HTTP method GET is not supported by this URL
description The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).
--------------------------------------------------------------------------------
whats wrong with this code?
vineet walia
Ranch Hand
Joined: Feb 16, 2008
Posts: 138
posted
Mar 11, 2010 08:01:36
0
got my error
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35440
9
posted
Mar 11, 2010 08:14:36
0
That's why the @Override annotation is so valuable.
Android apps
–
ImageJ plugins
–
Java web charts
vineet walia
Ranch Hand
Joined: Feb 16, 2008
Posts: 138
posted
Mar 11, 2010 08:36:03
0
Ulf Dittmer wrote:
That's why the @Override annotation is so valuable.
yes brother
I agree. Here's the link:
http://aspose.com/file-tools
subject: HTTP method GET is not supported by this URL
Similar Threads
Help me please
HTML form
Servlet Invocation
Requested Dispatcher
error to login page
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter