I do as DwB said and now I can give more details about how to dump the variables in the jstl.
first create a custom tag,here is the code.
public class JSTLElDumpTag extends TagSupport {
@Override
public int doStartTag() throws JspException {
JspWriter out=pageContext.getOut();
try{
//out request attribute
ServletRequest request=pageContext.getRequest();
Enumeration it=request.getAttributeNames();
out.print("<div><h2>request scope</h2>");
while(it.hasMoreElements()){
Object next=it.nextElement();
out.print("<div>"+next+":"+request.getAttribute(next.toString())+",value type:"+request.getAttribute(next.toString()).getClass().getName()+"</div>");
}
out.print("</div>");
return super.doStartTag();
} catch (IOException e){
throw new JspException("Io exception occurred ");
}
}
}
in the code above I dumped all the request variables,include its name,value and type. I think type is very important when we dealing with numbers.
next we need to configure our tld file.
<taglib 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-jsptaglibrary_2_1.xsd"
version="2.1">
<tlib-version>1.0</tlib-version>
<short-name>date</short-name>
<!-- Invoke 'Generate' action to add tags or functions -->
<tag>
<name>eldump</name>
<tag-class>JSTLElDumpTag</tag-class>
<body-content>JSP</body-content>
</tag>
configure this tld file in your web.xml
<jsp-config>
<taglib>
<taglib-uri>/tags</taglib-uri>
<taglib-location>/WEB-INF/datetag.tld</taglib-location>
</taglib>
</jsp-config>
the tld file name is datetag.tld
now we can use in our jsp file
<%@taglib prefix="bw" uri="/tags" %>
put above in the head of your jsp file,and in the end of your jsp file you use
<bw:eldump></bw:eldump>
to dump your variables then.
What I should declare is that in some cases we need to dump the variables in the jsp file which were declared by the jstl tag cset , you should add attribute scope=request when you set variables or the manner above will not dump these variables.
I hope this would help you and if you find some errors in my post,your notice will sincerely appreciated.