struts first step

Record
1 Eclipse to develop web applications to create a web project


2 Packages used by Struts 2.3.20 

commons-fileupload-1.3.1.jar  

commons-io-2.2.jar

commons-lang3-3.2.jar

commons-logging-1.1.3.jar

freemarker-2.3.19.jar

javassist-3.7.ga.jar

ognl-3.0.6.jar

struts2-core-2.3.20.jar

xwork-core-2.3.20.jar

If you don't have your own JSP, you need a package

servlet-api.jar

jsp-api.jar

 

3 web.xml file content

<filter>

<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>/*</url-pattern>

</filter-mapping>

 

4 struts.xml file content

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

    <package name="a" extends="struts-default">

       <action name="Text" class="com.agents.text.Text">

           <result name="ok">/thefirst.jsp</result>

       </action>

    </package>

 

Category 5 

public class Text extends ActionSupport

 

6jsp 

thefirst.jsp

 

7 Publish the browser to fill in http://localhost:8080/xxxx/Text.action

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326352585&siteId=291194637