狂淘

          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
          主站蜘蛛池模板: 光泽县| 保德县| 六盘水市| 赤峰市| 三穗县| 阿瓦提县| 临邑县| 吉水县| 新蔡县| 新绛县| 扎鲁特旗| 林州市| 新竹县| 建平县| 邹城市| 名山县| 治县。| 新密市| 宁海县| 襄汾县| 拜城县| 怀集县| 临武县| 姜堰市| 卓尼县| 莱西市| 蚌埠市| 西畴县| 德庆县| 乌兰县| 福建省| 嘉黎县| SHOW| 远安县| 岐山县| 彭水| 和林格尔县| 南溪县| 佛教| 如东县| 平江县|