RE: Problem with html:errors tag
Hi, Are you getting any errors/stack traces from your web container? Jon. -Original Message- From: BinhMinh Nguyen [mailto:[EMAIL PROTECTED]] Sent: 30 November 2001 00:36 To: Struts Users Mailing List Subject: Problem with html:errors tag For some reasons, this html:errors is no longer working for me :( can some one help me out? In the web.xml, I added this !--the application resources -- init-param param-nameapplication/param-name param-valueApplicationResources/param-value /init-param In the struts-config.xml, I added this: action-mappings !-- Retailer-Main -- action path=/forgetpassword type=com.fnet.struts.login.ForgetPasswordAction name=forgetPasswordForm input=/login.jsp scope=request validate=true /action /action-mappings in the ACtionForm bean my validate method work fine: public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { FNPrinter.toScreen(ForgetPasswordForm-validate(): validating User-info ...); ActionErrors errors = new ActionErrors(); if ((userId == null) || (userId.length() 1)) { FNPrinter.toScreen(ForgetPasswordForm-invalid UserId: + userId); errors.add(errInvalidUserId, new ActionError(error.login.forgetpw.userid.invalid)); } if ((userEmail == null) || (userEmail.length() 1)) { FNPrinter.toScreen(ForgetPasswordForm-invalid UserEmail: + userEmail); errors.add(errInvalidUserEmail, new ActionError(error.login.forgetpw.useremail.invalid)); } FNPrinter.toScreen(Error-Log: + errors.size()); return errors; } and the jsp page , I tried to display the error like this: tr td colspan=1nbsp;/td td align=leftUser_Name:nbsp;nbsp;/td td align=left colspan=1 html:text property=userId size=20 / nbsp;nbsp; html:errors property=errInvalidUserId / /td /tr my Application resources also has the property for this key... it still does not work for me, CAn someone help me on this. thanks Binh __ Do You Yahoo!? Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. http://geocities.yahoo.com/ps/info1 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Problem with html:errors tag - still not working
Ted, thanks for reply, I did what you suggested, but it still does not work, I also double check the tld import statement. Do you have any idea why? thanks Binh --- Ted Husted [EMAIL PROTECTED] wrote: Double check that the taglib is imported at the top of the JSP. You can also set init-param param-namenull/param-name param-valuefalse/param-value /init-param in the web.xml so that it will report any missing message keys. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/struts/ BinhMinh Nguyen wrote: For some reasons, this html:errors is no longer working for me :( can some one help me out? In the web.xml, I added this !--the application resources -- init-param param-nameapplication/param-name param-valueApplicationResources/param-value /init-param In the struts-config.xml, I added this: action-mappings !-- Retailer-Main -- action path=/forgetpassword type=com.fnet.struts.login.ForgetPasswordAction name=forgetPasswordForm input=/login.jsp scope=request validate=true /action /action-mappings in the ACtionForm bean my validate method work fine: public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { FNPrinter.toScreen(ForgetPasswordForm-validate(): validating User-info ...); ActionErrors errors = new ActionErrors(); if ((userId == null) || (userId.length() 1)) { FNPrinter.toScreen(ForgetPasswordForm-invalid UserId: + userId); errors.add(errInvalidUserId, new ActionError(error.login.forgetpw.userid.invalid)); } if ((userEmail == null) || (userEmail.length() 1)) { FNPrinter.toScreen(ForgetPasswordForm-invalid UserEmail: + userEmail); errors.add(errInvalidUserEmail, new ActionError(error.login.forgetpw.useremail.invalid)); } FNPrinter.toScreen(Error-Log: + errors.size()); return errors; } and the jsp page , I tried to display the error like this: tr td colspan=1nbsp;/td td align=leftUser_Name:nbsp;nbsp;/td td align=left colspan=1 html:text property=userId size=20 / nbsp;nbsp; html:errors property=errInvalidUserId / /td /tr my Application resources also has the property for this key... it still does not work for me, CAn someone help me on this. thanks Binh __ Do You Yahoo!? Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. http://geocities.yahoo.com/ps/info1 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] u can also set init-param param-namenull/param-name param-valuefalse/param-value /init-param in the web.xml, so it will report any missing messages. BinhMinh Nguyen wrote: For some reasons, this html:errors is no longer working for me :( can some one help me out? In the web.xml, I added this !--the application resources -- init-param param-nameapplication/param-name param-valueApplicationResources/param-value /init-param In the struts-config.xml, I added this: action-mappings !-- Retailer-Main -- action path=/forgetpassword type=com.fnet.struts.login.ForgetPasswordAction name=forgetPasswordForm input=/login.jsp scope=request validate=true /action /action-mappings in the ACtionForm bean my validate method work fine: public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { FNPrinter.toScreen(ForgetPasswordForm-validate(): validating User-info ...); ActionErrors errors = new ActionErrors(); if ((userId == null) || (userId.length() 1)) { FNPrinter.toScreen(ForgetPasswordForm-invalid UserId: + userId); errors.add(errInvalidUserId, new ActionError(error.login.forgetpw.userid.invalid)); } if ((userEmail == null) || (userEmail.length() 1)) { FNPrinter.toScreen(ForgetPasswordForm-invalid UserEmail: + userEmail); errors.add(errInvalidUserEmail, new ActionError(error.login.forgetpw.useremail.invalid)); === message truncated === __ Do You Yahoo!? Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. http://geocities.yahoo.com/ps/info1 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Problem with html:errors tag - still not working
-Original Message- From: BinhMinh Nguyen [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 29, 2001 5:42 PM To: Struts Users Mailing List Subject: Re: Problem with html:errors tag - still not working Ted, thanks for reply, I did what you suggested, but it still does not work, I also double check the tld import statement. Do you have any idea why? thanks Binh --- Ted Husted [EMAIL PROTECTED] wrote: Double check that the taglib is imported at the top of the JSP. You can also set init-param param-namenull/param-name param-valuefalse/param-value /init-param in the web.xml so that it will report any missing message keys. -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel +1 716 737-3463 -- http://www.husted.com/struts/ BinhMinh Nguyen wrote: For some reasons, this html:errors is no longer working for me :( can some one help me out? In the web.xml, I added this !--the application resources -- init-param param-nameapplication/param-name param-valueApplicationResources/param-value /init-param In the struts-config.xml, I added this: action-mappings !-- Retailer-Main -- action path=/forgetpassword type=com.fnet.struts.login.ForgetPasswordAction name=forgetPasswordForm input=/login.jsp scope=request validate=true /action /action-mappings in the ACtionForm bean my validate method work fine: public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { FNPrinter.toScreen(ForgetPasswordForm-validate(): validating User-info ...); ActionErrors errors = new ActionErrors(); if ((userId == null) || (userId.length() 1)) { FNPrinter.toScreen(ForgetPasswordForm-invalid UserId: + userId); errors.add(errInvalidUserId, new ActionError(error.login.forgetpw.userid.invalid)); } if ((userEmail == null) || (userEmail.length() 1)) { FNPrinter.toScreen(ForgetPasswordForm-invalid UserEmail: + userEmail); errors.add(errInvalidUserEmail, new ActionError(error.login.forgetpw.useremail.invalid)); } FNPrinter.toScreen(Error-Log: + errors.size()); return errors; } and the jsp page , I tried to display the error like this: tr td colspan=1nbsp;/td td align=leftUser_Name:nbsp;nbsp;/td td align=left colspan=1 html:text property=userId size=20 / nbsp;nbsp; html:errors property=errInvalidUserId / /td /tr my Application resources also has the property for this key... it still does not work for me, CAn someone help me on this. thanks Binh __ Do You Yahoo!? Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. http://geocities.yahoo.com/ps/info1 -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] u can also set init-param param-namenull/param-name param-valuefalse/param-value /init-param in the web.xml, so it will report any missing messages. BinhMinh Nguyen wrote: For some reasons, this html:errors is no longer working for me :( can some one help me out? In the web.xml, I added this !--the application resources -- init-param param-nameapplication/param-name param-valueApplicationResources/param-value /init-param In the struts-config.xml, I added this: action-mappings !-- Retailer-Main -- action path=/forgetpassword type=com.fnet.struts.login.ForgetPasswordAction name=forgetPasswordForm input=/login.jsp scope=request validate=true /action /action-mappings in the ACtionForm bean my validate method work fine: public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { FNPrinter.toScreen(ForgetPasswordForm-validate(): validating User-info ...); ActionErrors errors = new ActionErrors(); if ((userId == null) || (userId.length() 1)) { FNPrinter.toScreen(ForgetPasswordForm-invalid UserId: + userId); errors.add(errInvalidUserId, new ActionError(error.login.forgetpw.userid.invalid)); } if ((userEmail == null) || (userEmail.length() 1)) { FNPrinter.toScreen(ForgetPasswordForm-invalid UserEmail: + userEmail); errors.add
problem with html:errors tag
When I get errors with my form validation, I cannot seem to place them where I want them. I have tried html:errors / and html:errors property=firstName/ 1) In both cases (and even when there is no errors tag at all), I get all of the errors at the top of my page... any ideas why? 2) Once I get errors, I then have a page with no javascript on it - in which case the user can then just type garbage, which I want to check on the client side. How do I get around this one? I've seen posts that use the errors.header/footer to include some clever javascript - is this the only way? Thanks Marcos
Re: problem with html:errors tag
1. You need to put the html:errors property=whatever/ where you want them to appear. If you have several input fields, put a html:errors property=whatever/ next to each input field. The header and footer are for formatting but they are optional. Rob Breeds Scriven, Marcos To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Marcos.Scrive cc: [EMAIL PROTECTED]Subject: problem with html:errors tag 23/10/2001 11:48 Please respond to struts-user When I get errors with my form validation, I cannot seem to place them where I want them. I have tried html:errors / and html:errors property=firstName/ 1) In both cases (and even when there is no errors tag at all), I get all of the errors at the top of my page... any ideas why? 2) Once I get errors, I then have a page with no javascript on it - in which case the user can then just type garbage, which I want to check on the client side. How do I get around this one? I've seen posts that use the errors.header/footer to include some clever javascript - is this the only way? Thanks Marcos
RE: problem with html:errors tag
Thanks - but that's exactly what I did! I have two text boxes, firstName and lastName I triple checked the property names and capitalisation, and I still get all the errors. Also, I would have thought that not including any error tag would mean no errors would be displayed. Marcos -Original Message- From: Rob Breeds [mailto:[EMAIL PROTECTED]] Sent: 23 October 2001 12:07 To: [EMAIL PROTECTED] Subject: Re: problem with html:errors tag 1. You need to put the html:errors property=whatever/ where you want them to appear. If you have several input fields, put a html:errors property=whatever/ next to each input field. The header and footer are for formatting but they are optional. Rob Breeds Scriven, Marcos To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Marcos.Scrive cc: [EMAIL PROTECTED]Subject: problem with html:errors tag 23/10/2001 11:48 Please respond to struts-user When I get errors with my form validation, I cannot seem to place them where I want them. I have tried html:errors / and html:errors property=firstName/ 1) In both cases (and even when there is no errors tag at all), I get all of the errors at the top of my page... any ideas why? 2) Once I get errors, I then have a page with no javascript on it - in which case the user can then just type garbage, which I want to check on the client side. How do I get around this one? I've seen posts that use the errors.header/footer to include some clever javascript - is this the only way? Thanks Marcos
RE: problem with html:errors tag
you still get error messages even without the html:errors/ tag? Sounds like a restart web app required? in the ActionForm validation() method, how do you populate Errors? Rob Scriven, Marcos To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Marcos.Scrive cc: [EMAIL PROTECTED]Subject: RE: problem with html:errors tag 23/10/2001 12:18 Please respond to struts-user Thanks - but that's exactly what I did! I have two text boxes, firstName and lastName I triple checked the property names and capitalisation, and I still get all the errors. Also, I would have thought that not including any error tag would mean no errors would be displayed. Marcos -Original Message- From: Rob Breeds [mailto:[EMAIL PROTECTED]] Sent: 23 October 2001 12:07 To: [EMAIL PROTECTED] Subject: Re: problem with html:errors tag 1. You need to put the html:errors property=whatever/ where you want them to appear. If you have several input fields, put a html:errors property=whatever/ next to each input field. The header and footer are for formatting but they are optional. Rob Breeds Scriven, Marcos To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Marcos.Scrive cc: [EMAIL PROTECTED]Subject: problem with html:errors tag 23/10/2001 11:48 Please respond to struts-user When I get errors with my form validation, I cannot seem to place them where I want them. I have tried html:errors / and html:errors property=firstName/ 1) In both cases (and even when there is no errors tag at all), I get all of the errors at the top of my page... any ideas why? 2) Once I get errors, I then have a page with no javascript on it - in which case the user can then just type garbage, which I want to check on the client side. How do I get around this one? I've seen posts that use the errors.header/footer to include some clever javascript - is this the only way? Thanks Marcos
RE: problem with html:errors tag
Hi Rob Here is my validate method (from the ActionForm bean): public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { log.debug(Validating form); ActionErrors errors = new ActionErrors(); if ((_firstName == null) || (_firstName.length() 1)) { errors.add(firstName, new ActionError(error.firstname.required)); } if ((_lastName == null) || (_lastName.length() 1)) { errors.add(lastName, new ActionError(error.lastname.required)); } return errors; } The problem occurs regardless of whether or not I restart the web server. Here is my entire JSP: %@ page language=java % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % script src=date.js/script script src=strings.js/script script src=validation.js/script html:html locale=true head titleAdd Sales Person/title html:base/ link rel=stylesheet href=/stylesheets/gs1.css type=text/css /head body bgcolor=#003399 text=#FF html:form action=/sourcefiles/dealinfo/addSalesPerson focus=firstName table border=0 width=100% tr td align=right class=text8lilac First Name /td td align=left html:text styleClass=form2 property=firstName size=16 maxlength=16 onBlur=javascript:validateName(this);/ html:errors property=firstName/ /td /tr tr td align=right class=text8lilac Last Name /td td align=left html:text styleClass=form2 property=lastName size=16 maxlength=16 onBlur=javascript:validateName(this);/ html:errors property=lastName/ /td /tr tr td align=right html:submit styleClass=form1 property=submit value=Submit/ /td td align=left html:reset styleClass=form1/ /td /tr /table /html:form /body /html:html Any help gratefully received! Marcos -Original Message- From: Rob Breeds [mailto:[EMAIL PROTECTED]] Sent: 23 October 2001 12:46 To: [EMAIL PROTECTED] Subject: RE: problem with html:errors tag you still get error messages even without the html:errors/ tag? Sounds like a restart web app required? in the ActionForm validation() method, how do you populate Errors? Rob Scriven, Marcos To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Marcos.Scrive cc: [EMAIL PROTECTED]Subject: RE: problem with html:errors tag 23/10/2001 12:18 Please respond to struts-user Thanks - but that's exactly what I did! I have two text boxes, firstName and lastName I triple checked the property names and capitalisation, and I still get all the errors. Also, I would have thought that not including any error tag would mean no errors would be displayed. Marcos -Original Message- From: Rob Breeds [mailto:[EMAIL PROTECTED]] Sent: 23 October 2001 12:07 To: [EMAIL PROTECTED] Subject: Re: problem with html:errors tag 1. You need to put the html:errors property=whatever/ where you want them to appear. If you have several input fields, put a html:errors property=whatever/ next to each input field. The header and footer are for formatting but they are optional. Rob Breeds Scriven, Marcos To: '[EMAIL PROTECTED]' [EMAIL PROTECTED
RE: problem with html:errors tag
looks OK to me. Do the variables _firstName and _lastName get populated by setFirstName() and setLastName()? Other than that I'm afraid I've no idea - I'm still writing my first struts app! Rob Scriven, Marcos To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Marcos.Scrive cc: [EMAIL PROTECTED]Subject: RE: problem with html:errors tag 23/10/2001 13:26 Please respond to struts-user Hi Rob Here is my validate method (from the ActionForm bean): public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { log.debug(Validating form); ActionErrors errors = new ActionErrors(); if ((_firstName == null) || (_firstName.length() 1)) { errors.add(firstName, new ActionError(error.firstname.required)); } if ((_lastName == null) || (_lastName.length() 1)) { errors.add(lastName, new ActionError(error.lastname.required)); } return errors; } The problem occurs regardless of whether or not I restart the web server. Here is my entire JSP: %@ page language=java % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % script src=date.js/script script src=strings.js/script script src=validation.js/script html:html locale=true head titleAdd Sales Person/title html:base/ link rel=stylesheet href=/stylesheets/gs1.css type=text/css /head body bgcolor=#003399 text=#FF html:form action=/sourcefiles/dealinfo/addSalesPerson focus=firstName table border=0 width=100% tr td align=right class=text8lilac First Name /td td align=left html:text styleClass=form2 property=firstName size=16 maxlength=16 onBlur=javascript:validateName(this);/ html:errors property=firstName/ /td /tr tr td align=right class=text8lilac Last Name /td td align=left html:text styleClass=form2 property=lastName size=16 maxlength=16 onBlur=javascript:validateName(this);/ html:errors property=lastName/ /td /tr tr td align=right html:submit styleClass=form1 property=submit value=Submit/ /td td align=left html:reset styleClass=form1/ /td /tr /table /html:form /body /html:html Any help gratefully received! Marcos -Original Message- From: Rob Breeds [mailto:[EMAIL PROTECTED]] Sent: 23 October 2001 12:46 To: [EMAIL PROTECTED] Subject: RE: problem with html:errors tag you still get error messages even without the html:errors/ tag? Sounds like a restart web app required? in the ActionForm validation() method, how do you populate Errors? Rob Scriven, Marcos To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Marcos.Scrive cc: [EMAIL PROTECTED]Subject: RE: problem with html:errors tag 23/10/2001 12:18 Please respond to struts-user Thanks - but that's exactly what I did! I have two text boxes, firstName and lastName I triple checked the property names and capitalisation, and I still get all the errors. Also, I would have thought that not including any error tag would mean no errors would be displayed. Marcos -Original Message- From: Rob Breeds [mailto:[EMAIL PROTECTED]] Sent