Struts2示例
来源:互联网 发布:des算法 vb 编辑:程序博客网 时间:2024/05/18 02:13
NameCollector.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%><%@ taglib prefix="s" uri="/struts-tags"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Insert title here</title></head><body> <s:form action="hello"> <s:textfield name="name" label="Your Name:"/> <s:submit/> </s:form></body></html>
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/strurs-2.3.dtd"><struts> <package name="GreetingName" namespace="/Greeting" extends="struts-default"> <action name="Name"> <result>/jsp/NameCollector.jsp</result> </action> <action name="hello" class="mypack.Hello"> <result name="SUCCESS">/jsp/Greeting.jsp</result> </action> </package></struts>
Hello.java
package mypack;public class Hello {private final String hello = "Hello:";private String name;private String greeting;public String getName() {return name;}public void setName(String name) {this.name = name;}public String getGreeting() {return greeting;}public void setGreeting(String greeting) {this.greeting = greeting;} public String execute(){setGreeting(hello+name);return "SUCCESS";}}
Greeting.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%><%@ taglib prefix="s" uri="/struts-tags" %><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Greeting </title></head><body> <h3>Greeting Page</h3> <h4></h4><s:property value="greeting"/></h4></body></html>
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>Hello</filter-name> <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter </filter-class> </filter> <filter-mapping> <filter-name>Hello</filter-name> <url-pattern>/*</url-pattern> </filter-mapping></web-app>
0 0
- Struts2示例
- Struts2示例
- Struts2+JS,Struts2+jQuery示例
- Struts2上传文件示例
- Struts2.0配置示例
- struts2 UI标签示例
- struts2 doubleselect高级示例
- struts2 doubleselect示例
- 第一个struts2示例
- struts2 UI标签示例
- struts2上传文件示例
- struts2下载文件示例
- struts2 第一个示例
- struts2 doubleselect示例
- struts2配置文件示例
- Struts2上传文件示例
- Struts2 登录示例
- Struts2的简单示例
- RecycleView 动画实现
- 实例解析:MyBatis中复杂resultMap结果映射
- 排序:插入排序
- SecureCRT配色推荐和永久设置
- 1.自然语言处理(NLP)与Python
- Struts2示例
- LINUX系统资源监控工具nmon的使用
- java开发系统内核:实现进程自动切换,再现Linus当年辉煌一刻
- String类及String类常用的方法
- RecyclerView 的点击事件!
- Unity3D黑暗之光项目里面的功能运用--UI框的拖拽
- poj 1743 Musical Theme (后缀数组)
- java:将list写入excel中
- Spring 通过工厂方法(Factory Method)来配置bean