Thanks to all. my problem was resolved. thanks a lot.
Regards, On Tue, Aug 12, 2008 at 11:51 AM, Umar Bilal <[EMAIL PROTECTED]> wrote: > > > Hello this is regarding your Bean Validation. Yesterday I only checked > if everything was right meaning that it wont submit the form until you > pass the validation. I didn't realize you wanted the messages to come on > the page anyway do the following > > Add these lines to your ApplicationProperties > > null.checkId = {0} cannot be null or empty > > null.checkPwd ={0} does not pass the validation rules > > And this is your valiadtion Method > > public ActionErrors validate > ( > ActionMapping mapping, > HttpServletRequest request ) > { > > ActionErrors errors = new ActionErrors(); > > if( getUserName().length()<1 ) > { > errors.add("name",new ActionError("null.checkId","UserName")); > } > > if( getPwd().length()<1 ) > { > errors.add("password",new > ActionError("null.checkPwd","Password")); > } > return errors; > } > And write this on your login jsp infront of your fields or anywhere else > where you want to display the message > > <html:errors property="name"/> > <html:password property="pwd" /> > > That will solve your issue > take care > Bye > > -----Original Message----- > From: Richard Yee [mailto:[EMAIL PROTECTED] > Sent: Tuesday, August 12, 2008 7:48 AM > To: Struts Users Mailing List > Subject: Re: not displaying Action errors > > Have you debugged your code with a source level debugger? Are you sure > that the error messages are getting added? > > -R > > Narasimha Raju Naidu wrote: > > thanks for your reply. but itz not working. im getting the same > > output. for reference im sending screen shot of that output please > check once. > > > > > > Regards, > > ------------- > > > > On Sun, Aug 10, 2008 at 9:55 PM, Richard Yee <[EMAIL PROTECTED]> wrote: > > > > > >> You are using == to test string equality instead of equals() -R > >> > >> Sent from my iPhone > >> > >> > >> On Aug 8, 2008, at 11:52 PM, "Narasimha Raju Naidu" > >> <[EMAIL PROTECTED]> > >> wrote: > >> > >> hi to all, > >> > >>> im sending my code please check where i am doing mistake > >>> > >>> form.jsp > >>> --------------- > >>> <%@ taglib uri="/tags/struts-html" prefix="html"%> <html:errors/> > >>> <div style="background-color:#fcc;border: 1px dashed > >>> blue;width:280px;margin:2px;"> <html:form action="/login.do"> <table > > >>> cellpadding=2 align=center > >>> style="font-family:verdana;font-size:15;"> > >>> > >>> <tr><td><b>User Name</b></td> > >>> <td><html:text property="userName"/></td></tr> <tr> > >>> <td><b>Password</b></td> <td><html:password > >>> property="pwd"/></td></tr> <tr><td> <html:submit property="submit" > >>> value="Connect"/></td><td> <html:reset property="reset" > >>> value="Re-Try"/></td></tr> </table> </html:form> </div> > >>> > >>> -------------------------------------------------------------------- > >>> ----- > >>> formbean > >>> --------------------------- > >>> import javax.servlet.http.*; > >>> import org.apache.struts.action.*; > >>> > >>> public class LoginBean extends ActionForm { > >>> private String userName; > >>> private String pwd; > >>> > >>> public void setUserName(String userName) > >>> { > >>> this.userName=userName; > >>> } > >>> public String getUserName() > >>> { > >>> return userName; > >>> } > >>> public void setPwd(String pwd) > >>> { > >>> this.pwd=pwd; > >>> } > >>> public String getPwd() > >>> { > >>> return pwd; > >>> } > >>> > >>> public void reset(ActionMapping mapping,HttpServletRequest > request) > >>> { > >>> System.out.println("--reset LoginForm--"); > >>> this.userName=""; > >>> this.pwd=""; > >>> } > >>> > >>> public ActionErrors validate(ActionMapping > >>> mapping,HttpServletRequest > >>> request) > >>> { > >>> ActionErrors aes=new ActionErrors(); > >>> if(userName==null||userName=="") > >>> { > >>> aes.add("userName",new ActionError("UserName is Required")); > >>> } > >>> if(pwd==null||pwd=="") > >>> { > >>> aes.add("pwd",new ActionError("Password is Required")); > >>> } > >>> return aes; > >>> } > >>> } > >>> > >>> -------------------------------------------------------------- > >>> action class > >>> ---------------------- > >>> > >>> import javax.servlet.http.*; > >>> import org.apache.struts.action.*; > >>> > >>> > >>> public class LoginAction extends Action { > >>> public ActionForward execute(ActionMapping mapping,ActionForm > >>> form,HttpServletRequest request,HttpServletResponse response) throws > > >>> Exception > >>> { > >>> LoginBean login= (LoginBean)form; > >>> return mapping.findForward("succ"); > >>> } > >>> } > >>> > >>> ------------------------------------------------------------------- > >>> struts-config.xml code > >>> ------------------------------ > >>> <form-beans> > >>> <form-bean name="LBBean" type="LoginBean"/> </form-beans> > >>> > >>> > >>> <action path="/login" type="LoginAction" name="LBBean" > scope="request" > >>> input="/pages/login.jsp" validate="true"> > >>> <forward name="succ" path="/pages/succ.jsp"/> > >>> </action> > >>> > >>> > >>> while compiling im not getting any errors while running if i did not > give > >>> any input i am getting bullet not the exact error what i gave. > waiting for > >>> you people's valuable replys. > >>> > >>> Regards, > >>> > >>> Narasimha Raju > >>> > >>> > >>> > >>> > >>> uni... > >>> > >>> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > >> > > > > > > > > uni... > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- uni...