雅典之夏的小站
知人者智 自知者明 Fighting!!
BlogJava
首页
新随笔
新文章
联系
聚合
管理
<
2006年10月
>
日
一
二
三
四
五
六
24
25
26
27
28
29
30
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
31
1
2
3
4
逃不出的魔咒
时间
常用链接
我的随笔
我的评论
我的参与
最新评论
留言簿
(3)
给我留言
查看公开留言
查看私人留言
随笔分类
JAVA基础&数据库(19)
JSP&Servlet(9)
Spring(1)
Struts(8)
WebServer(5)
学习方法与经验(4)
开发工具区(6)
心情随笔(5)
服务器与网络(4)
硬件,数码(12)
随笔档案
2007年1月 (1)
2006年12月 (1)
2006年10月 (5)
2006年4月 (2)
2006年3月 (1)
2006年2月 (4)
2006年1月 (4)
2005年12月 (3)
2005年11月 (8)
2005年10月 (43)
BLOG链接
☆Crystal的BLOG
Java牛棚的Blog
饼干的BLOG
最新评论
1. re: Server-u与windows防火墙[未登录]
find it here
--zz
2. re: Struts中Cannot find bean XXX in any scope的问题
我也觉得奇怪,就算Action里面没有setAttribute("");为什么提取出来的不是null,而是直接抛出异常?
--yuhuashi
3. re: Server-u与windows防火墙
谢谢啦,研究了一上午!
--carter
4. re: jdbc 学习笔记3(PreparedStatement对象) [未登录]
很详细,很好,顶
--无名
5. re: Struts中下拉菜单的实现[原创]
henhao
--hf
超简单的struts小程序
1、简介
简单的页面输入并显示的功能,有两个页面,
upnews.jsp 提供输入内容的界面,show.jsp显示已经输入的内容
2、源码
struts-config
,流程图
源代码
Strust-config.xml
<
form-bean
name
="upNewsForm"
type
="com.rkind.struts.form.UpNewsForm"
/>
<
action
attribute
="upNewsForm"
input
="/upNews.jsp"
name
="upNewsForm"
path
="/upNews"
scope
="request"
type
="com.rkind.struts.action.UpNewsAction"
>
<
forward
name
="suc"
path
="/show.jsp"
redirect
="true"
/>
</
action
>
upnews.jsp
都是eclispe自动生成的
<
html:form
action
="/upNews"
>
content :
<
html:text
property
="content"
/><
html:errors
property
="content"
/><
br
/>
<
html:submit
/><
html:cancel
/>
</
html:form
>
show.jsp这个简单就一句话,
<
bean:write
name
="upNewsForm"
property
="content"
/>
模型的部分 formbean,自动生成,未做改动
Controller部分,核心啊
UpNewsForm upNewsForm
=
(UpNewsForm) form;
//
TODO Auto-generated method stub
String te
=
upNewsForm.getContent();
try
{
if
(te.equals(
""
))
{
return
new
ActionForward(mapping.getInput());
}
return
(mapping.findForward(
"
suc
"
));
}
catch
(Exception e)
{
throw
new
RuntimeException(e.getMessage());
好了,但是在测试的时候一直出问题,输入以后不能正常,原因有2
1、在链接时候,没有加“/”导致不能正常连接
2、
forward
name
="suc"
path
="/show.jsp"
redirect
="true"
起初没有加redirect,不能跳转。
posted on 2006-10-27 12:39
rkind
阅读(477)
评论(0)
编辑
收藏
所属分类:
Struts
新用户注册
刷新评论列表
只有注册用户
登录
后才能发表评论。
网站导航:
博客园
IT新闻
Chat2DB
C++博客
博问
管理
相关文章:
郁闷的Struts数据源
Struts中Cannot find bean XXX in any scope的问题
超简单的struts小程序
JSP和Struts解决用户退出问题 [转]
使用Struts的Token机制解决表单的重复提交 [转]
Struts中下拉菜单的实现[原创]
Java框架研究——JSF与Struts的异同
Struts常见错误汇总