struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Pratt <thechrispr...@gmail.com>
Subject Re: Integrating struts 2 with Classic JSP SERVLET /JSTL webapp
Date Mon, 11 May 2015 17:11:39 GMT
Try adding namespace="/"to your s:url tag.
  (*Chris*)
On May 11, 2015 10:06 AM, "Kiran Badi" <kiran@poonam.org> wrote:

> Hi Chris, it load app with welcome page with *.action mapping,but seems
> like url mapping gets messed up,I get below now.
>
> <a href="<s:url action="TestStruts.action"></s:url>">Test Page</a></h4>
> 164:         </div>
> 165:         <!-- End of alert warning container-->
> 166:         <hr>
>
>
> Stacktrace:] with root cause
> The Struts dispatcher cannot be found.  This is usually caused by using
> Struts tags without the associated filter. Struts tags are only usable when
> the request has passed through its servlet filter, which initializes the
> Struts dispatcher needed for this tag. - [unknown location]
> at org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:58)
> at
>
> org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:44)
> at
>
> org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:48)
> at org.apache.jsp.index_jsp._jspx_meth_s_005furl_005f0(index_jsp.java:652)
> at org.apache.jsp.index_jsp._jspService(index_jsp.java:230)
> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
> at
>
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
> at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
> at
>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
> at
>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
> at listener.trimresponse.doFilter(trimresponse.java:43)
> at
>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
> at
>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
> at
>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
> at
>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
> at
>
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581)
> at
>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
> at
>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
> at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
> at
>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
> at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
> at
>
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
> at
>
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
> at
>
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
> at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:619)
>
>
> On Mon, May 11, 2015 at 12:59 PM, Kiran Badi <kiran@poonam.org> wrote:
>
> > checking chris. I think that should work.Let me check.
> >
> > On Mon, May 11, 2015 at 12:51 PM, Chris Pratt <thechrispratt@gmail.com>
> > wrote:
> >
> >> If all your URLs aren't at the root (which they probably aren't), you'll
> >> want to change your url-pattern to just *.action
> >>   (*Chris*)
> >>  On May 11, 2015 9:46 AM, "Kiran Badi" <kiran@poonam.org> wrote:
> >>
> >> > Hi Chris,
> >> >
> >> > Here is Struts 2 filter in web xml,
> >> >
> >> >  <filter>
> >> >         <description>Struts 2 Filter</description>
> >> >         <filter-name>struts2</filter-name>
> >> >
> >> >
> >> >
> >>
> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
> >> >     </filter>
> >> >     <filter-mapping>
> >> >         <filter-name>struts2</filter-name>
> >> >         <url-pattern>/*.action</url-pattern>
> >> >         <dispatcher>REQUEST</dispatcher>
> >> >     </filter-mapping>
> >> >
> >> > Here is test sample with struts.xml which is web-inf/classes folder
> >> >
> >> > <!DOCTYPE struts PUBLIC
> >> >     "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
> >> >     "http://struts.apache.org/dtds/struts-2.0.dtd">
> >> >
> >> > <struts>
> >> >   <constant name="struts.devMode" value="true" />
> >> >   <package name="controller" namespace="/" extends="struts-default">
> >> >       <action name="TestStruts"
> >> > class="org.vasanti.app.helpcommunity.controller.TestStruts"
> >> > method="execute" >
> >> > <result name="success">testdatasource.jsp</result>
> >> > </action>
> >> >     </package>
> >> > </struts>
> >> >
> >> > Here is the test link which I have put in my welcome pag
> >> >
> >> > On Mon, May 11, 2015 at 9:07 AM, Christoph Nenning <
> >> > Christoph.Nenning@lex-com.net> wrote:
> >> >
> >> > > > I already tried that and it's not working and it fails to deploy
> to
> >> > > tomcat.
> >> > > >
> >> > >
> >> > >
> >> > > Well, then please give us more details.
> >> > >
> >> > > You may want to have a look here:
> >> > > http://struts.apache.org/docs/home.html
> >> > >
> >> > >
> >> > > Regards,
> >> > > Christoph
> >> > >
> >> > >
> >> > >
> >> > >
> >> > >
> >> > >
> >> > > > On Monday, May 11, 2015, Christoph Nenning
> >> > > <Christoph.Nenning@lex-com.net>
> >> > > > wrote:
> >> > > >
> >> > > > > > Hi,
> >> > > > > >
> >> > > > > > I need to integrate struts 2 with my classic web application
> >> based
> >> > > on
> >> > > > > > servlet.
> >> > > > > >
> >> > > > > > How do I tell struts 2 intercept only requests coming
from
> >> specific
> >> > > > > folder
> >> > > > > > like
> >> > > > > >
> >> > > > > > com.mysite.app.xx.yy where I will placing all struts
related
> >> source
> >> > > > > files ?
> >> > > > > >
> >> > > > > > Here is the link what I started at stackoverflow,
> >> > > > > >
> >> > > > > >
> >> > http://stackoverflow.com/questions/30056132/integrating-classic-jsp-
> >> > > > > > servlet-3-0-based-web-application-with-struts-2?
> >> > > > > > noredirect=1#comment48258124_30056132
> >> > > > > >
> >> > > > > > Please see if someone can throw some light on my issue.
> >> > > > > >
> >> > > > > > -- Kiran Badi
> >> > > > >
> >> > > > >
> >> > > > >
> >> > > > >
> >> > > > > Basically you register struts2 in your web.xml for some
url
> >> pattern,
> >> > > > > usually *.action. Struts interceptors and actions will only
be
> >> > invoked
> >> > > for
> >> > > > > those URLs.
> >> > > > >
> >> > > > >
> >> > > > >
> >> > > > > Regards,
> >> > > > > Christoph
> >> > > > >
> >> > > > > This Email was scanned by Sophos Anti Virus
> >> > > > >
> >> > >
> >> > > This Email was scanned by Sophos Anti Virus
> >> > >
> >> >
> >>
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message