wood burning stoves 2.0*
The moose likes JSP and the fly likes conditional login.jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "conditional login.jsp" Watch "conditional login.jsp" New topic
Author

conditional login.jsp

Pavel Saratchev
Greenhorn

Joined: Mar 12, 2007
Posts: 1
Hi,

is it possible to make a condition for the jogin.jsp. If there are name='...' and password='...' in the query string from the Request and the both of them are not empty, than I want to run the j_securitycheck action automatically and not have to write the name and the password in the form. My login.jsp looks at the moment like this:

<html>
<head>
</head>

<body>
<form method="POST" action="j_security_check">
<table>
<!-- input fields -->
<tr>
<td align="left">User Name:</td>
<td align="right"><input tabindex="1" type="text" name="j_username"></td>
</tr>
<tr>
<td align="left">Password:</td>
<td align="right"><input tabindex="2" type="password" name="j_password"></td>
</tr>

<!-- Save/Reset buttons -->
<tr>
<td colspan="2">
<input type="submit" name="save" value="Log in" />

<input type="reset" name="reset" value="Reset" />
</td>
</tr>
</table>
</form>
</body>

</html>
Chakravarthy Gogineni
Greenhorn

Joined: Nov 09, 2005
Posts: 10
You can write a javascript function to check for those fields before submitting the form. Which returns true if both the fields are not empty. You can call this function after Onclick event.



When Javascript function returns true, then only request is forwarded to the action.

onKlick, 'K' should be replaced with 'c. Had to write like that as this replying system is not letting to post and complaining about javascipt malicious content


SCJP, SCWCD
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Do you really want to put someone's password in the querystring?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Chakravarthy Gogineni
Greenhorn

Joined: Nov 09, 2005
Posts: 10
Can you please explain what does it mean by putting password in query string?
 
 
subject: conditional login.jsp
 
Similar Threads
Servlet code in JSP page
problem in jsp !!!
redirect from external page to tomcat 4 with forms based authentication
JDBCUserRealm question
Resetting Values in JSP Page