蝦米爬啊爬
-xiami's blog
常用鏈接
我的隨筆
我的評(píng)論
我的參與
最新評(píng)論
留言簿
(4)
給我留言
查看公開留言
查看私人留言
隨筆檔案
(16)
2007年7月 (1)
2007年5月 (1)
2007年4月 (1)
2007年3月 (2)
2006年11月 (11)
相冊(cè)
xiami's photo
最新隨筆
1.?where 1=1(摘)
2.?String 轉(zhuǎn) Date
3.?命名規(guī)則
4.?ajax(百度百科)
5.?名詞解釋(來源于百度百科)
6.?使用netbeans開發(fā)一個(gè)javabean程序
7.?建立一個(gè)螺旋形矩陣A[n][n]
8.?servlet-api的基本類和其接口介紹
9.?使用netbeans啟動(dòng)捆綁tomcat出現(xiàn)某工程目錄does not exist or is not a readable directory
10.?JAVA連接MYSQL
11.?管道流通信
12.?用File類來列出和篩選所有文件
13.?java.util下的Class Collections的兩種sort方法使用
14.?靜態(tài)內(nèi)部類
15.?1.5容器note問題
積分與排名
積分 - 17966
排名 - 1849
最新評(píng)論
1.?re: 使用netbeans啟動(dòng)捆綁tomcat出現(xiàn)某工程目錄does not exist or is not a readable directory
評(píng)論內(nèi)容較長,點(diǎn)擊標(biāo)題查看
--rel
2.?re: 使用netbeans啟動(dòng)捆綁tomcat出現(xiàn)某工程目錄does not exist or is not a readable directory
多半是只讀,改下子文件屬性,把只讀去掉
--老左zuoge85@gmail.com
3.?re: 使用netbeans啟動(dòng)捆綁tomcat出現(xiàn)某工程目錄does not exist or is not a readable directory
看看你們那個(gè)文件目錄是不是只讀的
--老左zuoge85@gmail.com
4.?re: servlet-api的基本類和其接口介紹
東西很多但是很抽象,迷糊中...
--sophia
5.?re: 使用netbeans啟動(dòng)捆綁tomcat出現(xiàn)某工程目錄does not exist or is not a readable directory
謝謝謝謝 我也這樣 終于找到答案了
--amber
閱讀排行榜
1.?使用netbeans啟動(dòng)捆綁tomcat出現(xiàn)某工程目錄does not exist or is not a readable directory(5499)
2.?String 轉(zhuǎn) Date(2686)
3.?java.util下的Class Collections的兩種sort方法使用(2177)
4.?使用netbeans開發(fā)一個(gè)javabean程序(1953)
5.?使用commons-fileupload包進(jìn)行文件上傳(1003)
評(píng)論排行榜
1.?使用netbeans啟動(dòng)捆綁tomcat出現(xiàn)某工程目錄does not exist or is not a readable directory(4)
2.?servlet-api的基本類和其接口介紹(1)
3.?where 1=1(摘)(0)
4.?String 轉(zhuǎn) Date(0)
5.?命名規(guī)則(0)
Powered by:
博客園
模板提供:
滬江博客
BlogJava
|
首頁
|
發(fā)新隨筆
|
發(fā)新文章
|
聯(lián)系
|
聚合
|
管理
使用netbeans開發(fā)一個(gè)javabean程序
首先新建一個(gè)典型web應(yīng)用程序
然后建一個(gè)com.storm包,在包下寫一個(gè)UserBean的類,添加private的屬性之后只要點(diǎn)擊菜單重構(gòu)-封裝字段就可以添加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;
????}
}
然后再寫一個(gè)注冊(cè)頁面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
>
學(xué)歷
</
td
>
????????????????????????
<
td
><
select?name
=
"
education
"
>
????????????????????????????
<
option?value
=
"
高中
"
?selected
>
高中
</
option
>
????????????????????????????
<
option?value
=
"
大學(xué)
"
>
大學(xué)
</
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會(huì)交給reg.jsp處理,reg.jsp負(fù)責(zé)實(shí)例化一個(gè)javabean,并儲(chǔ)存數(shù)據(jù)
<%
@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的數(shù)據(jù)并顯示
<%
@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
>
????????你的學(xué)歷:
<
jsp:getProperty?name
=
"
user
"
?property
=
"
education
"
?
/><
br
>
????????你的email:
<
jsp:getProperty?name
=
"
user
"
?property
=
"
email
"
?
/><
br
>
????
</
body
>
</
html
>
需要注意的是同一個(gè)javabean實(shí)例在打開瀏覽器之后創(chuàng)建并儲(chǔ)存數(shù)據(jù)直到關(guān)閉也無法通過后退再到Index.jsp-reg.jsp改變其中的數(shù)據(jù)
而且要支持中文必須在每個(gè)文件頭加上 <%
@page?contentType
=
"
text/html;?charset=GB2312
"
?
%>
發(fā)表于 2006-11-30 15:04
蝦米
閱讀(1953)
評(píng)論(0)
編輯
收藏
新用戶注冊(cè)
刷新評(píng)論列表
只有注冊(cè)用戶
登錄
后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
主站蜘蛛池模板:
免费又黄又爽又猛的毛片
|
亚洲国产成人久久三区
|
岛国片在线免费观看
|
毛片在线全部免费观看
|
特级无码毛片免费视频
|
国产成人精品日本亚洲11
|
亚洲av无码成人黄网站在线观看
|
日本高清免费不卡在线
|
久草视频在线免费
|
四虎影视在线影院在线观看免费视频
|
免费看黄网站在线看
|
成人毛片100免费观看
|
亚洲高清一区二区三区电影
|
亚洲第一页中文字幕
|
亚洲国产综合无码一区
|
亚洲午夜福利精品无码
|
国产又大又长又粗又硬的免费视频
|
特a级免费高清黄色片
|
亚洲美国产亚洲AV
|
中文字幕亚洲综合小综合在线
|
亚洲一区精品中文字幕
|
久久精品7亚洲午夜a
|
亚洲成AV人片在线观看无码
|
国产亚洲精久久久久久无码77777
|
免费a级毛片永久免费
|
国产又黄又爽又刺激的免费网址
|
国产成人精品日本亚洲直接
|
亚洲精品欧洲精品
|
亚洲日韩乱码久久久久久
|
亚洲伊人久久大香线蕉苏妲己
|
久久久久亚洲AV成人无码
|
亚洲AV成人片色在线观看
|
无码乱人伦一区二区亚洲一
|
亚洲成人在线网站
|
亚洲成a人片在线观看中文动漫
|
亚洲国产精品久久久天堂
|
亚洲成A人片在线观看WWW
|
亚洲av无码国产精品夜色午夜
|
亚洲αv在线精品糸列
|
久久久久亚洲精品成人网小说
|
亚洲伦理一区二区
|