0

I have a web application already running on a UNIX box. This application is running in struts1.

I am trying to add struts2 to it.

  1. I modified web.xml and added the following entry to it

     <filter>
     <filter-name>struts2Maven</filter-name>
     <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    

    <filter-mapping>

    <filter-name>struts2Maven</filter-name>
    <url-pattern>/*</url-pattern>
    

    </filter-mapping>

  2. I created a struts.xml in WEB-INF\classes folder having the following content

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
    <include file="struts-default.xml"/>

    <constant name="struts.enable.DynamicMethodInvocation" value="false" />
       <constant name="struts.devMode" value="true" />
       <constant name="struts.custom.i18n.resources" value="ApplicationResources" />

    <package name="default" extends="struts-default" namespace="/techTasksList">
        <action name="">
            <result>/WEB-INF/jsp/index.jsp</result>
        </action>
       <action name="setasksList" class="com.sbc.ept.imagine.web.tasksListPortlet.portlet.action.TaskListAction">
          <result name="success">/techTasksList/ViewSE.jsp</result>
       </action>
    </package>
</struts>

But when I try to hit the URL

http://imagine-uat-temp.sbc.com/ImagineSSO/techTasksList/?

I get a 404 page. As per my understanding it should have landed me on the JSP which is located at WEB-INF\jsp\index.jsp

Actual motive is to reach action class. But when I failed to reach the action class, then I thought I must check if the default jsp where action is blank is reachable or not. But even that is not reachable.

How do I fix this or troubleshoot what I am doing wrong?

I have supplied all the struts-2 jars, via shared library option of websphere console.

Yogesh Gandhi
  • 111
  • 1
  • 7
  • Did you try just a single `"/"`? I don't recall how to match an empty path at the root of a namespace. https://stackoverflow.com/a/33628057/438992 might start pointing you in the right direction. – Dave Newton Feb 17 '21 at 17:34
  • Looks like you missing struts.xml after you build your app. See also [this answer](https://stackoverflow.com/a/47850685/573032) and post error stacktrace. – Roman C Feb 20 '21 at 21:41
  • Roman C, Actually I am not building the project, I have just placed struts.xml in web-inf/classes on the deployed location on websphere – Yogesh Gandhi Feb 21 '21 at 03:22
  • @Yogesh Struts configuration has nothing without classes and if it's not parsable. Since you didn't post errors from your struts.xml nobody knows what is your problem. 404 error code returned because no action mapped to the URL you requested. – Roman C Feb 21 '21 at 20:02
  • Errors from struts.xml? There are no errors in steuts.xml that I see. – Yogesh Gandhi Feb 22 '21 at 05:09

0 Answers0