蝦米爬啊爬
-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問題
積分與排名
積分 - 18019
排名 - 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程序(1960)
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
蝦米
閱讀(1960)
評論(0)
編輯
收藏
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發表評論。
網站導航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
主站蜘蛛池模板:
亚洲日本在线观看视频
|
永久免费AV无码网站在线观看
|
免费a级毛片18以上观看精品
|
亚洲一级毛片免费看
|
1000部拍拍拍18勿入免费凤凰福利
|
亚洲网站在线观看
|
无码人妻一区二区三区免费看
|
久久精品国产96精品亚洲
|
女人隐私秘视频黄www免费
|
亚洲精品成人片在线播放
|
大地资源中文在线观看免费版
|
亚洲自偷自偷图片
|
国产精品免费福利久久
|
亚洲神级电影国语版
|
亚洲人成电影网站免费
|
亚洲熟女综合一区二区三区
|
国产免费牲交视频
|
精品无码国产污污污免费网站国产
|
在线免费视频一区
|
国产亚洲精品国产福利在线观看
|
亚洲国产成人精品91久久久
|
免费看一区二区三区四区
|
亚洲综合激情六月婷婷在线观看
|
亚洲欧洲另类春色校园小说
|
久久受www免费人成_看片中文
|
亚洲精品乱码久久久久久V
|
国产91在线免费
|
最新国产乱人伦偷精品免费网站
|
亚洲高清美女一区二区三区
|
最近的中文字幕大全免费版
|
全黄A免费一级毛片
|
亚洲A∨无码无在线观看
|
在线视频观看免费视频18
|
美女露隐私全部免费直播
|
亚洲国产另类久久久精品小说
|
精品福利一区二区三区免费视频
|
亚洲av无码无线在线观看
|
亚洲成AV人片在线观看WWW
|
人禽杂交18禁网站免费
|
中文字幕视频免费在线观看
|
亚洲人成日本在线观看
|