在jsp中加载header.action
来源:百度知道 编辑:UC知道 时间:2024/06/23 00:58:27
我意思是index.jsp 里面包含 header.jsp 就象include
index.action返回 index.jsp
header.action 返回的页面是 header.jsp
直接在 index.jsp中include page="header.jsp" 是不行的
谢谢
自定义标签是麻烦了点;
--------------------------------
<jsp:include page="login.do" />
--------------------------------
在我机器上执行这句代码是没有错的
顺便说一下:使用jsp-include的两个页面是一种请求关系,而不是包含关系。这与include-file不同。
以上是 Struts1 的方法
Struts2 的如下
试下:
----------------------------------------------------
<jsp:include page="b.action" />
----------------------------------------------------
如果 直接跳转到了 b.jsp页面的话
没办法了 给它来硬的;
我们可以在action 里得到 request
----------------------------------------------------
HttpServletRequest request = ServletActionContext.getRequest();
----------------------------------------------------
在使用request 的RequestDispatcher.forward();跳转到b.jsp
----------------------------------------------------
request.getRequestDispatcher("b.jsp").include(request, response);
-----------------------------------------------