struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Gainty" <mgai...@hotmail.com>
Subject Re: Two values on "input" attribute
Date Wed, 08 Nov 2006 20:16:07 GMT
The simplest way to show the error in browser is to capture the OutputStream for the Response
Object and stream the exception code,/desc/whatever back to the user as in this example-

response.getOutputStream().out("Exception text is "+excp.getMessage());
if you want to dress it up you can use css stylesheets/fonts/colors etc

Anyone else?
M-
This e-mail communication and any attachments may contain confidential and privileged information
for the use of the 
designated recipients named above. If you are not the intended recipient, you are hereby notified
that you have received
this communication in error and that any review, disclosure, dissemination, distribution or
copying of it or its 
contents
----- Original Message ----- 
From: "Thom Burnett" <thom.burnett@gmail.com>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Wednesday, November 08, 2006 1:07 PM
Subject: Re: Two values on "input" attribute


> 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
View raw message