Hello everyone,
I have a login.html which accepts username & password
,if the user enters valid username & password i want
the servlet to bring up InquiryFrame.html. Iam using
Tomcat 3.3 as servlet container & web . any help would
be much appreciated.
Thanks
Raju
login.html
<html>
<head>
<title>Login</title>
</head>
<body>
<font face="Verdana">Please login here</font>
<form method="POST" action="/examples/servlet/login">
<font face="Verdana"><p>Login</font>
<input type="text" name="username" size="12">
<br>
<font face="Verdana">Password</font>
<input type="password" name="password" size="12">
</p>
<input type="submit" value="Submit" name="Login">
</p>
</form>
login.java
server.import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class login extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String userName =
request.getParameter("username");
String password =
request.getParameter("password");
int a = userName.compareTo("xxx");
int b = password.compareTo("yyy);
if ((a == 0) && (b == 0)) {
// here i need to call
InquiryFrame.html which is in
/examples/servlet/InquiryFrame.html
out.println(" can access!!!");
} else {out.println("Invalid
username/password ");}
}
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
doGet(request, response);
}
}
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html