aspose file tools*
The moose likes Struts and the fly likes Formatting the Errors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Formatting the Errors" Watch "Formatting the Errors" New topic
Author

Formatting the Errors

Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

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..


Never try to be a hard-worker. Be a smart-worker.
My Blog
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

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 .


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

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

Joined: Feb 19, 2008
Posts: 2902
    
    1

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

Joined: May 29, 2008
Posts: 445

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

Joined: Feb 19, 2008
Posts: 2902
    
    1

will you please elaborate the error or exception , may be you can paste it here !
Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Formatting the Errors