struts1: ForwardAction example

1st.  create simple web app

mvn archetype:create -DgroupId=com.iteye.struts1 -DartifactId=struts1 -DarchetypeArtifactId=maven

-archetype-webapp

2nd. update pom.xml

...
<dependency>
      <groupId>org.apache.struts</groupId>
 <artifactId>struts-core</artifactId>
      <version>1.3.10</version>
    </dependency>
 
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts-extras</artifactId>
<version>1.3.10</version>
</dependency>
    <dependency>
      <groupId>org.apache.struts</groupId>
 <artifactId>struts-taglib</artifactId>
      <version>1.3.10</version>
    </dependency>
    <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
    </dependency>
...

3rd:

add index.jsp:

<html:link page="/welcome.do">
click me to access to welcome page
</html:link>

add welcome.jsp:

<html>
<head></head>
<body>
<h1>This is Welcome Page</h1><br>
<%
java.util.Date date = new java.util.Date();
%>
<%=date %>
</body>
</html>

4th:

 


 
 

猜你喜欢

转载自coderanch.iteye.com/blog/1842054