日期:2014-05-17 浏览次数:20869 次
属性名 | 默认值 | 类型 | 说明 |
Default | — | String | value属性的值是null时的默认值 |
escape | True | Boolean | 是否转义HTML代码 |
value | <top of stack> | Object | 要输出显示的数据源 |
package com.wl.data.tagsAction; import com.opensymphony.xwork2.ActionSupport; public class PrintHTML extends ActionSupport { private String html; public String getHtml() { return html; } public void setHtml(String html) { this.html = html; } @Override public String execute() throws Exception { html="<table border=2><tr><td>我的名字是:张三</td></tr></table>"; return "printhtml"; } }
<%@ page language="java" import="java.util.*" pageEncoding="GB18030"%> <%@ taglib uri="/struts-tags" prefix="s" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <body> name的值是: <s:property value="html" escape="true" /> <br/> name的值是: <s:property value="html" escape="false"/> </body> </html>
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <package name="Struts2.1" extends="struts-default"> <action name="printhtml" class="com.wl.data.tagsAction.PrintHTML"> <result name="printhtml">/dataTags/printhtml.jsp</result> </action> </package> </struts>