Discussion:
http://mybox:8080/struts/hello.action gets HTTP Status 404 - Not Found
ssmtpmailtesting ssmtpmailtesting
2018-06-30 11:53:33 UTC
Permalink
tree .

.
├── pom.xml
├── src
│ └── main
│ ├── java
│ │ └── com
│ │ └── actions
│ │ ├── HelloWorldAction.java
│ │ └── MessageStore.java
│ ├── resources
│ │ └── struts.xml
│ └── webapp
│ ├── HelloWorld.jsp
│ ├── index.jsp
│ └── WEB-INF
│ └── web.xml
└── target
├── classes
│ └── struts.xml
└── maven-status
└── maven-compiler-plugin
└── compile
└── default-compile

14 directories, 8 files

I'm following this:
https://struts.apache.org/getting-started/hello-world-using-struts2.html

struts.xml =>

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<constant name="struts.devMode" value="true" />

<package name="basicstruts2" extends="struts-default">
<action name="index">
<result>/index.jsp</result>
</action>

<action name="hello" class="com.actions.HelloWorldAction"
method="execute">
<result name="success">/HelloWorld.jsp</result>
</action>
</package>
</struts>


web.xml =>

<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
<display-name>Archetype Created Web Application</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>


package com.actions;

import com.actions.MessageStore;

import com.opensymphony.xwork2.ActionSupport;

public class HelloWorldAction extends ActionSupport {
private MessageStore messageStore;

public String execute() {
messageStore = new MessageStore() ;

return SUCCESS;
}

public MessageStore getMessageStore() {
return messageStore;
}
}

package com.actions;

public class MessageStore {
private String message;

public MessageStore() {
message = "Hello Struts User";
}

public String getMessage() {
return message;
}
}


<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.actions</groupId>
<artifactId>struts</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>struts Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.5.16</version>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>


</dependencies>
<build>
<finalName>struts</finalName>
</build>
</project>


Why am I getting this error? How can I solve it?

---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@struts.apache.org
For additional commands, e-mail: user-***@struts.apache.org
Yasser Zamani
2018-06-30 12:43:22 UTC
Permalink
Post by ssmtpmailtesting ssmtpmailtesting
web.xml =>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
The maven pom.xml is using Struts 2.5.16 but web.xml is using Struts
2.3.x either DTD and filter. The FilterDispatcher is used in the early
Struts2 development, and it’s deprecated since Struts 2.1.3. it’s always
recommended to upgrade the new filter class – StrutsPrepareAndExecuteFilter.

Regards.

B�KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB��[��X��ܚX�KK[XZ[�\�\�][��X��ܚX�P��]˘\X�K�ܙ�B��܈Y][ۘ[��[X[��K[X
ssmtpmailtesting ssmtpmailtesting
2018-06-30 13:14:08 UTC
Permalink
struts.xml =>

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<constant name="struts.devMode" value="true" />

<package name="com.actions" extends="struts-default">
<action name="index">
<result>/index.jsp</result>
</action>

<action name="hello" class="com.actions.HelloWorldAction"
method="execute">
<result name="success">/HelloWorld.jsp</result>
</action>
</package>
</struts>


web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<constant name="struts.devMode" value="true" />

<package name="com.actions" extends="struts-default">
<action name="index">
<result>/index.jsp</result>
</action>

<action name="hello" class="com.actions.HelloWorldAction"
method="execute">
<result name="success">/HelloWorld.jsp</result>
</action>
</package>
</struts>

Still I get error for http://mybox:8080/struts/

HTTP Status 500 - Internal Server Error

________________________________

type Exception report

messageInternal Server Error

descriptionThe server encountered an internal error that prevented it
from fulfilling this request.

exception

org.apache.jasper.JasperException: 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]

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



and same error for http://mybox:8080/struts/hello.action
Post by Yasser Zamani
Post by ssmtpmailtesting ssmtpmailtesting
web.xml =>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
The maven pom.xml is using Struts 2.5.16 but web.xml is using Struts
2.3.x either DTD and filter. The FilterDispatcher is used in the early
Struts2 development, and it’s deprecated since Struts 2.1.3. it’s always
recommended to upgrade the new filter class – StrutsPrepareAndExecuteFilter.
Regards.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@struts.apache.org
For additional commands, e-mail: user-***@struts.apache.org
Dave Newton
2018-06-30 13:52:41 UTC
Permalink
That means you're hitting a JSP page with S2 tags without having run
through an S2 request process, e.g., hitting a JSP page directly.

On Sat, Jun 30, 2018 at 9:14 AM ssmtpmailtesting ssmtpmailtesting <
Post by ssmtpmailtesting ssmtpmailtesting
struts.xml =>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<package name="com.actions" extends="struts-default">
<action name="index">
<result>/index.jsp</result>
</action>
<action name="hello" class="com.actions.HelloWorldAction"
method="execute">
<result name="success">/HelloWorld.jsp</result>
</action>
</package>
</struts>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<package name="com.actions" extends="struts-default">
<action name="index">
<result>/index.jsp</result>
</action>
<action name="hello" class="com.actions.HelloWorldAction"
method="execute">
<result name="success">/HelloWorld.jsp</result>
</action>
</package>
</struts>
Still I get error for http://mybox:8080/struts/
HTTP Status 500 - Internal Server Error
________________________________
type Exception report
messageInternal Server Error
descriptionThe server encountered an internal error that prevented it
from fulfilling this request.
exception
org.apache.jasper.JasperException: 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]
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
and same error for http://mybox:8080/struts/hello.action
Post by Yasser Zamani
Post by ssmtpmailtesting ssmtpmailtesting
web.xml =>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
The maven pom.xml is using Struts 2.5.16 but web.xml is using Struts
2.3.x either DTD and filter. The FilterDispatcher is used in the early
Struts2 development, and it’s deprecated since Struts 2.1.3. it’s always
recommended to upgrade the new filter class –
StrutsPrepareAndExecuteFilter.
Post by Yasser Zamani
Regards.
---------------------------------------------------------------------
--
e: ***@gmail.com
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton <https://twitter.com/dave_newton>
b: Bucky Bits <http://buckybits.blogspot.com/>
g: davelnewton <https://github.com/davelnewton>
so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>
ssmtpmailtesting ssmtpmailtesting
2018-06-30 13:55:00 UTC
Permalink
I solved the problem, this is web.xml

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

<web-app id="MyStrutsApp" version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<display-name>Archetype Created Web Application</display-name>

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

<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
Post by Dave Newton
That means you're hitting a JSP page with S2 tags without having run
through an S2 request process, e.g., hitting a JSP page directly.
On Sat, Jun 30, 2018 at 9:14 AM ssmtpmailtesting ssmtpmailtesting <
Post by ssmtpmailtesting ssmtpmailtesting
struts.xml =>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<package name="com.actions" extends="struts-default">
<action name="index">
<result>/index.jsp</result>
</action>
<action name="hello" class="com.actions.HelloWorldAction"
method="execute">
<result name="success">/HelloWorld.jsp</result>
</action>
</package>
</struts>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<package name="com.actions" extends="struts-default">
<action name="index">
<result>/index.jsp</result>
</action>
<action name="hello" class="com.actions.HelloWorldAction"
method="execute">
<result name="success">/HelloWorld.jsp</result>
</action>
</package>
</struts>
Still I get error for http://mybox:8080/struts/
HTTP Status 500 - Internal Server Error
________________________________
type Exception report
messageInternal Server Error
descriptionThe server encountered an internal error that prevented it
from fulfilling this request.
exception
org.apache.jasper.JasperException: 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]
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
and same error for http://mybox:8080/struts/hello.action
Post by Yasser Zamani
Post by ssmtpmailtesting ssmtpmailtesting
web.xml =>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
The maven pom.xml is using Struts 2.5.16 but web.xml is using Struts
2.3.x either DTD and filter. The FilterDispatcher is used in the early
Struts2 development, and it’s deprecated since Struts 2.1.3. it’s always
recommended to upgrade the new filter class –
StrutsPrepareAndExecuteFilter.
Post by Yasser Zamani
Regards.
---------------------------------------------------------------------
--
m: 908-380-8699
s: davelnewton_skype
b: Bucky Bits <http://buckybits.blogspot.com/>
g: davelnewton <https://github.com/davelnewton>
so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@struts.apache.org
For additional commands, e-mail: user-***@struts.apache.org

Loading...