|
View:
New views
13 Messages
—
Rating Filter:
Alert me
|
| < Prev | 1 - 2 | Next > |
|
|
Re: dynamic return when validation failedOn Thu, Jul 9, 2009 at 5:26 AM, <mailtolouis2020-struts@...> wrote:
> > Well, if I remove my validation code in the validate() method and put it > into execute() method, then I can easily control which logical name to be > return, but I thought that is not a good way to do that right? > While this might not be a "good way to do that," it's what I would do and in fact have done. -- Jim Kiley Senior Technical Consultant | Summa [p] 412.258.3346 http://www.summa-tech.com |
|
|
<s:actionerrors> not displaying errors!Hi,
I am using Struts 2.0 and I am not able to display the action errors in my JSP. Action class code : if( ( getSelectedlocation() == null ) || getSelectedlocation().compareTo( "" ) == 0 && ( (getLocation() == null ) ||( getLocation().compareTo( "" ) == 0 ))) { mLog.warn( "Location not specified. Added Error message" ); addActionError( "Please specify a Location for the message . " ); } JSP code : <tr> <td align="left" valign="top"><p><s:actionerror id="err" /></p></td> </tr> The error is added successfully as i can see from the logs but it is not getting displayed on the JSP ..any pointers ? Thanks, Kavita *****************************************************DISCLAIMER***************************************************** This message and/or attachment(s) contained here are confidential, proprietary to HUGHES SYSTIQUE and its customers. Contents may be privileged or otherwise protected by law. The information is solely intended for the entity it is addressed to. If you are not the intended recipient of this message, it is strictly prohibited to read, forward, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately and delete the message. ******************************************************************************************************************** |
|
|
Re: <s:actionerrors> not displaying errors!My first guess would be that you are not properly dispatching back to
your input page. A closer look at your struts.xml would clarify this, though. Robert Kavita Mehta schrieb: > Hi, > I am using Struts 2.0 and I am not able to display the action errors in > my JSP. > > Action class code : > > if( ( getSelectedlocation() == null ) || getSelectedlocation().compareTo( > "" ) == 0 > && ( (getLocation() == null ) ||( > getLocation().compareTo( "" ) == 0 ))) > { > mLog.warn( "Location not > specified. Added Error message" ); > addActionError( "Please specify a > Location for the message . " ); > } > > > JSP code : > > <tr> > <td align="left" valign="top"><p><s:actionerror id="err" /></p></td> > </tr> > > > The error is added successfully as i can see from the logs but it is not > getting displayed on the JSP ..any pointers ? > > > Thanks, > Kavita > > > > > > *****************************************************DISCLAIMER***************************************************** > > This message and/or attachment(s) contained here are confidential, proprietary to HUGHES SYSTIQUE and its customers. > Contents may be privileged or otherwise protected by law. The information is solely intended for the entity it is > addressed to. If you are not the intended recipient of this message, it is strictly prohibited to read, forward, > print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, > please notify the sender immediately and delete the message. > > ******************************************************************************************************************** > > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: dynamic return when validation failed>
> > > > > Well, if I remove my validation code in the validate() method and put it > > into execute() method, then I can easily control which logical name to be > > return, but I thought that is not a good way to do that right? > > > > While this might not be a "good way to do that," it's what I would do and > in > fact have done. > -- > Jim Kiley > Senior Technical Consultant | Summa > [p] 412.258.3346 > http://www.summa-tech.com > I occasionally have to do validation in the execute() method but always prefer to do declarative validation with annotations wherever possible since it is so much simpler and cleaner. This means all my actions have to be able to handle an 'input' result. Since 'input' result is the standard for validation errors you should be prepared for it as the next programmer who works on your code may add a validation() method or add validation annotations. @OP: If you know which page# in a wizard sequence to return to and use that page# in the jsp name then you can make that page# available with a getPage() method and do this: <result name="input">/xxx/MyWizardPage${page}.jsp</result> It does mean you would need to have a jsp page naming convention that includes the page#. |
|
|
Re: <s:actionerrors> not displaying errors!Thanks Robert .. Lemme check the same.
Robert Graf-Waczenski <rgw@...> 07/09/2009 06:51 PM Please respond to "Struts Users Mailing List" <user@...> To Struts Users Mailing List <user@...> cc Subject Re: <s:actionerrors> not displaying errors! My first guess would be that you are not properly dispatching back to your input page. A closer look at your struts.xml would clarify this, though. Robert Kavita Mehta schrieb: > Hi, > I am using Struts 2.0 and I am not able to display the action errors in > my JSP. > > Action class code : > > if( ( getSelectedlocation() == null ) || getSelectedlocation().compareTo( > "" ) == 0 > && ( (getLocation() == null ) ||( > getLocation().compareTo( "" ) == 0 ))) > { > mLog.warn( "Location not > specified. Added Error message" ); > addActionError( "Please specify a > Location for the message . " ); > } > > > JSP code : > > <tr> > <td align="left" valign="top"><p><s:actionerror id="err" /></p></td> > </tr> > > > The error is added successfully as i can see from the logs but it is not > getting displayed on the JSP ..any pointers ? > > > Thanks, > Kavita > > > > > > > > This message and/or attachment(s) contained here are confidential, proprietary to HUGHES SYSTIQUE and its customers. > Contents may be privileged or otherwise protected by law. The information is solely intended for the entity it is > addressed to. If you are not the intended recipient of this message, it is strictly prohibited to read, forward, > print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, > please notify the sender immediately and delete the message. > > ******************************************************************************************************************** > > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... *****************************************************DISCLAIMER***************************************************** This message and/or attachment(s) contained here are confidential, proprietary to HUGHES SYSTIQUE and its customers. Contents may be privileged or otherwise protected by law. The information is solely intended for the entity it is addressed to. If you are not the intended recipient of this message, it is strictly prohibited to read, forward, print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, please notify the sender immediately and delete the message. ******************************************************************************************************************** |
|
|
RE: <s:actionerrors> not displaying errors!if you could display the jsp we could see the actual component for the HTML id="err" Martin Gainty ______________________________________________ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > Date: Thu, 9 Jul 2009 15:21:04 +0200 > From: rgw@... > To: user@... > Subject: Re: <s:actionerrors> not displaying errors! > > My first guess would be that you are not properly dispatching back to > your input page. A closer look at your struts.xml would clarify this, > though. > > Robert > > Kavita Mehta schrieb: > > Hi, > > I am using Struts 2.0 and I am not able to display the action errors in > > my JSP. > > > > Action class code : > > > > if( ( getSelectedlocation() == null ) || getSelectedlocation().compareTo( > > "" ) == 0 > > && ( (getLocation() == null ) ||( > > getLocation().compareTo( "" ) == 0 ))) > > { > > mLog.warn( "Location not > > specified. Added Error message" ); > > addActionError( "Please specify a > > Location for the message . " ); > > } > > > > > > JSP code : > > > > <tr> > > <td align="left" valign="top"><p><s:actionerror id="err" /></p></td> > > </tr> > > > > > > The error is added successfully as i can see from the logs but it is not > > getting displayed on the JSP ..any pointers ? > > > > > > Thanks, > > Kavita > > > > > > > > > > > > *****************************************************DISCLAIMER***************************************************** > > > > This message and/or attachment(s) contained here are confidential, proprietary to HUGHES SYSTIQUE and its customers. > > Contents may be privileged or otherwise protected by law. The information is solely intended for the entity it is > > addressed to. If you are not the intended recipient of this message, it is strictly prohibited to read, forward, > > print, retain, copy or disseminate this message or any part of it. If you have received this e-mail in error, > > please notify the sender immediately and delete the message. > > > > ******************************************************************************************************************** > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > _________________________________________________________________ Insert movie times and more without leaving Hotmail®. http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd_062009 |
|
|
Re: dynamic return when validation failed> <result name="input">/xxx/MyWizardPage${page}.jsp</result>
oh yes, this does the trick! Thanks! I just found another problem when using xml based validation. In struts1, there is a page attribute, which can tell the validator to validate certain fields which belong to that page, but this useful feature is not in struts2, is there any replacement for that? ________________________________ From: Greg Lindholm <greg.lindholm@...> To: Struts Users Mailing List <user@...> Sent: Thursday, July 9, 2009 2:32:17 PM Subject: Re: dynamic return when validation failed > > > > > > Well, if I remove my validation code in the validate() method and put it > > into execute() method, then I can easily control which logical name to be > > return, but I thought that is not a good way to do that right? > > > > While this might not be a "good way to do that," it's what I would do and > in > fact have done. > -- > Jim Kiley > Senior Technical Consultant | Summa > [p] 412.258.3346 > http://www.summa-tech.com > I occasionally have to do validation in the execute() method but always prefer to do declarative validation with annotations wherever possible since it is so much simpler and cleaner. This means all my actions have to be able to handle an 'input' result. Since 'input' result is the standard for validation errors you should be prepared for it as the next programmer who works on your code may add a validation() method or add validation annotations. @OP: If you know which page# in a wizard sequence to return to and use that page# in the jsp name then you can make that page# available with a getPage() method and do this: <result name="input">/xxx/MyWizardPage${page}.jsp</result> It does mean you would need to have a jsp page naming convention that includes the page#. |
|
|
RE: dynamic return when validation failedcheck your web.xml to see if your filtering thru SiteMesh e.g. <filter> <filter-name>sitemesh</filter-name> <filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class> </filter> <filter-mapping> <filter-name>sitemesh</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> where com.opensymphony.module.sitemesh.filter.PageFilter contains parsePage method protected com.opensymphony.module.sitemesh.Page parsePage(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { try { PageResponseWrapper pageResponse = new PageResponseWrapper(response, factory); chain.doFilter(request, pageResponse); // check if another servlet or filter put a page object to the request Page result = (Page)request.getAttribute(PAGE); //MG: THIS IS the page you want if (result == null) { // parse the page result = pageResponse.getPage(); } request.setAttribute(USING_STREAM, new Boolean(pageResponse.isUsingStream())); return result; } //once you have the Page you can do page.getTitle() and then //map Title to Page Number //the other way is to modify protected com.opensymphony.module.sitemesh.Page //for accessor and mutator for pageNumber did you ask wes? Martin ______________________________________________ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > Date: Thu, 9 Jul 2009 07:36:58 -0700 > From: mailtolouis2020-struts@... > Subject: Re: dynamic return when validation failed > To: user@... > > > <result name="input">/xxx/MyWizardPage${page}.jsp</result> > > oh yes, this does the trick! Thanks! > > I just found another problem when using xml based validation. In struts1, there is a page attribute, which can tell the validator to validate certain fields which belong to that page, but this useful feature is not in struts2, is there any replacement for that? > > > > > > ________________________________ > From: Greg Lindholm <greg.lindholm@...> > To: Struts Users Mailing List <user@...> > Sent: Thursday, July 9, 2009 2:32:17 PM > Subject: Re: dynamic return when validation failed > > > > > > > > > > > Well, if I remove my validation code in the validate() method and put it > > > into execute() method, then I can easily control which logical name to be > > > return, but I thought that is not a good way to do that right? > > > > > > > While this might not be a "good way to do that," it's what I would do and > > in > > fact have done. > > -- > > Jim Kiley > > Senior Technical Consultant | Summa > > [p] 412.258.3346 > > http://www.summa-tech.com > > > > I occasionally have to do validation in the execute() method but always > prefer to do declarative validation with annotations wherever possible since > it is so much simpler and cleaner. This means all my actions have to be able > to handle an 'input' result. Since 'input' result is the standard for > validation errors you should be prepared for it as the next programmer who > works on your code may add a validation() method or add validation > annotations. > > @OP: If you know which page# in a wizard sequence to return to and use that > page# in the jsp name then you can make that page# available with a > getPage() method and do this: > > <result name="input">/xxx/MyWizardPage${page}.jsp</result> > > It does mean you would need to have a jsp page naming convention that > includes the page#. _________________________________________________________________ Windows Live™ SkyDrive™: Get 25 GB of free online storage. http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_SD_25GB_062009 |
|
|
|
|
|
Re: <s:actionerrors> not displaying errors!taj uddin wrote:
> My guess would be, u must be redirecting the action on success. Why do you only abbreviate the shortest words? Why not just type them out? Are you texting your mailing list messages? Dave --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
RE: <s:actionerrors> not displaying errors!he's afraid someone from the list might yell at him for being "too verbose" Martin ______________________________________________ Verzicht und Vertraulichkeitanmerkung Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. > Date: Sun, 12 Jul 2009 11:16:08 -0400 > From: newton.dave@... > To: user@... > Subject: Re: <s:actionerrors> not displaying errors! > > taj uddin wrote: > > My guess would be, u must be redirecting the action on success. > > Why do you only abbreviate the shortest words? Why not just type them > out? Are you texting your mailing list messages? > > Dave > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > _________________________________________________________________ Hotmail® has ever-growing storage! Don’t worry about storage limits. http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage_062009 |
|
|
Re: <s:actionerrors> not displaying errors!Martin Gainty wrote:
> he's afraid someone from the list might yell at him for being "too verbose" I don't think anybody minds verbose when it's on-topic. Dave --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: <s:actionerrors> not displaying errors!If you want to preserve errors and messages across a redirect you can you
this interceptor: http://glindholm.wordpress.com/2008/07/02/preserving-messages-across-a-redirect-in-struts-2/ On Sun, Jul 12, 2009 at 10:18 AM, taj uddin <tajuddin19@...> wrote: > Hi Kavitha, > > The action error message will not be carried to the JSP page if u r > doing the redirect-action. The Message will be lost. If so, then u have to > store the error message in the session and retrieve it in the redirected > action class. > In case, if u r not doing the redirect-action, then please remove the id > attribute fron the <s:actionerror> tag and try again. > > My guess would be, u must be redirecting the action on success. > > --- On Thu, 7/9/09, Kavita Mehta <Kavita.Mehta@...> wrote: > > > From: Kavita Mehta <Kavita.Mehta@...> > Subject: <s:actionerrors> not displaying errors! > To: "Struts Users Mailing List" <user@...> > Date: Thursday, July 9, 2009, 9:14 AM > > > Hi, > I am using Struts 2.0 and I am not able to display the action errors in > my JSP. > > Action class code : > > if( ( getSelectedlocation() == null ) || getSelectedlocation().compareTo( > "" ) == 0 > && ( (getLocation() == null ) ||( > getLocation().compareTo( "" ) == 0 ))) > { > mLog.warn( "Location not > specified. Added Error message" ); > addActionError( "Please specify a > Location for the message . " ); > } > > > JSP code : > > <tr> > <td align="left" valign="top"><p><s:actionerror id="err" /></p></td> > </tr> > > > The error is added successfully as i can see from the logs but it is not > getting displayed on the JSP ..any pointers ? > > > Thanks, > Kavita > > > > > > > *****************************************************DISCLAIMER***************************************************** > > This message and/or attachment(s) contained here are confidential, > proprietary to HUGHES SYSTIQUE and its customers. > Contents may be privileged or otherwise protected by law. The information > is solely intended for the entity it is > addressed to. If you are not the intended recipient of this message, it is > strictly prohibited to read, forward, > print, retain, copy or disseminate this message or any part of it. If you > have received this e-mail in error, > please notify the sender immediately and delete the message. > > > ******************************************************************************************************************** > > > > > |
| < Prev | 1 - 2 | Next > |
| Free embeddable forum powered by Nabble | Forum Help |