Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ActionError Problem

 
Swathi Prakash
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

i want to display error when user type invalid user name and password,i want to display that user name is invalid. i want to write the ActionError in Action class.
i write the below coding. it doesnt work.pls help me


rs=stmt.executeQuery("select * from login where name=\""+name1+"\" and pwd=\""+password1+"\"");
if(rs.next())
{
target="success";
HttpSession sess=request.getSession();
}
else{

target="login";
ActionErrors errors = new ActionErrors();
errors.add(ActionErrors.GLOBAL_ERROR,new ActionError("errors.login.required"));
saveErrors(request, errors);
}


i Included that in Propert file also .
please help me to find the solution.

Thanks in Advance


Swathi
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have <html:errors/> on your jsp to display errors?
 
Swathi Prakash
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya,i included the tag<html:errors/> also. but i didnt get
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you 100% positive that the else block is entered?
 
Swathi Prakash
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes.it is entering into the else block and the target also going to that page which i specified.Also i check with my property file also.

the errors r not diplayed in my tasrget page. what is the problem?plz help me....

 
Swathi Prakash
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes . i made a mistake in my proprty file.i got it.

thank you mr.Marc Peabody

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic