蝦米爬啊爬
-xiami's blog
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(4)
給我留言
查看公開留言
查看私人留言
隨筆檔案
(16)
2007年7月 (1)
2007年5月 (1)
2007年4月 (1)
2007年3月 (2)
2006年11月 (11)
相冊
xiami's photo
最新隨筆
1.?where 1=1(摘)
2.?String 轉 Date
3.?命名規則
4.?ajax(百度百科)
5.?名詞解釋(來源于百度百科)
6.?使用netbeans開發一個javabean程序
7.?建立一個螺旋形矩陣A[n][n]
8.?servlet-api的基本類和其接口介紹
9.?使用netbeans啟動捆綁tomcat出現某工程目錄does not exist or is not a readable directory
10.?JAVA連接MYSQL
11.?管道流通信
12.?用File類來列出和篩選所有文件
13.?java.util下的Class Collections的兩種sort方法使用
14.?靜態內部類
15.?1.5容器note問題
積分與排名
積分 - 18015
排名 - 1851
最新評論
1.?re: 使用netbeans啟動捆綁tomcat出現某工程目錄does not exist or is not a readable directory
評論內容較長,點擊標題查看
--rel
2.?re: 使用netbeans啟動捆綁tomcat出現某工程目錄does not exist or is not a readable directory
多半是只讀,改下子文件屬性,把只讀去掉
--老左zuoge85@gmail.com
3.?re: 使用netbeans啟動捆綁tomcat出現某工程目錄does not exist or is not a readable directory
看看你們那個文件目錄是不是只讀的
--老左zuoge85@gmail.com
4.?re: servlet-api的基本類和其接口介紹
東西很多但是很抽象,迷糊中...
--sophia
5.?re: 使用netbeans啟動捆綁tomcat出現某工程目錄does not exist or is not a readable directory
謝謝謝謝 我也這樣 終于找到答案了
--amber
閱讀排行榜
1.?使用netbeans啟動捆綁tomcat出現某工程目錄does not exist or is not a readable directory(5502)
2.?String 轉 Date(2689)
3.?java.util下的Class Collections的兩種sort方法使用(2181)
4.?使用netbeans開發一個javabean程序(1959)
5.?使用commons-fileupload包進行文件上傳(1003)
評論排行榜
1.?使用netbeans啟動捆綁tomcat出現某工程目錄does not exist or is not a readable directory(4)
2.?servlet-api的基本類和其接口介紹(1)
3.?where 1=1(摘)(0)
4.?String 轉 Date(0)
5.?命名規則(0)
Powered by:
博客園
模板提供:
滬江博客
BlogJava
|
首頁
|
發新隨筆
|
發新文章
|
聯系
|
聚合
|
管理
使用netbeans開發一個javabean程序
首先新建一個典型web應用程序
然后建一個com.storm包,在包下寫一個UserBean的類,添加private的屬性之后只要點擊菜單重構-封裝字段就可以添加set和get方法
package
?com.storm;
public
?
class
?UserBean?
{
????
private
?String?name;
????
private
?
int
?sex;
????
private
?String?education;
????
private
?String?email;
????
public
?String?getName()?
{
????????
return
?name;
????}
????
public
?
void
?setName(String?name)?
{
????????
this
.name?
=
?name;
????}
????
public
?
int
?getSex()?
{
????????
return
?sex;
????}
????
public
?
void
?setSex(
int
?sex)?
{
????????
this
.sex?
=
?sex;
????}
????
public
?String?getEducation()?
{
????????
return
?education;
????}
????
public
?
void
?setEducation(String?education)?
{
????????
this
.education?
=
?education;
????}
????
public
?String?getEmail()?
{
????????
return
?email;
????}
????
public
?
void
?setEmail(String?email)?
{
????????
this
.email?
=
?email;
????}
}
然后再寫一個注冊頁面index.jsp
<%
@page?contentType
=
"
text/html;?charset=GB2312
"
?
%>
<
html
>
????
<
head
>
????????
<
meta?http
-
equiv
=
"
Content-Type
"
?content
=
"
text/html;?charset=UTF-8
"
>
????????
<
title
>
JSP?Page
</
title
>
????
</
head
>
????
<
body
>
????????
<
form?name
=
"
form
"
?action
=
"
reg.jsp
"
?method
=
"
POST
"
>
????????????
<
table?border
=
"
1
"
>
????????????????
<
thead
>
????????????????????
<
tr
>
????????????????????????
<
td
>
用戶名
</
td
>
????????????????????????
<
td
><
input?type
=
"
text
"
?name
=
"
name
"
?value
=
""
?width
=
"
6
"
?
/></
td
>
????????????????????
</
tr
>
????????????????
</
thead
>
????????????????
<
tbody
>
????????????????????
<
tr
>
????????????????????????
<
td
>
性別
</
td
>
????????????????????????
<
td
>
?
????????????????????????????
<
input?type
=
"
radio
"
?name
=
"
sex
"
?value
=
"
0
"
?
/>
男
????????????????????????????
<
input?type
=
"
radio
"
?name
=
"
sex
"
?value
=
"
1
"
?
/>
女
????????????????????????
</
td
>
????????????????????
</
tr
>
????????????????????
<
tr
>
????????????????????????
<
td
>
學歷
</
td
>
????????????????????????
<
td
><
select?name
=
"
education
"
>
????????????????????????????
<
option?value
=
"
高中
"
?selected
>
高中
</
option
>
????????????????????????????
<
option?value
=
"
大學
"
>
大學
</
option
>
????????????????????????????
<
option?value
=
"
碩士
"
>
碩士
</
option
>
????????????????????????????
<
option?value
=
"
博士
"
>
博士
</
option
>
????????????????????????
</
select
></
td
>
????????????????????
</
tr
>
????????????????????
<
tr
>
????????????????????????
<
td
>
EMAIL
</
td
>
????????????????????????
<
td
><
input?type
=
"
text
"
?name
=
"
mail
"
?value
=
""
?width
=
"
10
"
?
/></
td
>
????????????????????
</
tr
>
????????????????????
<
tr
>
????????????????????????
<
td
></
td
>
????????????????????????
<
td
></
td
>
????????????????????
</
tr
>
????????????????????
<
tr
>
????????????????????????
<
td
><
input?type
=
"
submit
"
?value
=
"
提交
"
?name
=
"
submit
"
?
/></
td
>
????????????????????????
<
td
><
input?type
=
"
reset
"
?value
=
"
重置
"
?name
=
"
reset
"
?
/></
td
>
????????????????????
</
tr
>
????????????????
</
tbody
>
????????????
</
table
>
?????
????????
</
form
>
????
</
body
>
</
html
>
form會交給reg.jsp處理,reg.jsp負責實例化一個javabean,并儲存數據
<%
@page?contentType
=
"
text/html;?charset=GB2312
"
?
%>
<
html
>
????
<
head
>
????????
<
meta?http
-
equiv
=
"
Content-Type
"
?content
=
"
text/html;?charset=UTF-8
"
>
????????
<
title
>
JSP?Page
</
title
>
????
</
head
>
????
<
body
>
????????
<%
????????????request.setCharacterEncoding(
"
GB2312
"
);
????????
%>
????????
<
jsp:useBean?id
=
"
user
"
?scope
=
"
session
"
?
class
=
"
com.storm.UserBean
"
>
????????????
<
jsp:setProperty?name
=
"
user
"
?property
=
"
*
"
?
/>
????????????
<
jsp:setProperty?name
=
"
user
"
?property
=
"
email
"
?param
=
"
mail
"
?
/>
????????
</
jsp:useBean
>
????
</
body
>
</
html
>
鏈接到get.jsp用于取出javabean的數據并顯示
<%
@page?contentType
=
"
text/html;?charset=GB2312
"
?
%>
<
html
>
????
<
head
>
????????
<
meta?http
-
equiv
=
"
Content-Type
"
?content
=
"
text/html;?charset=UTF-8
"
>
????????
<
title
>
JSP?Page
</
title
>
????
</
head
>
????
<
body
>
<
jsp:useBean?id
=
"
user
"
?scope
=
"
session
"
?
class
=
"
com.storm.UserBean
"
?
/>
????????
<
jsp:getProperty?name
=
"
user
"
?property
=
"
name
"
?
/><
br
>
????????你的性別:
<%
?
int
?sex
=
user.getSex();
????????????
if
(
0
==
sex)
????????????????out.println(
"
男
"
);
????????????
else
?
if
(
1
==
sex)
????????????????out.println(
"
女
"
);
????????
%>
????????
<
br
>
????????你的學歷:
<
jsp:getProperty?name
=
"
user
"
?property
=
"
education
"
?
/><
br
>
????????你的email:
<
jsp:getProperty?name
=
"
user
"
?property
=
"
email
"
?
/><
br
>
????
</
body
>
</
html
>
需要注意的是同一個javabean實例在打開瀏覽器之后創建并儲存數據直到關閉也無法通過后退再到Index.jsp-reg.jsp改變其中的數據
而且要支持中文必須在每個文件頭加上 <%
@page?contentType
=
"
text/html;?charset=GB2312
"
?
%>
發表于 2006-11-30 15:04
蝦米
閱讀(1959)
評論(0)
編輯
收藏
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
主站蜘蛛池模板:
中国人xxxxx69免费视频
|
五月天婷婷精品免费视频
|
2021精品国产品免费观看
|
国产亚洲婷婷香蕉久久精品
|
亚洲免费在线观看
|
亚洲国产专区一区
|
无码精品人妻一区二区三区免费
|
免费播放特黄特色毛片
|
一级女性全黄生活片免费看
|
久99精品视频在线观看婷亚洲片国产一区一级在线
|
99久久精品免费精品国产
|
午夜亚洲国产理论秋霞
|
亚欧人成精品免费观看
|
国产亚洲中文日本不卡二区
|
天天干在线免费视频
|
美女被爆羞羞网站免费
|
亚洲乱码中文字幕综合
|
一区二区三区观看免费中文视频在线播放
|
57pao国产成永久免费视频
|
亚洲二区在线视频
|
欧亚精品一区三区免费
|
国产精品自拍亚洲
|
亚洲人色婷婷成人网站在线观看
|
久久国产精品一区免费下载
|
亚洲国产av美女网站
|
国产一区二区三区在线免费
|
国产vA免费精品高清在线观看
|
91成年人免费视频
|
在线观看亚洲专区
|
亚洲国产精品无码久久久不卡
|
99精品视频在线视频免费观看
|
亚洲精品午夜国产va久久
|
亚洲成a人无码av波多野按摩
|
男的把j放进女人下面视频免费
|
亚洲第一成人在线
|
国产亚洲成人在线播放va
|
在线a免费观看最新网站
|
国产亚洲欧美日韩亚洲中文色
|
国产亚洲人成网站在线观看不卡
|
18禁成年无码免费网站无遮挡
|
亚洲色成人网站WWW永久四虎
|