You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jenny <J_...@yahoo.ca> on 2002/09/02 19:28:50 UTC

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

Adrian and Aaron:

Thank you very much for answering my question.
But I haven't gotten there. It seems that errorpage.jsp is never been
called.

The details is as following:
I am practising struts-example1.1-b2. I tried to have errors displayed in
different page(errorpage.jsp)(The example itself has errors displayed in
logon.jsp page).The following is part of struts-config.xml that related to
this problem.

<action    path="/logon"
type="org.apache.struts.webapp.example.LogonAction"
           name="logonForm"
           scope="session"
           input="logon">
      <exception
           key="expired.password"
type="org.apache.struts.webapp.example.ExpiredPasswordException"
           path="/changePassword.jsp"/>
    </action>

Notice, in the input attribute, it has input="logon". In order to have
errors displayed in errorpage.jsp page, I changed
input="/errorpage.jsp"(errorpage.jsp is in same folder as logon.jsp). When I
enter wrong user name and password in logon.jsp and click submit button, the
URL changed to http://localhost:8080/Struts-example/logon.do,(which is what
I expected), but the page under the URL is totally blank(it suppose to show
the content of errorpage.jsp). For testing purpose, I have a very simple
erropage.jsp for now. The following is the content of my errorpage.jsp:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:html locale="true">
<head>
<title>errorpage</title>
</head>
<body>

This is the error page

</body>
</html:html>

It suppose to show "This is the error page". But nothing shows.

The interesting thing is: when I tried the above changes with
struts-example(version 1.0),it works perfectly fine.

In struts-example(version 1.0) itself,it has  input="/logon.jsp". I changed
it to input="/errorpage.jsp".

So I guess 'input' attribute in verson 1.1.b2 has different meaning, but I
can't figure out what's the different.

I am stuck here. Hope you can help me out.
Sorry to bother you.

Best regards.

Jenny



----- Original Message -----
From: "Adrian Brown" <ad...@yahoo.com.au>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Cc: <J_...@yahoo.ca>
Sent: Monday, September 02, 2002 3:54 AM
Subject: Re: want to have errors to be dispalyed in diffrent page


> Hi Jenny,
>
> In case no one else answered this, you need to put
> some errors in your session before they can be
> captured and displayed by the errorpage.jsp.
>
> Try the following code in your action:
>
> ActionErrors errors = new ActionErrors();
>     errors.add(ActionErrors.GLOBAL_ERROR, new
> ActionError("error.login"));
>         saveErrors(request, errors);
>
> And make sure there is a corresponding entry in your
> ApplicationResources.properties file, such as:
>
> error.login=There was a problem with our application
> logging in. Please wait ten minutes and try again or
> contact an Administrator.
>
> Hope that helps.
>
> Adrian
>
>
>  --- Jenny <J_...@yahoo.ca> wrote: > Aaron:
> >
> > I figure out you must mean this- to change input
> > attribute in
> > struts-config.xml. I have done this. The following
> > is part of my struts-config.xml file:
> >
> > <action-mappings>
> >
> >     <action   path="/login"
> >               type="...LoginAction"
> >               name="loginForm"
> >               input="/errorspage.jsp"
> >               scope="request">
> >     .....
> >
> >     </action>
> >
> >   </action-mappings>
> >
> > Note: I have input="/errorspage.jsp". It is point to
> > errorpage, not login
> > page. But in errorpage, I only get "Please correct
> > the following errors
> > before you proceed:", there is no specific error
> > message showed, so user
> > don't know which field is wrong. Does anyone know
> > what could cause the
> > problem?
> >
> > Thanks.
> >
> > Jenny
> > ----- Original Message -----
> > From: "Jenny" <J_...@yahoo.ca>
> > To: "Struts Users Mailing List"
> > <st...@jakarta.apache.org>
> > Sent: Thursday, August 29, 2002 5:42 PM
> > Subject: Re: want to have errors to be dispalyed in
> > diffrent page
> >
> >
> > > 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>
> >
> >
> ______________________________________________________________________
> >
> > 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>
> >
>
> http://mobile.yahoo.com.au - Yahoo! Messenger for SMS
> - Now send & receive IMs on your mobile via SMS

----- Original Message -----
From: "Adrian Brown" <ad...@yahoo.com.au>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Cc: <J_...@yahoo.ca>
Sent: Monday, September 02, 2002 3:54 AM
Subject: Re: want to have errors to be dispalyed in diffrent page


> Hi Jenny,
>
> In case no one else answered this, you need to put
> some errors in your session before they can be
> captured and displayed by the errorpage.jsp.
>
> Try the following code in your action:
>
> ActionErrors errors = new ActionErrors();
>     errors.add(ActionErrors.GLOBAL_ERROR, new
> ActionError("error.login"));
>         saveErrors(request, errors);
>
> And make sure there is a corresponding entry in your
> ApplicationResources.properties file, such as:
>
> error.login=There was a problem with our application
> logging in. Please wait ten minutes and try again or
> contact an Administrator.
>
> Hope that helps.
>
> Adrian
>
>
>  --- Jenny <J_...@yahoo.ca> wrote: > Aaron:
> >
> > I figure out you must mean this- to change input
> > attribute in
> > struts-config.xml. I have done this. The following
> > is part of my struts-config.xml file:
> >
> > <action-mappings>
> >
> >     <action   path="/login"
> >               type="...LoginAction"
> >               name="loginForm"
> >               input="/errorspage.jsp"
> >               scope="request">
> >     .....
> >
> >     </action>
> >
> >   </action-mappings>
> >
> > Note: I have input="/errorspage.jsp". It is point to
> > errorpage, not login
> > page. But in errorpage, I only get "Please correct
> > the following errors
> > before you proceed:", there is no specific error
> > message showed, so user
> > don't know which field is wrong. Does anyone know
> > what could cause the
> > problem?
> >
> > Thanks.
> >
> > Jenny
> > ----- Original Message -----
> > From: "Jenny" <J_...@yahoo.ca>
> > To: "Struts Users Mailing List"
> > <st...@jakarta.apache.org>
> > Sent: Thursday, August 29, 2002 5:42 PM
> > Subject: Re: want to have errors to be dispalyed in
> > diffrent page
> >
> >
> > > 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>
> >
> >
> ______________________________________________________________________
> >
> > 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>
> >
>
> http://mobile.yahoo.com.au - Yahoo! Messenger for SMS
> - Now send & receive IMs on your mobile via SMS