Struts 2调试标记示例

下载它– Struts2-Debug-Tag-Example.zip

在Struts 2中,“ debug ”标记是非常有用的调试标记,用于输出网页中“ Value Stack ”的内容以及“ Stack Context ”详细信息。 在本教程中,它显示了JSP页面中“ debug ”标记的用法。

1.行动

带有“ propertyInStack ”属性的简单Action类稍后将在值堆栈中显示。

DebugTagAction.java

package com.mkyong.common.action;

import com.opensymphony.xwork2.ActionSupport;
 
public class DebugTagAction extends ActionSupport{
	
	public String propertyInStack;

	public String getPropertyInStack() {
		return propertyInStack;
	}

	public void setPropertyInStack(String propertyInStack) {
		this.propertyInStack = propertyInStack;
	}

}

2.日期标签示例

一个JSP页面,显示使用“ debug ”标记来输出系统的“ Value Stack ”和“ Stack Context ”。

debug.jsp

<%@ taglib prefix="s" uri="/struts-tags" %>
 <html>
<head>
</head>
 
<body>
<h1>Struts 2 debug tag example</h1>

<s:debug />

</body>
</html>

<s:debug />将生成一个名为“ debug ”的文本链接,您需要单击该文本链接以展开调试详细信息。

3. struts.xml

链接〜

<?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>
 	<constant name="struts.devMode" value="true" />
	<package name="default" namespace="/" extends="struts-default">
	
		<action name="debugTagAction" 
			class="com.mkyong.common.action.DebugTagAction" >
			<result name="success">pages/debug.jsp</result>
		</action>
		
	</package>
</struts>

4.演示

http:// localhost:8080 / Struts2Example / debugTagAction.action

输出量

Struts 2 debug tag example

参考

  1. Struts 2调试标记文档

翻译自: https://mkyong.com/struts2/struts-2-debug-tag-example/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值