struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thom Burnett" <thom.burn...@gmail.com>
Subject Re: Two values on "input" attribute
Date Wed, 08 Nov 2006 18:07:25 GMT
First, I found my error and it's (of course) not in any of the code listed.
I had neglected the import statements in the jsp pages. :-(
So you can ignore this question but it does bring up another one.

Is there a way to get warnings or error messages when I've made a mistake
like this in the jsp?
In my build there was no compiler error or warning. Finding this type of
error by inspection is very time consuming.

On 11/8/06, Thom Burnett <thom.burnett@gmail.com> wrote:
>
> I tried this technique for my situation where several jsp pages contribute
> to one ActionForm.
> I'm getting the correct page selection behavior by my errors don't show
> up.
>
> For the first page (the donation page) everything works very nicely.
> For the second page (the honoree page) there's no trace of an error
> message.
>
> That is, when (and only when) there's an error, the page will not continue
> on to the next page but
> the <html:errors/> tag seems to return no contents - that part of the
> displayed page is blank.
>
> I can't see any meaningful difference between the two pages. Is this a
> question of where the ActionErrors instance is stored?
>
>
>
>
> struts-config
> ...
>     <action path="/donation3"   type="
> com.softrek.donation.DonationAction3"
>             name="donorBean" scope="session"
>             input="/donation3.jsp" validate="true">
>       <forward name="oracleError"  path="/oracleError3.jsp"/>
>       <forward name="success"      path="/thankYou3.jsp"/>
>       <forward name="firstPage"    path="/donation3.jsp"/>
>       <forward name="secondPage"   path="/honoree3.jsp"/>
>       <forward name="thirdPage"    path="/payment3.jsp"/>
>     </action>
>     <action path="/honoree3"   type="com.softrek.donation.DonationAction3"
>             name="donorBean" scope="session"
>             input="/honoree3.jsp"  validate="true">
>       <forward name="oracleError"  path="/oracleError3.jsp"/>
>       <forward name="success"      path="/thankYou3.jsp"/>
>       <forward name="firstPage"    path="/donation3.jsp"/>
>       <forward name="secondPage"   path="/honoree3.jsp"/>
>       <forward name="thirdPage"    path="/payment3.jsp"/>
>     </action>
> ...
>
> donation3.jsp page
>
> ...
> <% AllDonationInformationFormBean3 donorBean =
> (AllDonationInformationFormBean3)session.getAttribute("donorBean") ;
>      if(donorBean == null) donorBean = new
> AllDonationInformationFormBean3() ;
>   %>
>   <body>
>     <center>
>       <h1>New Account Registration</h1>
>     </center>
>     <form action="../donation3/donation3.do" method="post">
>       <input type="hidden" name="pagename" value="donationPage"/>
>       <input type="hidden" name="page" value="1"/>
>       <p style="background-color:rgb(0,255,255); font-size:large;">Donor
> Information</p>
>       <html:errors/><br/>
>       <p>*Indicates required field</p>
> ...
>
> honoree3.jsp page
>
> ...
> <% AllDonationInformationFormBean3 donorBean =
> (AllDonationInformationFormBean3)session.getAttribute("donorBean") ;
>      if(donorBean == null) donorBean = new
> AllDonationInformationFormBean3() ;
>      %>
>
> <html>
>   <head>
>     <meta http-equiv="Content-Type" content="text/html;
> charset=windows-1252">
>     <title>Honor of</title>
>   </head>
>   <body>
>     <center>
>       <h1>In Honor Of</h1>
>     </center>
>     <form action="../donation3/honoree3.do" method="post">
>       <input type="hidden" name="pagename" value="honoreePage"/>
>       <input type="hidden" name="page" value="2"/>
>       <P style="background-color:rgb(0,255,255); font-size:large;">In
> Honor of:</P>
>       <P>*Indicates required field</P>
>       <html:errors/><br/>
> ...
>
>
> On 11/4/06, Christopher Schultz <chris@christopherschultz.net > wrote:
> >
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > Yariel,
> >
> > > I have a page validated with Validation Framework, but I can get that
> > > page from two diferent jsp inputs. When an error ocurs, the validator
> > > always turn me back to the same jsp input (the one especified) not
> > > matter which was the selected input. It is possible to set two values
> > > to "input" attribute in an ActionMapping?? Is there any other way to
> > > do something like that??
> >
> >
> > Generally, this is done with two separate ActionMappings, like this:
> >
> > <!-- submit to here from first.jsp -->
> > <action path="/path1"
> >     type="MyAction"
> >     name="MyFormBean"
> >     validate="true"
> >     scope="request"
> >     input="/first.jsp">
> >   ...
> > </action>
> >
> > <!-- submit to here from second.jsp -->
> > <action path="/path2"
> >     type="MyAction"
> >     name="MyFormBean"
> >     validate="true"
> >     scope="request"
> >     input="/second.jsp">
> >   ...
> > </action>
> >
> > You are doing the exact same thing in both cases, except that the
> > "input" attributes are different. The validation should be the same,
> > using the same form bean, etc.
> >
> > Hope that helps,
> > - -chris
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.5 (MingW32)
> > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> >
> > iD8DBQFFTJOE9CaO5/Lv0PARArvPAJ9/6S//E9jkQFVy/QC2mIGUTMBgAACgr4d2
> > NY36tWCeaj9w/2bBwcBpKKY=
> > =CJAz
> > -----END PGP SIGNATURE-----
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message