Struts2——debug标签

debug标签主要用于辅助测试,它在页面上生成一个超连接,经过该连接能够查看ValueStack和Stack Context 中的全部值信息。使用debug标签只有一个id属性,这个属性仅仅是该元素一个引用id。 在页面上增长<s:debug/>标签,经过debug标签,能够看的系统中ValueStack离得所有信息,并能够看到Stack Context中的属性。css

result.jsphtml

<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>java

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'result.jsp' starting page</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">
 -->jsp

  </head>
  
  <body> 
    username:<s:property value="username"/><br>
    password:<s:property value="password"/><br>
    <s:debug></s:debug>
  </body>
</html>测试

咱们能够看到.它提供的是Struts ValueStack Debug ..也就是说,都是struts2的值栈(就是各个值的信息)..ui

这个值栈又分为两种.Value Stack Contents 和 Stack Context .spa

(1).Value Stack Contents 里面的信息咱们能够用 <s:property value="sss"> 这样来直接访问.debug

(2) Stack Context  里面的信息咱们能够 <s:property value="#sss">这样来访问htm

相关文章
相关标签/搜索