Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Passwords  RSS feed

 
shuzo monsoon
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have created simple forms which enable a user to enter information which is stored into an Access database. However, I run a check to make sure the fields are not empty but is there a way I can check that the password entered (as a string) is actually at least 8 characters long? I'm not sure if there is a way using jsp/java code to test the length of a string and appending it to an integer has not worked.
Any help would be much appreciated!
 
Prakash Dwivedi
Ranch Hand
Posts: 452
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Shuzo,
String password = request.getParameter("PasswordFieldName");
int length = password.length();

shuzo are you new to java?
 
shuzo monsoon
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again, yes I am new to java, just recently I have been using JSP and thanks for the advice but when I enter that code, I encounter this error -

int length = password.length();
<------>
*** Error: The type of this expression, "int", is not a valid reference type in this context.
Should I be using the integer.parseInt method?
 
shuzo monsoon
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ignore my last post! Your code did work! Thanks, but the only problem I've got now is that when the user enters less than 8 characters there is no error message displayed, even though I have coded one in a try-catch loop.
Thanks again for the help!
 
Ivan Tamayo
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSP are Servlets.
Servlets are web related programs written in Java. For that reason, you *should* learn the Java programming language as soon as possible, or you�ll find many troubles in future.
Isn�t that simple as PHP scripting.
 
Prakash Dwivedi
Ranch Hand
Posts: 452
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello shuzo,
the problem which you are facing is of very basic type. to write code in JSP/ Servlet, it is essential to know Core Java. Please see the link below
http://java.sun.com/docs/books/tutorial/index.html
[ February 17, 2004: Message edited by: Prakash Dwivedi ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!