You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Stefan Winterstein <wi...@dfki.de> on 2001/03/22 15:40:08 UTC

RedirectingActionForward catch?

In the example application, I'm setting the 'forward' property for the
ActionServlet to 'org.apache.struts.action.RedirectingActionForward' as
described in the user guide (that's because I like to see more reasonable URLs
in the browser).

When I do this, however, the application ceases to work. For example, when I
try to "register" at the start page, I get

> JspException: No bean found under attribute key registrationForm

What's the catch with RedirectingActionForward?

-- 

 -Stefan

 new to Struts, so pardon my ignorance... :)

RE: struts-example/index.jsp failed

Posted by Keith Kee <ke...@netsco.com>.
Thanks for everyone's help. I found the problem after all the kind souls
pointed out it was a startup problem. It turned out that in tomcat 4, the
XML parsers are not exposed but struts needs the parsers to work. So, I
moved the crimson.jar and jaxp.jar from ${TOMCAT_HOME}/jasper/lib to
${TOMCAT_HOME}/lib and that worked.

Thanks a lot!
Keith


-----Original Message-----
From: Craig R. McClanahan [mailto:craigmcc@apache.org]
Sent: Thursday, March 22, 2001 5:53 PM
To: struts-user@jakarta.apache.org
Subject: RE: struts-example/index.jsp failed


It looks like you don't have your controller servlet defined to be
<load-on-startup>.  This is needed in order to initialize several servlet
context attributes used on the JSP pages -- among them the
internationalized message resources.

Craig




RE: struts-example/index.jsp failed

Posted by "Craig R. McClanahan" <cr...@apache.org>.
It looks like you don't have your controller servlet defined to be
<load-on-startup>.  This is needed in order to initialize several servlet
context attributes used on the JSP pages -- among them the
internationalized message resources.

Craig


RE: struts-example/index.jsp failed

Posted by Keith Kee <ke...@netsco.com>.
In the log, these are the only hints I have gotten:
2001-03-22 14:23:59 invoker: init
2001-03-22 14:23:59 jsp: init
2001-03-22 14:24:47 jsp: init
2001-03-22 14:24:47 StandardWrapperValve[jsp]: Servlet.service() for servlet
jsp
 threw exception
javax.servlet.ServletException: Cannot find message resources under key
org.apac
he.struts.action.MESSAGE
        at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageCon
textImpl.java:441)
        at org.apache.jsp.index_jsp._jspService(index_jsp.java:462)
        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspSer
vlet.java:200)
        at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:3
57)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:431)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:246)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:191)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:254)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:201)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
        at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
2119)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:164)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
446)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:162)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
        at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcesso
r.java:818)
        at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.ja
va:893)
        at java.lang.Thread.run(Thread.java:484)
----- Root Cause -----
javax.servlet.jsp.JspException: Cannot find message resources under key
org.apac
he.struts.action.MESSAGE
        at
org.apache.struts.util.RequestUtils.message(RequestUtils.java:292)
        at
org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:2
39)
        at org.apache.jsp.index_jsp._jspService(index_jsp.java:94)
        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspSer
vlet.java:200)
        at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:3
57)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:431)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:246)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:191)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:254)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:201)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
        at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
2119)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:164)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
446)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:564)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:162)
        at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
.java:566)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:472)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
        at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcesso
r.java:818)
        at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.ja
va:893)
        at java.lang.Thread.run(Thread.java:484)


-----Original Message-----
From: Craig R. McClanahan [mailto:craigmcc@apache.org]
Sent: Thursday, March 22, 2001 3:25 PM
To: struts-user@jakarta.apache.org
Subject: Re: struts-example/index.jsp failed




On Thu, 22 Mar 2001, emi john wrote:

> Hi,
>
> I had similar problem before. It looks like there is
> compatibility issue here. As I put old version
> struts.jar in the example lib directory, everything
> seems working fine. So the example doesn't work with
> new struts.jar (tested in JRun 3.0). However, under
> Tomcat 3.2, everything is fine.
>
> Which servlet container do you use?
>
> John
>

John, could you check the log files to see if there are any interesting
messages about startup problems?

Craig




Re: struts-example/index.jsp failed

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 22 Mar 2001, emi john wrote:

> Hi,
> 
> I had similar problem before. It looks like there is
> compatibility issue here. As I put old version
> struts.jar in the example lib directory, everything
> seems working fine. So the example doesn't work with
> new struts.jar (tested in JRun 3.0). However, under
> Tomcat 3.2, everything is fine.
> 
> Which servlet container do you use?
> 
> John
> 

John, could you check the log files to see if there are any interesting
messages about startup problems?

Craig


Re: struts-example/index.jsp failed

Posted by emi john <em...@yahoo.com>.
Hi,

I had similar problem before. It looks like there is
compatibility issue here. As I put old version
struts.jar in the example lib directory, everything
seems working fine. So the example doesn't work with
new struts.jar (tested in JRun 3.0). However, under
Tomcat 3.2, everything is fine.

Which servlet container do you use?

John

