JSP label custom (2) --- GetProperty

zhaozj2021-02-12  135

This time you have to implement a getProperty label. The main knowledge point is how to call the method in the example. Important parts have been marked with annotation.

/ ** * Class Description: Label processing class, imitation JSP GetProperty Tag * Create Date: 2004-7-2 * Modify Date: 2004-7-2 * Created: dever * /

Package cn.dever.tag; import javax.servlet.jsp. *; import javax.servlet.jsp.tagext. *; import java.lang.reflect. *;

public class GetProperty extends TagSupport {private String name; // get the class name private String property; // property name is private String method; // returns the attribute method name private String result; // final output public void setName (String s ) {This.name = s;} public string getName () {return this.name;} public void setproperty (String Property) {this.property = proty; // convert the attribute name into a method name INT Length = Property.Length (); string temp = proty.substring (0, 1) .touppercase () Property.Substring (1, length); this.method = "get" temp;} public string getproperty ()}} public string getproperty ()} .property;

转载请注明原文地址:https://www.9cbs.com/read-7571.html

New Post(0)