社区
Java EE
帖子详情
struts:怎样动态加入forward!
patrick12
2003-08-25 11:23:10
struts:怎样动态加入forward!
原来actionMapping里面有addforward函数
现在structs1.1 没有了!
I wanna return
actionMapping.findForward("我刚刚定义的forward");
...全文
28
3
打赏
收藏
struts:怎样动态加入forward!
struts:怎样动态加入forward! 原来actionMapping里面有addforward函数 现在structs1.1 没有了! I wanna return actionMapping.findForward("我刚刚定义的forward");
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
patrickjava
2003-08-25
打赏
举报
回复
试一试这个
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("http://www.somesite/actionpath?");
stringBuffer.append("&customer=" );
stringBuffer.append("&address=" );
ActionForward forward = actionMapping.findForward("success");
forward.setPath(sb.toString());
forward.setRedirect(true);
System.out.println(forward.toString());
//actionMapping.addForward(forward);
return forward;
ahtu
2003-08-25
打赏
举报
回复
收藏
patrickjava
2003-08-25
打赏
举报
回复
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("http://www.somesite/actionpath?");
stringBuffer.append("&customer=" );
stringBuffer.append("&address=" );
ActionForward forward = new ActionForward(stringBuffer.toString());
//forward.setPath(sb.toString());
//forward.setRedirect(true);
System.out.println(forward.toString());
//actionMapping.addForward(forward);
return forward;
Struts
-1.2.9 修改版(增加了对没有配置的path的处理)
修改者: selfimpr. 博客: http://blog.csdn.net/lgg201 邮箱: lgg860911@yahoo.com.cn 更新内容: 在原来的版本中, 如果一个路径没有在
struts
-config.xml文件中配置, 返回的是一个404错误页面, 现在, 如果一个请求路径没有在
标签中配置, 我们可以自定义返回的错误页面. 使用示例: 如果你想要使用这个功能, 在
struts
-config.xml文件中, 你必须
加入
这些代码. 在<
forward
/>标签中, name属性必须是"REQUEST_NOT_CONFIG", path属性可以配置为一个在你的应用中存在的页面路径.
forwards> <
forward
name="REQUEST_NOT_CONFIG" path="/error.jsp" />
forwards> 如果还是不懂,请查看sample目录的示例. updater: selfimpr. blog: http://blog.csdn.net/lgg201 mail: lgg860911@yahoo.com.cn update content: in formerly version, if a path not config in the
struts
-config.xml file, response is the 404 page, now, if a path is not config in the
tag , we can custom the error page. Use Example: if you want to use this function, in the
struts
-config.xml file, you must join these code. in the <
forward
/> tag, name must be "REQUEST_NOT_CONFIG", the path you can config a exist page in your application.
forwards> <
forward
name="REQUEST_NOT_CONFIG" path="/error.jsp" />
forwards> if you didn't understand you can see the sample folder.
java之路-caiban
Struts
的使用
这是一个经过改写的
struts
1.2 使用方便,可以在某种程度上提高开发效率 具体使用方法 1.建普通项目,并
加入
相应的
STRUTS
包 稍微改下build属性
加入
struts
1.2框架,用默认的包就可以了 2.
加入
caiban-
struts
.jar,这个包里其实只有两个类文件,你也可以直接将类文件放到src的某个包下,只要
struts
-config.xml里配置对就可以了(关于这部分的配置,在下面会讲到) 到现在,基本上已经把
struts
框架加进去了 3.配置一个action试一下 做个action试下 这里一定要让新建的action类继承BaseBean类 type="net.caiban.
struts
.BeanAction"这里一定要配置成BeanAction所在的地方,具体的可以根据自己项目来定,这里因为在caiban-
struts
.jar里有了,所以直接写就可以了 name="testAction" 对应
这个名字其实是最后html:form标签生成的
forward name="test" path="/test.jsp">
forward
> 这个是跳转 =.=! 居然死了 地址先写下吧,http://demo.caiban.net:580/
struts
/test.do 抱歉,晚上没好好准备,出了好多错误 path="/testMe"这里的testMe,对应action类里的一个方法名,这点很重要,刚刚我也犯错误了 好了,action里的方法已经起作用了,再来做个实验吧 好了晚上就讲这些吧 4.关于action的使用 a.一般情况下,action只用来接收数据和处理跳转,调用相应的service,尽量不要在action里写业务代码,也不要写操作数据库的代码 b.当要防止页面刷新时,可以使用basebean里的方法goRedirect(mappingName, params) 这是一些关于action使用时的建议,参考下 有问题可以联系我: QQ/EMAIL/MSN:x03570227@163.com
Struts
1自学教程
Struts
1是
Struts
2学习的基础,懂了
Struts
1,学习
Struts
2会变得很轻松。很多遗留系统,需要维护,也需要我们懂点
Struts
1的知识。本次课程为14个学时,将从
Struts
1.x的环境搭建以及技术准备入手,利用
Struts
1.x实现用户注册、登录、删除以及修改等各类模块。在此次课程中在开发过程准备与开发过程完成共两个学时详解了
Struts
1.x的运行机制,这样的教学方式能加深我们对其的理解。
一口一口吃掉
Struts
(八)——四种
forward
Struts
设置转向信息的时候,需要用到
Forward
。我们有四种不同的处理方式: <!--方式一、 全局转向信息,所有Action公用 --> <global-
forward
s> <
forward
name="error" path="/mustLogin.jsp" /> </global-
forward
s> ...
struts
1:(
Struts
)ActionForm类及表单数据验证
在
Struts
的中央控制器中写了
Struts
的控制器角色,在这篇介绍下
Struts
的视图!
Struts
的视图组件:
Struts
框架中的视图组件主要包括:JSP页面。ActionForm类。
Struts
自定义标记。消息资源。其中,ActionForm类是
Struts
框架的核心组件之一,是
Struts
的关键视图组件。在这篇文章中,将讨论ActionForm类及其作用。ActionForm的作用机理:A...
Java EE
67,513
社区成员
225,879
社区内容
发帖
与我相关
我的任务
Java EE
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
复制链接
扫一扫
分享
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章