--- Keith Kee <ke...@netsco.com> wrote:
> Hi:
>     I just download a copy of the nightly build
> struts, and after
> deployment, I cannot access the url:
> http://localhost:8080/struts-example
> with a error. I am new with struts, but it seems
> like it is tried to access
> a static string in the action class.
> 
> javax.servlet.ServletException: Cannot find message
> resources under key
> org.apache.struts.action.MESSAGE
> 	at
>
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
> l.java:441)
> 	at
>
org.apache.jsp.index_jsp._jspService(index_jsp.java:462)
> 	at
>
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
> 	at
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> 	at
>
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
> va:200)
> 	at
>
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:357)
> 	at
>
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:431)
> 	at
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> 	at
>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
> FilterChain.java:246)
> 	at
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
> ain.java:191)
> 	at
>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
> va:254)
> 	at
>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
> 66)
> 	at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
> 	at
>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
> 	at
>
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
> va:201)
> 	at
>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
> 66)
> 	at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
> 	at
>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
> 	at
>
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2119)
> 	at
>
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
> )
> 	at
>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
> 66)
> 	at
>
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:446)
> 	at
>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
> 64)
> 	at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
> 	at
>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
> 	at
>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
> :162)
> 	at
>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
> 66)
> 	at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
> 	at
>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
> 	at
>
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
> 818)
> 	at
>
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:893)
> 	at java.lang.Thread.run(Thread.java:484)
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

RE: struts-example/index.jsp failed

Posted by Keith Kee <ke...@netsco.com>.
I failed to mention that I am running tomcat 4.0 b2 nightly build as well.

Thanks!
keith

-----Original Message-----
From: Keith Kee [mailto:keith@netsco.com]
Sent: Thursday, March 22, 2001 2:01 PM
To: struts-user@jakarta.apache.org
Subject: struts-example/index.jsp failed


Hi:
    I just download a copy of the nightly build struts, and after
deployment, I cannot access the url: http://localhost:8080/struts-example
with a error. I am new with struts, but it seems like it is tried to access
a static string in the action class.

javax.servlet.ServletException: Cannot find message resources under key
org.apache.struts.action.MESSAGE
	at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:441)
	at org.apache.jsp.index_jsp._jspService(index_jsp.java:462)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:200)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:357)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:431)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:246)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:191)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:254)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:201)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
	at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2119)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
	at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:446)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:162)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
	at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
818)
	at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:893)
	at java.lang.Thread.run(Thread.java:484)






struts-example/index.jsp failed

Posted by Keith Kee <ke...@netsco.com>.
Hi:
    I just download a copy of the nightly build struts, and after
deployment, I cannot access the url: http://localhost:8080/struts-example
with a error. I am new with struts, but it seems like it is tried to access
a static string in the action class.

javax.servlet.ServletException: Cannot find message resources under key
org.apache.struts.action.MESSAGE
	at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:441)
	at org.apache.jsp.index_jsp._jspService(index_jsp.java:462)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:200)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:357)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:431)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:246)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:191)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:254)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:201)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
	at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2119)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
	at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:446)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:162)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
	at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
818)
	at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:893)
	at java.lang.Thread.run(Thread.java:484)




Re: RedirectingActionForward catch?

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 22 Mar 2001, Kare Nuorteva wrote:

> 
> Hello,
> 
> Because RedirectingActionForward does HttpServletResponse.sendRedirect(),
> which sets HTTP Location header to response. You probably save your beans
> to request scope and because Location header can be the only header in
> response (/ http spec) the original request is deleted.
> 

More accurately, a redirect causes a *second* request to come in, which
means that any request attributes you tried to send to your response page
on the original request are gone.  You need to use session scope if you
want beans to be accessible after a redirect.

> Forget reasonable urls or use session scope for beans.
> 

When I have control over my user population, one of the first things I try
to pound into their heads is "this is an application, not a web site; the
URLs you see are totally irrelevant!".

In the general case (like an Internet-based app), I've used two strategies
that also seem to work pretty well at avoiding URL distractions:
- Use a framed presentation (even if it only has one frame in it)
  so that the visible URL never changes.
- Open the application in a new window that doesn't have a location area.

Even if you do one of these, you have to be ready to deal with determined
users who try to use the back arrow and sometimes end up resubmitting the
same form more than once.  A useful programming technique to catch this
usage is the "transaction token" support in the Action class.  Check the
mail archives for more discussion on this topic.


> Cheers,
> Kare
> 

Craig


Re: RedirectingActionForward catch?

Posted by Kare Nuorteva <ka...@kare.uklinux.net>.
Hello,

Because RedirectingActionForward does HttpServletResponse.sendRedirect(),
which sets HTTP Location header to response. You probably save your beans
to request scope and because Location header can be the only header in
response (/ http spec) the original request is deleted.

Forget reasonable urls or use session scope for beans.

Cheers,
Kare

On Thu, 22 Mar 2001, Stefan Winterstein wrote:

> 
> In the example application, I'm setting the 'forward' property for the
> ActionServlet to 'org.apache.struts.action.RedirectingActionForward' as
> described in the user guide (that's because I like to see more reasonable URLs
> in the browser).
> 
> When I do this, however, the application ceases to work. For example, when I
> try to "register" at the start page, I get
> 
> > JspException: No bean found under attribute key registrationForm
> 
> What's the catch with RedirectingActionForward?
> 
> -- 
> 
>  -Stefan
> 
>  new to Struts, so pardon my ignorance... :)
> 

-- 
Kare Nuorteva
http://www.kare.uklinux.net/