Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Formatting the Errors

 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
I just now decided to migrate from JSP to Struts and i started learning my own. I just use the code in the book and it works perfectly. It just displays some set of text boxes for user Registration and when user click Submit it just tell "Reg successful...".. My question is when i load the page the error message that which i give in ApplicationResource is displayed as default. And when i enter some inputs and leaving some mandatory fields..It just shows that corresponding error message and other vanished. My will is, By default no error message is displayed in <html:errors/> tag...How can i achieve that... I not intend to ask such question but i left with no choice because i am a newbie to Struts... Hope ranchers will help me...

Here is my LoginForm.jsp



Here is my ActionForm.java



And StrutsAction.java



Guide me to the glory..
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My question is when i load the page the error message that which i give in ApplicationResource is displayed as default.


Post your ApplicatioResource.propertise file .

When you first load the page, no error message should be seen.



plus, post struts-config file or action tag of your ActionClass .
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ApplicationResource.properties file:



struts-config.xml




Here is the file that you ask... I do no processing with the form data i just validate them and if all fields are valid then a success page is displayed.. Thanks in advance
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Everything looks fine, may be I`m not able to get your question , fully !

If by default , on login page you are seeing those errors, then one thing must solve this :



make the scope to "request", from previous "session".

Try this,
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
God, When i change it from session to request "Servlet file not available" error is shown in browser... What happens? I use Sun Java App Server.. Help me
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
will you please elaborate the error or exception , may be you can paste it here !
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error was resolved and after changing from session to scope... i won't get the desired output.. By default when the page is loaded the <html:errors> show all the errors.. but i need them to be displayed after validation....
[ July 23, 2008: Message edited by: Rajkumar balakrishnan ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic