bean:resource bean:include jsp:include
来源:互联网 发布:企业网站seo教程 编辑:程序博客网 时间:2024/05/20 19:16
一。用于执行对页面的请求,并将响应结果的客户端代码存储在JSP变量中。 有三种使用方法: 1. 使用forward属性指定forward名称 2. 使用href属性指定绝对URL 3. 使用page属性指定相对于应用程序的URL 使用bean:write输出时要将其filter属性设置为false才能显示正确信息,否则显示客户端源代码 二。 <bean:inlcude>标签:与<jsp:include>标记基本相同,都是把被包含的文件先执行,再包含; 用于加载Web应用程序资源的内容并将其以String对象存储在页面范围和本地范围内的JSP变量中。另外,你可以选择指定是否只想要资源的java.io.InputStream对象的引用而不是将其内容保存在String对象中 Web应用程序资源是那些作为Web应用程序的一部分而打包的文件。如: 如果你的Web应用程序位于名为c:\tomcat\strutssample的目录中,并有以下文件: l c:\tomcat\strutssample\index.jsp l c:\tomcat\strutssample\WEB-INF\struts-config.xml 那么你就可以将index.jsp作为“/index.jsp”来访问。请注意,WEB应用程序资源的路径与该应用程序相关,且必须用斜杠(/)开头。 如果加载资源错误,则在运行resource标记时会抛出一个JspException异常。] 用resource标记加载struts-config.xml的示例: <bean:resource id=”strutsConfig” name=”/WEB-INF/struts-config.xml”/> 访问: Struts Config file contents:<%=strutsConfig%> 或 Struts Config file contents:<bean:write name=”strutsConfig”/> 以下代码帮说明如何使用资源标记来为WEB应用程序资源获得一个java.io.InputStream的引用。 <bean:resource id=”strutsConfig” input=”true” name=”/WEB-INF/struts-config.xml”/> input属性接受任何的值。只要存在值,java.io.InputStream引用将被存储在JSP变量中,而不是包含WEB资源内容的String对象。 你可以使用bean:resource标记加载web应用程序资源的内容,比用Scriplet更简洁。 -------------------------------------------------------------------------------------------------------------------------------- header.jsp <html:html lang="true"> <head> <html:base /> <title>header.jsp</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <bean:define id="empId" value="ssssssssssssssssssssssssssssss"/> <bean:write name="empId"/> </body> </html:html> bean:include
<bean:include id=”search forward=”forward”/>
<bean:include id=”search” href=”http://www.google.com” />
<bean:include id=”search” page=”/search.jsp”/>
区别在于: <jsp:include>直接把包含的文件显示到页面上,<bean:include>标记是把内容保存到一个局部变量中,然后再处理。
<bean:include>常用属性为 id和forward、page、href三者之一。
使用这个标记可以包含外部服务器的获取XML到本地处理。bean:resource
<%@ page language="java" pageEncoding="ISO-8859-1"%> <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %> <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html:html lang="true"> <head> <html:base /> <title>header.jsp</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <bean:define id="empId" value="ssssssssssssssssssssssssssssss"/> <bean:write name="empId"/> </body> </html:html>
bean:resource标签true:
<%@ page language="java" pageEncoding="ISO-8859-1"%> <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %> <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html:html lang="true"> <head> <html:base /> <title>header.jsp</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> <bean:define id="empId" value="ssssssssssssssssssssssssssssss"/> <bean:write name="empId"/> </body> </html:html>
bean:resource标签false:
bean:include标签:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html lang="zh-CN"> <head> <base href="http://localhost:8090/SS1/header.jsp"> <title>header.jsp</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> ssssssssssssssssssssssssssssss </body> </html>
bean:include标签true:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html lang="zh-CN"> <head> <base href="http://localhost:8090/SS1/header.jsp"> <title>header.jsp</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link rel="stylesheet" type="text/css" href="styles.css"> --> </head> <body> ssssssssssssssssssssssssssssss </body> </html>
bean:include标签false:
ssssssssssssssssssssssssssssss
- bean:resource bean:include jsp:include
- bean:resource和bean:include区别
- bean:include
- bean:inlucde和jsp:include的区别以及bean:resource的使用
- bean:include的应用
- jsp中使用bean:include和c:import问题
- 他のJSPページを読み込む<bean:include>
- bean:resource
- 区别include jsp:include
- include和jsp:include
- jsp include与include
- <jsp:include...>和<%@include %>
- <%@ include%>与<jsp:include>
- jsp:include
- <jsp:include>
- jsp include
- jsp:include
- <jsp:include>
- Linux-Shell编程之创建shell脚本并执行
- 随机汉字
- pageContext.findAttribute()与pageContext.getAttribute()的区别
- elasticsearch5基本概念
- Class的继承
- bean:resource bean:include jsp:include
- c++(字符串操作 1)
- java连接各种数据库及配各种服务器数据池(更新中)
- 与其他的PDF编辑器相比,迅捷PDF编辑器实在好用太多了
- jquery获取值传值
- Rk3288核心板Cadence制作(一)之原理图设计及orcad常用快捷键
- <html:messages id="">标签 <html:errors/>标签
- 判断链表中是否有环、并找出环的入口
- Go语言学习之strings包(the way to go)