⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 beanresources.jsp

📁 精通Struts:基于MVC的java web车技与开发源程序(2)
💻 JSP
字号:
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ page import="beantaglibs.SomeBean" %>
<html:html>
<head>
<title>Bean Resources sample code</title>
</head>
<body bgcolor="white">

<h3>Bean Resources sample code</h3>

<p>This page provides examples of the following Struts BEAN tags:<br>
<ul>
<li>&lt;bean:message&gt;</li>
<li>&lt;bean:resource&gt;</li>
<li>&lt;bean:struts&gt;</li>
</ul>

<table border="1" width="100%">
  <%--
  The following section contains code getting messages.
  --%>
  <tr>
    <td align="left" colspan="2">
     <% 
        request.setAttribute("stringBean","hello");
        SomeBean bean=new SomeBean();
        bean.setName("hello");
        request.setAttribute("someBean",bean);
     %>
     <bean:message bundle="special" key="hello"/><P>
     <bean:message bundle="special" name="stringBean"/><p>
     <bean:message bundle="special" name="someBean"
                   property="name"/><P>
     <bean:message key="hello" arg0="Linda" />
    </td>
  </tr>
  <%--
  The following section shows how to use web resources.
  --%>
  <tr>
    <td align="left" colspan="2">
testpage1.jsp:<P>
<bean:resource id="resource" name="/testpage1.jsp"/>
<bean:write name="resource"/>
</td>
</tr>
  
  <%--
  The following section shows how to get a Struts configuration object.
  --%>
  <tr>
    <td align="left" colspan="2">
The path of the global forward "BeanResources" is:
<bean:struts id="forward" forward="BeanResources"/>
<bean:write name="forward" property="path"/>
</td>
  </tr>
  <%--
  The following section shows how to get an application web response.
  --%>
  <tr>
    <td align="left">
testPage1:<BR>
<bean:include id="tp1" page="/testpage1.jsp"/>
<bean:write name="tp1" filter="false"/><P>
</td><td align="left">
testPage2:<BR>
<bean:include id="tp2" forward="testpage2"/>
<bean:write name="tp2" filter="false"/><P>
</td>
</tr>
</table>
</body>
</html:html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -