Well. I've been finding a solution how should I fix this stuff.
I look through the internet and i can't find any.
I searched the forum and found out that quite a few people have the same problem, but did not find a solution.
LoginLotto.java
|
Code:
|
package login;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class LoginLotto extends HttpServlet{
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println(" <head>");
// and list go down |
WelcomeLotto.java
|
Code:
|
package welcome;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class WelcomeLotto extends HttpServlet{
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String strUsername = request.getParameter("username");
String strPassword = request.getParameter("password");
String strUsername2 = "admin";
String strPassword2 = "technology";
String strValidateUN = strUsername2;
String strValidatePW = strPassword2;
if(strUsername != strValidateUN ||strPassword != strValidatePW )
{
out.println("<html>");
out.println(" <head>");
// and the list go down |
web.xml
here's some part
|
Code:
|
<!-- Define servlets that are included in the example application -->
<servlet>
<servlet-name>
LoginLotto
</servlet-name>
<servlet-class>
login.LoginLotto
</servlet-class>
</servlet>
<servlet>
<servlet-name>
WelcomeLotto
</servlet-name>
<servlet-class>
welcome.WelcomeLotto
</servlet-class>
</servlet>
<!-- JSPC servlet mappings start -->
<servlet-mapping>
<servlet-name>
LoginLotto
</servlet-name>
<url-pattern>
/login
</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>
WelcomeLotto
</servlet-name>
<url-pattern>
/welcome
</url-pattern>
</servlet-mapping>
</web-app> |
everytime i access http: //localhost:8080/workspace/login , it works pretty fine. but once i click the submit button, a message appears like this:
|
Quote:
|
HTTP Status 405 - HTTP method POST is not supported by this URL
type Status report
message HTTP method POST is not supported by this URL
description The specified HTTP method is not allowed for the requested resource (HTTP method POST is not supported by this URL).
Apache Tomcat/5.0.28
|
as i look at my address bar, it was posted as http ://localhost:8080/workspace/welcome - that only shows that the process moved on the next servlet. but why im getting the http status 405?
soon, as i click the address bar, then pressing enter (without editing the address path), the Welcome part was fixed.
how should i get rid of http status 405?
// dont mind the links, i did it intentionally, i cant post any links yet.