Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

password and redirect question

 
Phillip Haddad
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys,

Im sort of new to the whole web technology thing I'm more of a C/C++ coder, im trying to make a web app for work, and I have a form controller going with proper validation (on username and password) which has a business logic layer and connects to database to make sure user exists etc etc. When an error occurs the form reloads and error is specified in red they way i want, my problem is i want the password field to clear itself when the password is incorrect.





Another qucik question when the user does log in succesfully i have a logout on the main page and got this code with it, however it constantly redirects, im not sure how to do it






any help would be greatly appreciated, thanks in advance

- Phill

[ August 07, 2006: Message edited by: Phillip Haddad ]
[ August 07, 2006: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Phillip Haddad:
i want the password field to clear itself when the password is incorrect.


Don't specify a value attirbute.

<a href="<c:redirect url="/loginForm.htm"/>">Logout</a>


This is not doing anything remotely like you think it is.

The redirect will happen as the JSP is executed on the server long before the page gets sent to the browser for it to interpret the anchor tag. let alone for the user to click on it.

This article may help you understand what happens when, where and why.
[ August 07, 2006: Message edited by: Bear Bibeault ]
 
Phillip Haddad
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for that Bear, i understand that now, however if i just linked it back to the loginForm.htm would that sort of clear the session? If i was to use a <jsp:...> tag would it execute upon page load as well? Its just hard to find this sort of info
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
P.S. In the future, it would be best to ask unrelated questions in separate posts.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Phillip Haddad:
however if i just linked it back to the loginForm.htm would that sort of clear the session?


No, your logout link/button should make a request to a servlet controller that would invalidate the session, then forward on to the login page.

Here's another article on web app structure that might be informative.

If i was to use a <jsp:...> tag would it execute upon page load as well?


Yes, all JSP code, directives and actions take place on the server long before even page load (which is a browser activity).


Its just hard to find this sort of info


That's why I wrote the "secret life" article I linked to earlier. Read it for more detailed info on this topic.
[ August 07, 2006: Message edited by: Bear Bibeault ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic