You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Aaron Oathout <aa...@codejunkies.org> on 2002/09/01 00:10:04 UTC

Re: want to have errors to be dispalyed in diffrent page

No problem, in struts-config.xml you should have an action defined like the 
following (different values of course):

<action path="/logon"
        type="org.ifmc.struts.action.AuthenticationAction"
        name="logonForm"
        scope="request"
        validate="true"
        input="template.logon.layout"
        parameter="process">
    <forward name="continue" path="/showPortal.do" redirect="true" />     
</action>

The "input" attribute is used by the action when validation fails. Instead 
of having it point to "login.jsp" in your case, have it point to 
"errorpage.jsp". In errorpage.jsp, put something like the following where 
you want the errors displayed (this is assuming struts 1.1x, can't 
remember syntax for 1.0, but there is something similar):

<logic:messagesPresent>
    <bean:message key="errors.header"/>
    <ul>
       <html:messages id="error">
           <li><bean:write name="error"/></li>
       </html:messages>
    </ul>
</logic:messagesPresent>

Hopefully this helps. Maybe this link will help clear it up also ( take a 
look at section 3.3.4 ). 
http://jakarta.apache.org/struts/doc-1.0.2/userGuide/building_view.html

Aaron


On Thu, 29 Aug 2002, Jenny wrote:

> Aaron:
> 
> Thank you for your reply. But I am not sure I get what you mean. You said
> "change the "input" attribute for your action to point to the page you want
> your errors displayed on.". In my login.jsp page, I have:
> ...
> <html:text property="userName" />
> ...
> <html:password property="password"/>
> ..
> 
> How can change the "input" attribute to point to my errorpage.jsp. What do
> you mean by "input attribute"? Could you explain in a little bit detail?
> 
> Thank you very much
> 
> Jenny
> 
> ----- Original Message -----
> From: "Aaron Oathout" <aa...@codejunkies.org>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Saturday, August 31, 2002 5:26 PM
> Subject: Re: want to have errors to be dispalyed in diffrent page
> 
> 
> > Just a guess as I haven't tried this, but it would seem to me you could
> > change the "input" attribute for your action to point to the page you want
> > your errors displayed on. Anybody thats tried this care to confirm or
> > correct my assumption?
> >
> > Aaron
> >
> > On Thu, 29 Aug 2002, Jenny wrote:
> >
> > > Dear friends:
> > >
> > > I am using struts to develope web application. I use <html:errors/> in
> > > login.jsp, and I implemented validate(..) method in LoginActionForm
> class.
> > > If user enter invalid username or password in login page(login.jsp), I
> want
> > > the errors to be displayed in another page(errorpage.jsp), other than in
> > > login page. Is there a way to fulfill this? Your help is appreciated.
> > >
> > > Thanks,
> > >
> > > Jenny
> > >
> > > ______________________________________________________________________
> > > Post your ad for free now! http://personals.yahoo.ca
> > >
> > > --
> > > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> ______________________________________________________________________ 
> Post your ad for free now! http://personals.yahoo.ca
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: To Aaron: Re: want to have errors to be displayed in different page

Posted by Aaron Oathout <aa...@codejunkies.org>.
Hi Jenny,

The html:messages tag by default will iterate over the ActionErrors 
stored in request scope under key org.apache.struts.action.ERROR.
The value of the id attribute is just the name you want the tag to expose 
each individual ActionError/Message under. The docs do a better job of 
explaining this than I can. Here's a link to the piece you want to look 
at. http://jakarta.apache.org/struts/struts-html.html#messages
If that still doesn't clear it up take a look at the source for 
MessagesTag. The doAfterBody() method is were the value of the id 
attribute is used.

Aaron



On Fri, 30 Aug 2002, Jenny wrote:

>  Thank you, Aaron. The explaination is in very detail. But I still not clear
> about one thing. In the following part of your code:
> 
>  <ul>
>      <html:messages id="error">
>            <li><bean:write name="error"/></li>
>          </html:messages>
>      </ul>
> 
>  you use id="error". Where  should define "error"? I tried to clear it by
> myself, but it seems not easy  for me to find answer by myself. Please give
> me a hint.
> 
>  Thank you so much
> regards
> 
>  Jenny
> 
> > >
> >
> > ----- Original Message -----
> > From: "Aaron Oathout" <aa...@codejunkies.org>
> > To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> > Sent: Saturday, August 31, 2002 6:10 PM
> > Subject: Re: want to have errors to be dispalyed in diffrent page
> >
> >
> > > No problem, in struts-config.xml you should have an action defined like
> > the
> > > following (different values of course):
> > >
> > > <action path="/logon"
> > >         type="org.ifmc.struts.action.AuthenticationAction"
> > >         name="logonForm"
> > >         scope="request"
> > >         validate="true"
> > >         input="template.logon.layout"
> > >         parameter="process">
> > >     <forward name="continue" path="/showPortal.do" redirect="true" />
> > > </action>
> > >
> > > The "input" attribute is used by the action when validation fails.
> Instead
> > > of having it point to "login.jsp" in your case, have it point to
> > > "errorpage.jsp". In errorpage.jsp, put something like the following
> where
> > > you want the errors displayed (this is assuming struts 1.1x, can't
> > > remember syntax for 1.0, but there is something similar):
> > >
> > > <logic:messagesPresent>
> > >     <bean:message key="errors.header"/>
> > >     <ul>
> > >        <html:messages id="error">
> > >            <li><bean:write name="error"/></li>
> > >        </html:messages>
> > >     </ul>
> > > </logic:messagesPresent>
> > >
> > > Hopefully this helps. Maybe this link will help clear it up also ( take
> a
> > > look at section 3.3.4 ).
> > > http://jakarta.apache.org/struts/doc-1.0.2/userGuide/building_view.html
> > >
> > > Aaron
> > >
> > >
> > > On Thu, 29 Aug 2002, Jenny wrote:
> > >
> > > > Aaron:
> > > >
> > > > Thank you for your reply. But I am not sure I get what you mean. You
> > said
> > > > "change the "input" attribute for your action to point to the page you
> > want
> > > > your errors displayed on.". In my login.jsp page, I have:
> > > > ...
> > > > <html:text property="userName" />
> > > > ...
> > > > <html:password property="password"/>
> > > > ..
> > > >
> > > > How can change the "input" attribute to point to my errorpage.jsp.
> What
> > do
> > > > you mean by "input attribute"? Could you explain in a little bit
> detail?
> > > >
> > > > Thank you very much
> > > >
> > > > Jenny
> > > >
> > > > ----- Original Message -----
> > > > From: "Aaron Oathout" <aa...@codejunkies.org>
> > > > To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> > > > Sent: Saturday, August 31, 2002 5:26 PM
> > > > Subject: Re: want to have errors to be dispalyed in diffrent page
> > > >
> > > >
> > > > > Just a guess as I haven't tried this, but it would seem to me you
> > could
> > > > > change the "input" attribute for your action to point to the page
> you
> > want
> > > > > your errors displayed on. Anybody thats tried this care to confirm
> or
> > > > > correct my assumption?
> > > > >
> > > > > Aaron
> > > > >
> > > > > On Thu, 29 Aug 2002, Jenny wrote:
> > > > >
> > > > > > Dear friends:
> > > > > >
> > > > > > I am using struts to develope web application. I use
> <html:errors/>
> > in
> > > > > > login.jsp, and I implemented validate(..) method in
> LoginActionForm
> > > > class.
> > > > > > If user enter invalid username or password in login
> page(login.jsp),
> > I
> > > > want
> > > > > > the errors to be displayed in another page(errorpage.jsp), other
> > than in
> > > > > > login page. Is there a way to fulfill this? Your help is
> > appreciated.
> > > > > >
> > > > > > Thanks,
> > > > > >
> > > > > > Jenny
> > > > > >
> > > > > >
> > ______________________________________________________________________
> > > > > > Post your ad for free now! http://personals.yahoo.ca
> > > > > >
> > > > > > --
> > > > > > To unsubscribe, e-mail:
> > > > <ma...@jakarta.apache.org>
> > > > > > For additional commands, e-mail:
> > > > <ma...@jakarta.apache.org>
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > To unsubscribe, e-mail:
> > > > <ma...@jakarta.apache.org>
> > > > > For additional commands, e-mail:
> > > > <ma...@jakarta.apache.org>
> > > >
> > > > ______________________________________________________________________
> > > > Post your ad for free now! http://personals.yahoo.ca
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > > > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> > > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> > ______________________________________________________________________
> > Post your free ad now! http://personals.yahoo.ca
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> ______________________________________________________________________ 
> Post your ad for free now! http://personals.yahoo.ca
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


To Aaron: Re: want to have errors to be displayed in different page

Posted by Jenny <J_...@yahoo.ca>.
 Thank you, Aaron. The explaination is in very detail. But I still not clear
about one thing. In the following part of your code:

 <ul>
     <html:messages id="error">
           <li><bean:write name="error"/></li>
         </html:messages>
     </ul>

 you use id="error". Where  should define "error"? I tried to clear it by
myself, but it seems not easy  for me to find answer by myself. Please give
me a hint.

 Thank you so much
regards

 Jenny

> >
>
> ----- Original Message -----
> From: "Aaron Oathout" <aa...@codejunkies.org>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Saturday, August 31, 2002 6:10 PM
> Subject: Re: want to have errors to be dispalyed in diffrent page
>
>
> > No problem, in struts-config.xml you should have an action defined like
> the
> > following (different values of course):
> >
> > <action path="/logon"
> >         type="org.ifmc.struts.action.AuthenticationAction"
> >         name="logonForm"
> >         scope="request"
> >         validate="true"
> >         input="template.logon.layout"
> >         parameter="process">
> >     <forward name="continue" path="/showPortal.do" redirect="true" />
> > </action>
> >
> > The "input" attribute is used by the action when validation fails.
Instead
> > of having it point to "login.jsp" in your case, have it point to
> > "errorpage.jsp". In errorpage.jsp, put something like the following
where
> > you want the errors displayed (this is assuming struts 1.1x, can't
> > remember syntax for 1.0, but there is something similar):
> >
> > <logic:messagesPresent>
> >     <bean:message key="errors.header"/>
> >     <ul>
> >        <html:messages id="error">
> >            <li><bean:write name="error"/></li>
> >        </html:messages>
> >     </ul>
> > </logic:messagesPresent>
> >
> > Hopefully this helps. Maybe this link will help clear it up also ( take
a
> > look at section 3.3.4 ).
> > http://jakarta.apache.org/struts/doc-1.0.2/userGuide/building_view.html
> >
> > Aaron
> >
> >
> > On Thu, 29 Aug 2002, Jenny wrote:
> >
> > > Aaron:
> > >
> > > Thank you for your reply. But I am not sure I get what you mean. You
> said
> > > "change the "input" attribute for your action to point to the page you
> want
> > > your errors displayed on.". In my login.jsp page, I have:
> > > ...
> > > <html:text property="userName" />
> > > ...
> > > <html:password property="password"/>
> > > ..
> > >
> > > How can change the "input" attribute to point to my errorpage.jsp.
What
> do
> > > you mean by "input attribute"? Could you explain in a little bit
detail?
> > >
> > > Thank you very much
> > >
> > > Jenny
> > >
> > > ----- Original Message -----
> > > From: "Aaron Oathout" <aa...@codejunkies.org>
> > > To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> > > Sent: Saturday, August 31, 2002 5:26 PM
> > > Subject: Re: want to have errors to be dispalyed in diffrent page
> > >
> > >
> > > > Just a guess as I haven't tried this, but it would seem to me you
> could
> > > > change the "input" attribute for your action to point to the page
you
> want
> > > > your errors displayed on. Anybody thats tried this care to confirm
or
> > > > correct my assumption?
> > > >
> > > > Aaron
> > > >
> > > > On Thu, 29 Aug 2002, Jenny wrote:
> > > >
> > > > > Dear friends:
> > > > >
> > > > > I am using struts to develope web application. I use
<html:errors/>
> in
> > > > > login.jsp, and I implemented validate(..) method in
LoginActionForm
> > > class.
> > > > > If user enter invalid username or password in login
page(login.jsp),
> I
> > > want
> > > > > the errors to be displayed in another page(errorpage.jsp), other
> than in
> > > > > login page. Is there a way to fulfill this? Your help is
> appreciated.
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Jenny
> > > > >
> > > > >
> ______________________________________________________________________
> > > > > Post your ad for free now! http://personals.yahoo.ca
> > > > >
> > > > > --
> > > > > To unsubscribe, e-mail:
> > > <ma...@jakarta.apache.org>
> > > > > For additional commands, e-mail:
> > > <ma...@jakarta.apache.org>
> > > > >
> > > >
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > <ma...@jakarta.apache.org>
> > > > For additional commands, e-mail:
> > > <ma...@jakarta.apache.org>
> > >
> > > ______________________________________________________________________
> > > Post your ad for free now! http://personals.yahoo.ca
> > >
> > > --
> > > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
> ______________________________________________________________________
> Post your free ad now! http://personals.yahoo.ca
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>

______________________________________________________________________ 
Post your ad for free now! http://personals.yahoo.ca

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: How to have submit button with img

Posted by James Mitchell <jm...@telocity.com>.
Try using:

  <html:image src="struts-power.gif"/>


James Mitchell
Software Engineer\Struts Evangelist
Struts-Atlanta, the "Open Minded Developer Network"
http://www.open-tools.org/struts-atlanta




> -----Original Message-----
> From: Lili [mailto:J_zhangca@yahoo.ca]
> Sent: Friday, August 30, 2002 8:52 AM
> To: Struts Users Mailing List
> Subject: How to have submit button with img
>
>
> Hi, All:
>
> I want to have submit button with a image for display purpose.
> The following
> is part of my code:
>
>  <html:submit>
>   <img src="struts-power.gif"/>
>  </html:submit>
>
> struts-power.gif exists in same directory as my jsp files. But when I run
> it, it always show me a button with <img src=
> on the button. Please help me if you know how to solve the problem.
>
> Thanks
>
> Lili
>
> ______________________________________________________________________
> Post your ad for free now! http://personals.yahoo.ca
>
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
> 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


How to have submit button with img

Posted by Lili <J_...@yahoo.ca>.
Hi, All:

I want to have submit button with a image for display purpose. The following
is part of my code:

 <html:submit>
  <img src="struts-power.gif"/>
 </html:submit>

struts-power.gif exists in same directory as my jsp files. But when I run
it, it always show me a button with <img src=
on the button. Please help me if you know how to solve the problem.

Thanks

Lili

______________________________________________________________________ 
Post your ad for free now! http://personals.yahoo.ca

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: want to have errors to be dispalyed in diffrent page

Posted by Vivian <J_...@yahoo.ca>.
Thank you, Aaron. The explaination is very clear. I still not clear about
one thing. In the following part of your code, you use id="error". Where
should define "error"? I tried to clear it by myself, but it seems not easy
for me to find answer by myself. Please give me a hint.

Thank you so much

regards

Jenny

 <ul>
>        <html:messages id="error">
>            <li><bean:write name="error"/></li>
>        </html:messages>
>     </ul>


----- Original Message -----
From: "Aaron Oathout" <aa...@codejunkies.org>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Saturday, August 31, 2002 6:10 PM
Subject: Re: want to have errors to be dispalyed in diffrent page


> No problem, in struts-config.xml you should have an action defined like
the
> following (different values of course):
>
> <action path="/logon"
>         type="org.ifmc.struts.action.AuthenticationAction"
>         name="logonForm"
>         scope="request"
>         validate="true"
>         input="template.logon.layout"
>         parameter="process">
>     <forward name="continue" path="/showPortal.do" redirect="true" />
> </action>
>
> The "input" attribute is used by the action when validation fails. Instead
> of having it point to "login.jsp" in your case, have it point to
> "errorpage.jsp". In errorpage.jsp, put something like the following where
> you want the errors displayed (this is assuming struts 1.1x, can't
> remember syntax for 1.0, but there is something similar):
>
> <logic:messagesPresent>
>     <bean:message key="errors.header"/>
>     <ul>
>        <html:messages id="error">
>            <li><bean:write name="error"/></li>
>        </html:messages>
>     </ul>
> </logic:messagesPresent>
>
> Hopefully this helps. Maybe this link will help clear it up also ( take a
> look at section 3.3.4 ).
> http://jakarta.apache.org/struts/doc-1.0.2/userGuide/building_view.html
>
> Aaron
>
>
> On Thu, 29 Aug 2002, Jenny wrote:
>
> > Aaron:
> >
> > Thank you for your reply. But I am not sure I get what you mean. You
said
> > "change the "input" attribute for your action to point to the page you
want
> > your errors displayed on.". In my login.jsp page, I have:
> > ...
> > <html:text property="userName" />
> > ...
> > <html:password property="password"/>
> > ..
> >
> > How can change the "input" attribute to point to my errorpage.jsp. What
do
> > you mean by "input attribute"? Could you explain in a little bit detail?
> >
> > Thank you very much
> >
> > Jenny
> >
> > ----- Original Message -----
> > From: "Aaron Oathout" <aa...@codejunkies.org>
> > To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> > Sent: Saturday, August 31, 2002 5:26 PM
> > Subject: Re: want to have errors to be dispalyed in diffrent page
> >
> >
> > > Just a guess as I haven't tried this, but it would seem to me you
could
> > > change the "input" attribute for your action to point to the page you
want
> > > your errors displayed on. Anybody thats tried this care to confirm or
> > > correct my assumption?
> > >
> > > Aaron
> > >
> > > On Thu, 29 Aug 2002, Jenny wrote:
> > >
> > > > Dear friends:
> > > >
> > > > I am using struts to develope web application. I use <html:errors/>
in
> > > > login.jsp, and I implemented validate(..) method in LoginActionForm
> > class.
> > > > If user enter invalid username or password in login page(login.jsp),
I
> > want
> > > > the errors to be displayed in another page(errorpage.jsp), other
than in
> > > > login page. Is there a way to fulfill this? Your help is
appreciated.
> > > >
> > > > Thanks,
> > > >
> > > > Jenny
> > > >
> > > >
______________________________________________________________________
> > > > Post your ad for free now! http://personals.yahoo.ca
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > > > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> > > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> > ______________________________________________________________________
> > Post your ad for free now! http://personals.yahoo.ca
> >
> > --
> > To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> > For additional commands, e-mail:
<ma...@jakarta.apache.org>
> >
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>

______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>