You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Muller <mm...@theworld.com> on 2003/07/15 19:41:30 UTC

mapping.findForward( mapping.getInput() ) ?

In Cavaness's book "Programming Jakarta Struts", there is a code sample
on page 188 that contains a line I don't understand.

In the "execute" method of an implementation of an "Action" class, is
the following line of code:

return mapping.findForward( mapping.getInput() );

Doesn't the input have to be an Action?  The DTD says "action or other
resource".  What other resource?  Could I put the name of a tile in
there?  I tried putting the name of a forward in there, but the
validation framework complained that it didn't start with a "/".

Thanks,

   -- Mike







---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: mapping.findForward( mapping.getInput() ) ?

Posted by Michael Muller <mm...@theworld.com>.
> I'm not saying anything about Cavaness' book. I haven't read it so I cannot comment :-) I'm just saying you can get the Input forward easily this way.

well, i'm not looking for a critique of the book, i'm just saying this 
code looks broken.

return mapping.findForward( mapping.getInput() );

as you point out below, findForward takes as an argument the name of a 
forward.  the input attrubute on an action mapping, however, is a page.

>>>2) Yes, the forward can point to any resource, from a tiles definition to a jsp or an action url (I'm talking about the value you put in the <forward name="myforward" path="?"/> bit).
>>
>>but you can't stick in a forward, correct?  this is very confusing, that 
>>you say forward= and then you can give it almost anything EXCEPT a 
>>forward.  :(
> 
> 
> Well the thing is that tag is *defining* a forward, so if you're trying to put another forward in the path= property then you're doing something wrong, cause if that other forward is accessible from this action, then you don't need to define it again!!

i just think the attribute name is unfortunate.  "forwardTo" might be 
better, for instance.

   -- mike



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Logging error message

Posted by Ryan Cuprak <cu...@earthlink.net>.
 Does anyone know how to solve the exception trace below? Both commons
logging and log4j are in the lib directory. Is this a class loading problem?

 -Ryan


avax.servlet.ServletException
        at 
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:471)
        at org.apache.jsp.index$jsp._jspService(index$jsp.java:359)
        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:201)
        at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
        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:943)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:190)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at 
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)
        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:943)
        at 
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at 
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
        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:943)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
        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:943)
        at 
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1027)
        at 
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125
)
        at java.lang.Thread.run(Thread.java:554)

root cause 
java.lang.ExceptionInInitializerError
        at org.apache.struts.taglib.html.HtmlTag. (HtmlTag.java:94)
        at org.apache.jsp.index$jsp._jspService(index$jsp.java:68)
        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:201)
        at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
        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:943)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:190)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at 
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)
        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:943)
        at 
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
        at 
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
)
        at 
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
        at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
        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:943)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
        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:943)
        at 
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1027)
        at 
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125
)
        at java.lang.Thread.run(Thread.java:554)
Caused by: org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException: No suitable Log
constructor
        at 
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.ja
va:516)
        at 
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.ja
va:285)
        at 
org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.ja
va:255)
        at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:381)
        at org.apache.struts.util.MessageResources.
(MessageResources.java:105)
        ... 38 more
Caused by: org.apache.commons.logging.LogConfigurationException: No suitable
Log constructor
        at 
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryI
mpl.java:427)
        at 
org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.ja
va:509)
        ... 42 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Layout
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:1590)
        at java.lang.Class.getConstructor0(Class.java:1762)
        at java.lang.Class.getConstructor(Class.java:1002)
        at 
org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryI
mpl.java:424)
        ... 43 more 


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: mapping.findForward( mapping.getInput() ) ?

Posted by Dichotomy <di...@greenmail.ch>.
On Tue, 15 Jul 2003 12:34:07 -0600
Michael Muller <mm...@theworld.com> wrote:
> > 1) You can use mapping.getInputForward() - more straightforward.
> 
> so would you say cavaness's example broken?  is there any way to 
> configure struts such that it would work?

I'm not saying anything about Cavaness' book. I haven't read it so I cannot comment :-) I'm just saying you can get the Input forward easily this way.

> > 2) Yes, the forward can point to any resource, from a tiles definition to a jsp or an action url (I'm talking about the value you put in the <forward name="myforward" path="?"/> bit).
> 
> but you can't stick in a forward, correct?  this is very confusing, that 
> you say forward= and then you can give it almost anything EXCEPT a 
> forward.  :(

Well the thing is that tag is *defining* a forward, so if you're trying to put another forward in the path= property then you're doing something wrong, cause if that other forward is accessible from this action, then you don't need to define it again!!

To clarify, in mapping.findForward() you can put the name of a forward that you defined in a <forward> tag. The string that you pass to findForward() is the name property of the <forward> tag.

In the <forward> tag's path property, you can put:
- the path to a jsp page (eg "/pages/mypage.jsp")
- the action path to an action (eg "/do/myAction" or "/myAction.do")
- a tile definition if you defined them globally (eg "tiledef.admin.login" or "mytiledef") - see the Tiles doc for how to do that.

-- 
If education is too expensive, try ignorance.

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: mapping.findForward( mapping.getInput() ) ?

Posted by Sandeep Takhar <sa...@yahoo.com>.
I lost track of this thread, but I believe

return new ActionForward(mapping.getInput())

might work??

sandeep
--- Michael Muller <mm...@theworld.com> wrote:
> > 1) You can use mapping.getInputForward() - more
> straightforward.
> 
> so would you say cavaness's example broken?  is
> there any way to 
> configure struts such that it would work?
> 
> > 2) Yes, the forward can point to any resource,
> from a tiles definition to a jsp or an action url
> (I'm talking about the value you put in the <forward
> name="myforward" path="?"/> bit).
> 
> but you can't stick in a forward, correct?  this is
> very confusing, that 
> you say forward= and then you can give it almost
> anything EXCEPT a 
> forward.  :(
> 
>    -- mike
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: mapping.findForward( mapping.getInput() ) ?

Posted by Michael Muller <mm...@theworld.com>.
> 1) You can use mapping.getInputForward() - more straightforward.

so would you say cavaness's example broken?  is there any way to 
configure struts such that it would work?

> 2) Yes, the forward can point to any resource, from a tiles definition to a jsp or an action url (I'm talking about the value you put in the <forward name="myforward" path="?"/> bit).

but you can't stick in a forward, correct?  this is very confusing, that 
you say forward= and then you can give it almost anything EXCEPT a 
forward.  :(

   -- mike



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: mapping.findForward( mapping.getInput() ) ?

Posted by Dichotomy <di...@greenmail.ch>.
Mike,

1) You can use mapping.getInputForward() - more straightforward.

2) Yes, the forward can point to any resource, from a tiles definition to a jsp or an action url (I'm talking about the value you put in the <forward name="myforward" path="?"/> bit).

-- 
If education is too expensive, try ignorance.

On Tue, 15 Jul 2003 11:41:30 -0600
Michael Muller <mm...@theworld.com> wrote:

> 
> In Cavaness's book "Programming Jakarta Struts", there is a code sample
> on page 188 that contains a line I don't understand.
> 
> In the "execute" method of an implementation of an "Action" class, is
> the following line of code:
> 
> return mapping.findForward( mapping.getInput() );
> 
> Doesn't the input have to be an Action?  The DTD says "action or other
> resource".  What other resource?  Could I put the name of a tile in
> there?  I tried putting the name of a forward in there, but the
> validation framework complained that it didn't start with a "/".
> 
> Thanks,
> 
>    -- Mike
> 
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org