Debug tag example in struts2 framework
Previous | Home | Next |
The Struts2 framework provide “debug” tag, through this tag debugging the output content of the “Value Stack” and also the “Stack Context” details are show on the web browser.Syntax of this tag is:-<s:debug></s:debug>
The struts2 framework provide following debug tag example,<s:debug></s:debug>
Directory Structure of <s:debug> tag Example in Struts 2.0 Using MyEclipse IDEindex.jsp<%@taglib uri="/struts-tags" prefix="s"%> <h2>Debug tag example in struts2 framework</h2> <s:debug></s:debug>web.xml<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <filter> <filter-name>f1</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> </filter> <filter-mapping> <filter-name>f1</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> </web-app>struts.xml<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd"> <struts> <package name="demo" extends="struts-default"> <action name="" class="org.r4r.DebugTagAction"> <result name="success" type="dispatcher">/index.jsp</result> </action> </package> </struts>DebugTagAction.javapackage org.r4r; public class DebugTagAction { String debug; public String getDebug() { return debug; } public void setDebug(String debug) { this.debug = debug; } public String execute(){ return "success"; } }Output
Previous | Home | Next |