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

相關文章
相關標籤/搜索