翠湖月色
No Buddha tree at all,And bright mirror nor.Now nothing at all,How dusts any more ?
首頁
新隨筆
聯(lián)系
聚合
管理
隨筆 - 251 文章 - 504 trackbacks - 0
<
2011年11月
>
日
一
二
三
四
五
六
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
6
7
8
9
10
本博客系個人收集材料及學(xué)習(xí)記錄之用,各類“大俠”勿擾!
留言簿
(14)
給我留言
查看公開留言
查看私人留言
隨筆分類
JavaEE(36)
Linux與Unix(6)
Web Services and SOA(16)
WordPress或PHP(1)
人文歷史(17)
名詞解釋(2)
品讀英語(18)
基礎(chǔ)編程篇(9)
所感所悟(25)
報表設(shè)計與開發(fā)(12)
數(shù)據(jù)庫(Sql server,My sql)(3)
數(shù)據(jù)結(jié)構(gòu)與算法設(shè)計(9)
有關(guān)網(wǎng)絡(luò)(5)
雜錄(29)
經(jīng)典視聽(12)
網(wǎng)站應(yīng)用(6)
腳本語言及頁面設(shè)計(8)
軟件測試技術(shù)(8)
閱讀筆記(9)
收藏夾
開源項目(2)
編程開發(fā)(3)
網(wǎng)絡(luò)應(yīng)用(2)
My Favorite Web Sites
CSDN Java 頻道
IBM developerWorks中國
Java開源大全
J道:Java解決之道
SpringFramwork中文論壇
中國萬維網(wǎng)聯(lián)盟論壇
中文Java學(xué)習(xí)網(wǎng)站-孫衛(wèi)琴版主
中文Java技術(shù)主力站點(diǎn)-JR論壇
綠色軟件下載-霏凡軟件站
蝙蝠英語學(xué)習(xí)網(wǎng)
名Bloger
Martin Fowler's blog
No1
算法研究、C/C++
月光博客
非著名Bloger
willing的Blog
德賢Blog
放水老倌
搜索
積分與排名
積分 - 203564
排名 - 283
最新評論
1.?re: Jasperreport連續(xù)打印多個報表模板-原創(chuàng)
您好博主,多個jasper報表文件合并輸出pdf文件了,請問頁碼和總頁數(shù)怎么設(shè)置?謝謝!
--飛燕
2.?re: FckEditor上傳音頻視頻[未登錄]
樓主可以將此代碼共享出來呀 既然這么多人要!
--hello
3.?re: FckEditor上傳音頻視頻
能不能發(fā)一份fck支持上傳,播放視頻的給我,我急用!
--張德強(qiáng)
4.?re: Struts2 select標(biāo)簽值從數(shù)據(jù)庫讀取,再提交給action
公司打個
--飛灑地方
5.?re: Jasperreport連續(xù)打印多個報表模板-原創(chuàng)
多謝,解決了我的問題
--黃曉潔
Struts2 select標(biāo)簽值從數(shù)據(jù)庫讀取,再提交給action
問題描述: addpost.jsp頁面有post的相關(guān)信息,如post.id,post.name,和post.cid(所屬欄目信息column.id)。所屬欄目id通過select標(biāo)簽來選擇,其list值來自columnAction獲得的欄目list。然后post所有信息提交到PostAction的insert方法來處理,完成添加post工作。
解決方法:
1.在columnAction中添加方法findAllColumns(),返回一個column的list。
public
String findAllColumns()
{
try
{
columnList
=
columnService.findAllColumn();
}
catch
(SQLException e)
{
e.printStackTrace();
return
"
error
"
;
}
return
null
;
}
2.配置struts.xml
<action name="findAllColumns" class="cms.action.ColumnAction" method="findAllColumns">
</action>
3. addpost.jsp頁面
<
s:action
name
="findAllColumns"
id
="findAllColumns"
/>
<
td
>
<
s:select
label
="選擇欄目"
name
="posts.cid"
id
="cid"
listKey
="cid"
listValue
="cname"
headerKey
="0"
headerValue
="-- 請選擇 --"
list
="#findAllColumns.columnList"
></
s:select
>
</
td
>
4. PostAction的insert方法
public
String insertPost()
{
try
{
Date date
=
Calendar.getInstance().getTime();
SimpleDateFormat formatter
=
new
SimpleDateFormat(
"
yyyy-MM-dd HH:mm:ss
"
);
String dateString
=
formatter.format(date);
HttpSession session
=
ServletActionContext.getRequest().getSession();
Users user
=
(Users) session.getAttribute(
"
user
"
);
posts.setUid(user.getId());
posts.setPdate(dateString) ;
postService.safePosts(posts);
return
"
addPost
"
;
}
catch
(Exception e)
{
e.printStackTrace();
return
"
Error
"
;
}
}
posted on 2011-11-29 23:07
matthew
閱讀(2227)
評論(3)
編輯
收藏
所屬分類:
JavaEE
FeedBack:
#
html select標(biāo)簽值提交給action為null 2014-05-11 21:00
淺淺的笑
html select標(biāo)簽值提交給action為null,更新取不到值
回復(fù)
更多評論
#
html select標(biāo)簽值提交給action為null,更新取不到值,是為什么 2014-05-11 21:21
曉曉
哎。。。。。。。
回復(fù)
更多評論
#
re: Struts2 select標(biāo)簽值從數(shù)據(jù)庫讀取,再提交給action
2015-01-04 18:43
飛灑地方
公司打個
回復(fù)
更多評論
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發(fā)表評論。
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關(guān)文章:
Struts2 select標(biāo)簽值從數(shù)據(jù)庫讀取,再提交給action
jbpm3插件的中文亂碼問題
FckEditor編輯器添加對話框的內(nèi)容
動態(tài)載入jsp頁面到指定頁面的區(qū)域
在線編輯器FCKeditor2.6中文亂碼-解決過程
Struts的標(biāo)簽使用(1)
中文漢字GB2312和UTF-8的編碼轉(zhuǎn)換程序(轉(zhuǎn))
轉(zhuǎn)載:js技巧收集(200多個) 3
轉(zhuǎn)載:js技巧收集(200多個) 2
轉(zhuǎn)載:js技巧收集(200多個) 1
Copyright ©2025 matthew Powered by:
博客園
模板提供:
滬江博客
主站蜘蛛池模板:
丁青县
|
揭西县
|
和田市
|
巴彦淖尔市
|
山阳县
|
多伦县
|
蒲江县
|
弥勒县
|
大丰市
|
兖州市
|
台中县
|
通化市
|
林州市
|
莱西市
|
上饶市
|
沙坪坝区
|
玉林市
|
泽普县
|
潼关县
|
浪卡子县
|
叙永县
|
嘉定区
|
天津市
|
昭苏县
|
凤冈县
|
广丰县
|
澳门
|
肥乡县
|
三门县
|
大化
|
临澧县
|
西乌
|
沅江市
|
无极县
|
蓬莱市
|
长垣县
|
惠水县
|
渭南市
|
广河县
|
准格尔旗
|
蓬莱市
|