- 浏览: 18518 次
最新评论
当你想访问http://localhost:9999/strutsdemo/时(不含任何.do),需要在index.jsp中定义一个<logic:forward name="ABC">
例如:
index.jsp:
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/struts-logic" prefix="logic" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<<logic:forward name="reguserui"/>
struts-config.xml:
<struts-config>
<global-forwards>
<forward name="reguserui" path="/RegUserUI.htm"></forward>
</global-forwards>
<action-mappings>
<action path="/RegUserUI" type="cn.user.strutsdemo.actions.RegUserUI">
<forward name="success" path="/WEB-INF/user/regUser.jsp"></forward>
</action>
.....................
.....................
DEMO:
1.
<Action></Action>中的<forward>首先在<Action>内部找success,如果没有,会去全局<forward>里面找success.
2.
如果很多<Action>里面都需要访问success并且返回的路径也一样,那么应该把success放置全局<forward>中
例如:
index.jsp:
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/struts-logic" prefix="logic" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<<logic:forward name="reguserui"/>
struts-config.xml:
<struts-config>
<global-forwards>
<forward name="reguserui" path="/RegUserUI.htm"></forward>
</global-forwards>
<action-mappings>
<action path="/RegUserUI" type="cn.user.strutsdemo.actions.RegUserUI">
<forward name="success" path="/WEB-INF/user/regUser.jsp"></forward>
</action>
.....................
.....................
DEMO:
1.
<Action></Action>中的<forward>首先在<Action>内部找success,如果没有,会去全局<forward>里面找success.
2.
如果很多<Action>里面都需要访问success并且返回的路径也一样,那么应该把success放置全局<forward>中
发表评论
-
<html:link> <html:rewrite>区别
2011-11-20 22:13 881<html:link> 生成的是一个超链接: &l ... -
<htmk:link>的使用
2011-11-20 21:56 737<html:link action="/Reg ... -
struts中的整数转换器问题
2011-10-12 23:13 0画面入力项显示的是"",点击提交按钮后也显 ... -
防止表单重复提交的原理与struts的实现
2011-10-10 06:59 594第一个action: public class RegUser ... -
<html:checkbox>标签使用时要重写reset方法
2011-10-09 22:24 1084<html:checkbox property=&quo ... -
errors参数国际化
2011-10-09 07:21 519prompt.name=(en)username error. ... -
表单校验和业务逻辑校验
2011-10-09 06:53 999表单校验:请求参数->ActionForm->Ac ... -
html_errors标签单独显示各个错误消息
2011-10-08 22:00 1205public class UserForm extends A ... -
html_errors标签引入国际化资源包
2011-10-07 21:20 915public class UserForm extends A ... -
FormBean使用值对象类型的属性
2011-10-06 20:54 877public class UserForm extends A ... -
<logic:forward>与<logic:redirect>区别
2011-09-29 23:11 15171 .<logic:forward>属于程序内部访 ... -
<htmk:link>自动生成sessionId,支持url重写
2011-09-29 07:11 712当客户端向服务器发送一请求时,服务器不知道客户端是否支持coo ... -
防止struts-config.xml文件膨胀_OtherActionForm.java
2011-09-29 22:34 559public class OtherActionForm ex ... -
防止struts-config.xml文件膨胀_LoginOtherAction.java
2011-09-27 22:13 611public class LoginOtherAction e ... -
防止struts-config.xml文件膨胀_hello.jsp
2011-09-27 22:12 628<%@ page contentType="t ... -
防止struts-config.xml文件膨胀_struts-config.xml
2011-09-27 22:10 448<?xml version="1.0" ...
相关推荐
redis-desktop-manager-2021.0安装包。 1.启动提示0xc000007b错误。 ... ...2.启动提示找不到 ...下载 python37-deps.zip, 解压到RedisDesktopManager安装目录中。 https://download.csdn.net/download/mq6htmk/14983390
该课件是CSS基础,是学习CSS样式的最好教程,该课件是CSS基础,是学习CSS样式的最好教程,该课件是CSS基础,是学习CSS样式的最好教程,该课件是CSS基础,是学习CSS样式的最好教程,该课件是CSS基础,是学习CSS样式的...
HTMK & CSS Capstone 项目 - 在线维修店用于家庭维修的在线商店的项目。 遵循的设计是作品,但具有个性化的内容。 在这项工作中,我将演示在主要课程的Microverse HTML和CSS第一节中获得的技能。店铺理念这家商店是...
素材简介:html5 3d室内布局展示特效是一款用于展示各种艺术品,每个房间展示一组图片,可以通过前后导航箭头来切换房间。
Vue.js高仿饿了么外卖App
附件中实现了通过html2canvas截图百度echart。解压即可运行
100款基本CSS+html网页(初学者学习使用)高手就不要来了 极其适合刚学会CSS的新手 来研究 提升技术
hfs模板和nodejs的模板
在htmk页面上浮动的广告,里面可以改成其他任何内容,代码简单,容易改
HTML5文字跑马灯动画特效是一款Splitting.js基于css3属性制作店铺标题文字闪烁跑马灯效果代码。
关于webuploader图片上传的代码,包含html,js等全部插件