aspose file tools*
The moose likes Servlets and the fly likes code help!! 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 » Servlets
Bookmark "code help!!" Watch "code help!!" New topic
Author

code help!!

viveksivakumar
Greenhorn

Joined: Aug 06, 2001
Posts: 5
i have a jsp page which gets the user name and pass word , fine this works but what i need is that when the user name and pass word is false the page should not proceed further i mean the same login page should appear!!! how can i do this .help me.
SoonAnn Lim
Ranch Hand

Joined: Jun 21, 2001
Posts: 155
You can do a check at the login page. First get the username and password by request.getParameter("username") and ("password"), if this two objects are null(String usually), then present the login prompt for user to fill in the username and password. If username and password are not null, check if they are correct. If correct, you can forward the page using <jsp:forward page="your.html">, if incorrect, present login page again. Hope this help.
vivek sivakumar
Ranch Hand

Joined: Aug 09, 2001
Posts: 187
if the login is incorrect can i again use the jsp forward tag to display the same jsp page??? seems this does not work!!!


SCJP, SCWD <br />A farmer learns more from a bad harvest than a good one.
SoonAnn Lim
Ranch Hand

Joined: Jun 21, 2001
Posts: 155
These come right on top of my head.
**********************************
<%
username=request.getParameter("username");
password=request.getParameter("passowrd");
if (username==null | | password==null){
%>
<jsp:include file="login.html"/>
<%
}
else {
//do your verification here, return can be any, i prefer boolean
// boolean b=verificationMethod(username,password);
if (b){
//password match.
%>
<jsp:forward page="pageforrightuser.html"/>
<%
}
else {
%>
<jsp:include file="login.html"/>
//you may use <jsp:forward page="thispage.jsp/>, but you need some modification,not very sure, may try.
<%
}
}
%>
************************************************************
In your login.html, form action should point to this jsp page.Plese double check the syntax, i write it out on a fly. May contain some mistakes, but i think it should help you to understand logic behind the operation. Hope it helps.
[This message has been edited by SoonAnn Lim (edited August 09, 2001).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: code help!!
 
Similar Threads
windows and jsp!!!
2 CLARIFICATIONS
Using the JSP parameters to fill detail in a word document
jsp and javascript!!
Export data to Microsoft Word