posts - 44,  comments - 48,  trackbacks - 0
          <2006年9月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          1234567

          常用鏈接

          留言簿(1)

          隨筆分類

          隨筆檔案

          文章檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          1.
          <html>
          ?<head>
          ??<title>transPara.htm</title>
          ?</head>
          <body>
          ?<form method="POST" action="acceptPara.jsp">
          ? ??<p align="center">
          ??姓 名:<input type="text" name="name" size="20"><br>
          ? ??年 齡:&nbsp;&nbsp;&nbsp; <input type="text" name="age" size="15"><br>
          ? ??性 別:&nbsp;&nbsp;&nbsp;
          ???<input type="radio" value="male" checked name="sex">
          ????男&nbsp;&nbsp;&nbsp;&nbsp;?
          ? ???<input type="radio" name="sex" value="female">女</p>
          ? ??<p align="center">
          ???<input type="submit" value="submit" name="submit">
          ? ???<input type="reset" value="reset" name="reset"></p>
          ?</form>
          </body>
          </html>

          2.
          <html>

          <%@ page contentType="text/html;charset=gb2312"%>
          <jsp:useBean id="atest"? class="test.AcceptPara"/>

          <head><title>acceptPara.jsp</title></head>

          <body>
          <jsp:setProperty name="atest" property="*"/>?? //? ***將javabean中的屬性自動與html提交過來的變量匹配***********
          Value of property "name" :
          <jsp:getProperty name="atest" property="name"/><br>
          Value of property "age" :
          <jsp:getProperty name="atest" property="age"/><br>
          Value of property "sex" :
          <jsp:getProperty name="atest" property="sex"/><br>
          Value of property "submit" :
          <jsp:getProperty name="atest" property="submit"/><br>

          </body>
          </html>



          3.
          package test;//?? 在一些tomcat舊版本包定義一定要有,且在jsp引用中如下:<jsp:useBean id="atest"? class="test.AcceptPara"/>? 編譯后放在\WEB-INF\classes\test\中

          public class AcceptPara{

          ?String name;
          ?int age;
          ?String sex;
          ?String submit;
          ?
          ?public void setName(String value){
          ??name=value;
          ?}
          ?
          ?public String getName(){
          ??return name;
          ?}
          ?
          ?public void setAge(int value){
          ??age=value;
          ?}
          ?
          ?public int getAge(){
          ??return age;
          ?}
          ?
          ?public void setSex(String value){
          ??sex=value;
          ?}
          ?
          ?public String getSex(){
          ??return sex;
          ?}
          ?
          ?public void setSubmit(String value){
          ??submit=value;
          ?}
          ?
          ?public String getSubmit(){
          ??return submit;
          ?}
          ??
          ?public void acceptPara(){}
          ?
          }

          posted on 2006-09-08 12:41 摩西 閱讀(767) 評論(2)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 海宁市| 突泉县| 禹城市| 晋中市| 保山市| 抚州市| 永修县| 古丈县| 荣昌县| 博客| 平邑县| 达拉特旗| 弋阳县| 潜山县| 灵宝市| 昆山市| 建宁县| 金坛市| 萨嘎县| 筠连县| 阿拉善左旗| 濮阳市| 浮山县| 安岳县| 福鼎市| 舟曲县| 安丘市| 黄大仙区| 万载县| 平南县| 苗栗县| 宁晋县| 奉化市| 永川市| 南充市| 手游| 青河县| 靖边县| 那曲县| 宜宾市| 玉林市|