Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2005

Tip: Looking for answers? Try searching our database.

Struts validation- placing error msgs

Thread view: 
spb - 12 Dec 2005 03:55 GMT
hi,
i have a login form and i need to validate all the fields are required
as well as the email is a valid email. when i use the following code on
top it prints out the required error messages for all the fields but i
want it to print it out only once.
<logic:messagesPresent>
 <div class="errorblock">
   <html:errors />
 </div>
</logic:messagesPresent>

i can do this by commenting out the <html:errors /> but then my global
error for email/user does not exist does not display.

please tell me how i can work around this. i am new to it and need to
get this working asap. apreciate any help.

thanks.
Tim B - 12 Dec 2005 04:32 GMT
> hi,
> i have a login form and i need to validate all the fields are required
[quoted text clipped - 14 lines]
>
> thanks.

I'm not sure exactly what you want, but I'm guessing you want to show only a
specific error message. It can be done like this:

<logic:messagesPresent>
 <html:messages id="theError" property="myErrorName">
   <bean:write name="theError"/>
 </html:messages>
</logic:messagesPresent>

"myErrorName" is the name you save the error with, in your validation code
Hiran Chaudhuri - 12 Dec 2005 22:57 GMT
> i have a login form and i need to validate all the fields are required
> as well as the email is a valid email. when i use the following code on
> top it prints out the required error messages for all the fields but i
> want it to print it out only once.

I'm not sure what you want. Do you want to see the messages generated by the
validation (i.e. the error messages) or do you not want to see them?

Taking a guess, your problem with email validation should be on the
validation side, which means either the validation framework (configured
with the struts xml configuration) or the action that validates before
calling the business logic. What you mention is just how the messages are
displayed.

Well then, that is what your subject line also says.....

Hiran


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.