How to find the java class of the custom label and find the custom java
How to find the java class of custom labels
This is a reverse push process (creating custom labels can view the following connections: http://blog.csdn.net/antoniochan/article/details/38109905)
Run <company: ang filesMark = "$ {filesMark}"> </company: ang>
Example
Now you are looking
<% @ Taglib uri = "/xxx/xxxx/xxx. tld" prefix = "company" %>
Company is the name of this label, so you have to hit it first, but if you cannot find it, you may as well find it.
<% @ Include file = "/xxx/xxxx/xxx. jsp" %>
If there are many embedded pages, you need to find them one by one !!!
The path to the Tag Element "/xxx/xxxx/xxx. tld"
Find the element name ang In the tld.
<Tag>
<Name> ang </name>
<Tagclass> com. xxxxx. xxx. xx. x. xxxx. FileEdit </tagclass>
<Attribute>
<Name> filesMark </name>
<Required> true </required>
<Rtexprvalue> true </rtexprvalue>
</Attribute>
</Tag>
So <tagclass> com. xxxxx. xxx. xx. x. xxxx. FileEdit </tagclass>
Tagclass is the path of this label !!!!!!!!
How to Implement custom labels in java
First, write a tag Library Class, write a tld file, and configure it as required. Configure the resource file in config and add your tag to jsp.
For Java custom labels
TagSupport example:
Public class LangHuaTag extends TagSupport {
Private long startTime;
Private long endTime;
Public int doStartTag () throws JspException {
StartTime = System. currentTimeMillis ();
// Indicates the JSP page included in the custom tag
Return TagSupport. EVAL_BODY_INCLUDE;
}
Public int doEndTag () throws JspException {
EndTime = System. currentTimeMillis ();
Long elapsed = endTime-startTime;
Try {
JspWriter out = pageContext. getOut ();
Out. println ("runtime is" + elapsed );
} Catch (IOException e ){
E. printStackTrace ();
}
// Indicates that the JSP page continues to run
Return TagSupport. EVAL_PAGE;
}
}
Html code
<% @ Taglib prefix = "util" uri = "langhua.com/taglib/util" %>
<Util: timer> </util: timer>
<Util: loop times = "3">
<Util: date pattern = "yyyy-MM-dd"/> <br/>
</Util: loop>
Of course, you can write your own custom tag xml description file. We recommend that you read Sun weiqin's javaweb and tomcat. This is probably the title .. Haha