狂淘

          www.kuangtao.net

             :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            6 隨筆 :: 185 文章 :: 68 評論 :: 0 Trackbacks
          1.index.jsp
                 <s:form action="HelloChina.action" method="post">
                      Name: <s:textfield name="name" value=""/>
                      <s:submit />
                  </s:form>
          2.HelloChina

          package com.xushi.bll;

          import java.util.Map;

          import javax.servlet.http.HttpServletRequest;

          import org.apache.struts2.ServletActionContext;

          import com.opensymphony.xwork2.ActionContext;
          import com.opensymphony.xwork2.ActionSupport;

          public class HelloChina extends ActionSupport {
            private String name;
              
               public String getName() {
                   return name;
               }
              
               public void setName(String name) {
                   this.name = name;
               }
               public String execute() {
                   return "test";
               }
          }

          3.test.jsp
          <%@ page language="java" contentType="text/html; charset=UTF-8"
              pageEncoding="UTF-8"%>
              <%@ 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=UTF-8">
          <title>Insert title here</title>
          </head>
          <body>
          <s:textfield value="${requestScope.name}"></s:textfield>
          <s:property value="name"/>
          </body>
          </html>

          4.struts.xml
          <action name="HelloChina" class="com.xushi.bll.HelloChina">
             <result name="test">/pack/test.jsp</result>  
            </action>

          posted on 2009-10-21 08:59 狂淘 閱讀(458) 評論(0)  編輯  收藏 所屬分類: struts2.0 spring hiberate
          主站蜘蛛池模板: 宁安市| 贡嘎县| 长泰县| 宜阳县| 五莲县| 佳木斯市| 太仓市| 浦县| 邢台市| 米易县| 水富县| 周至县| 怀柔区| 四平市| 远安县| 湄潭县| 西和县| 涟源市| 安徽省| 河西区| 鄂托克旗| 休宁县| 新宾| 德昌县| 偃师市| 新河县| 深水埗区| 丹棱县| 资溪县| 绍兴县| 和硕县| 越西县| 盐山县| 宣化县| 澜沧| 乌兰县| 杭锦后旗| 石泉县| 上蔡县| 梁平县| 盱眙县|