pom.xml =

<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.training</groupId>
  <artifactId>struts2_maven</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>struts2_maven 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.10.1</version>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>4.0.0-b01</version>
    </dependency>
  </dependencies>
  <build>
    <finalName>struts2_maven</finalName>
  </build>
</project>


In web.xml web-app_2_5.dtd and  Web Application 2.3 don't work. It
gets error: "Referenced file contains errors
(http://java.sun.com/dtd/web-app_2_5.dtd). For more information, right
click on the message in the Problems View
 and select "Show Details..."

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

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

<web-app>
    <display-name>Struts 2 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>

</web-app>

2.3 and _2_3 works in web.xml

On Sun, Jun 18, 2017 at 2:11 PM, Lukasz Lenart <lukaszlen...@apache.org> wrote:
> You are mixing two different version of Struts - 2.3.x and 2.5.x - you
> must stick with one. See my comments below
>
> 2017-06-18 4:06 GMT+02:00 ssmtpmailtesting ssmtpmailtesting
> <ssmtpmailtest...@gmail.com>:
>> http://localhost:8080/struts2_maven/User/Login.action
>>
>> HTTP Status 404 - Not Found
>>
>> type Status report
>>
>> messageNot Found
>>
>> descriptionThe requested resource is not available.
>> GlassFish Server Open Source Edition 4.0
>>
>> tree .
>> .
>> ├── pom.xml
>> ├── src
>> │   ├── main
>> │   │   ├── java
>> │   │   │   └── com
>> │   │   │       └── mkyong
>> │   │   │           └── user
>> │   │   │               └── action
>> │   │   │                   └── WelcomeUserAction.java
>> │   │   ├── resources
>> │   │   │   ├── struts.xml
>> │   │   │   └── struts.xml~
>> │   │   └── webapp
>> │   │       ├── index.jsp
>> │   │       ├── struts2-core-2.5.10.1.jar
>
> This JAR shouldn't be here, remove it
>
>> │   │       ├── User
>> │   │       │   └── pages
>> │   │       │       ├── login.jsp
>> │   │       │       └── welcome_user.jsp
>
> You should move all the JSP files under WEB-INF to increase security
> -> http://struts.apache.org/security/#never-expose-jsp-files-directly
>
>> │   │       └── WEB-INF
>> │   │           ├── lib
>> │   │           ├── struts2-core-2.5.10.1.jar
>
> This JAR shouldn't be here, remove it
>
>> │   │           └── web.xml
>> │   └── test
>> │       └── java
>
>> struts.xml
>>
>> <?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";>
>
> You are using an outdated DTD, please use version 2.5 (when using
> Struts 2.5.10.1) or 2.3 (when using Struts 2.3.32)
>
>> <struts>
>>
>>     <package name="user" namespace="/User" extends="struts-default">
>>         <action name="Login">
>>             <result>pages/login.jsp</result>
>
> There is no such file, see your file structure, there is 
> "User/pages/login.jsp"
>
>>         </action>
>>         <action name="Welcome" 
>> class="com.mkyong.user.action.WelcomeUserAction">
>>             <result name="SUCCESS">pages/welcome_user.jsp</result>
>
> The same here, also result name is "success" not "SUCCESS"  and you
> can omit it if this is the only result type defined - "success" is by
> default.
>
>>         </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"; >
>
> Not matching DTD, you are using 2.3 but declared 2.5 version of the
> Servlet API in the pom - should be the same.
>
>> <web-app>
>>     <display-name>Struts 2 Web Application</display-name>
>>
>>     <filter>
>>         <filter-name>struts2</filter-name>
>>         <filter-class>
>>
>> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
>
> The filter name is wrong, it has changed starting with Struts 2.5
> https://struts.apache.org/docs/struts-23-to-25-migration.html#Struts2.3to2.5migration-StrutsPrepareAndExecuteFilter
>
> And finally you should based on out Getting Started Guide which we try
> to keep up to date with the latest Struts version
> http://struts.apache.org/getting-started/
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>

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

Reply via email to