Mark in Struts

xiaoxiao2021-03-06  107

The core of Struts has a wide range of custom tags that form a concrete implementation of Struts, so it is the key to the ends of these tags. So what is the mark? (Note: Used in Next.jsp: Request.GetParameter "Image", take the value "Image" value, namely: hous.gif) If the above example used the JSP tag is our own definition, then for this tag, there is the following concept: 1. Tag name : Also JSP: Forward, JSP is a prefix, forward is a suffix, and the middle use colon segmentation. 2. The property of the tag: Page is the properties of JSP: Forward. Name, Value is the property of JSP: param. 3. Nested: There is also the tag in , the former is the parent mark, the latter is marked. 4. Body content: The above example has no contents. Now we have such custom tags How can the server know when seeing it? And how does the function it represent? Then you must introduce the following content in the JSP page: <% @ Taglib URI = "/ mytag" prefix = "lsmx"%> It is / mytag defined in the web.xml of the program /web-inf/tlds/mytag.tld This server will find the response from . That is, the marker descriptor. Tag Library Descriptor (TAG Library Descriptor) File: Follow Sun Microsystems' XML Document, which describes a tag library that contains one or more tag extensions. And it maps the tag to the tag processor class, and also defines how the interactive mode between the two. I think it is like Microsoft's COM technology to make customer segments very convenient to find the server. It is a street sign, so that the program is very convenient to find things, the URI = "/ mytag" The MyTag is the name of this tag library descriptor, and prefix = "lsmx" LSMX is a tag prefix, which must have such code in this full-name mytag.tld tag descriptor: Hello TAGEXT.MYTAG JSP Hello is a suffix in JSP. TAGEXT.MYTAG is a tag processor.

Marking processor: A class that implements a specific function of tagging is a JavaBean that extends this class provided by JSP API: javax.servlet.jsp.tagext.tagsupport. We can write this mark on this class on this class. How is this application in Struts? Let's take a login interface commonly used tag 1. There must be such code <% @ Taglib URI = "/ Web-INF / STRUTS-HTML.TLD" prefix = "html"%> 2. Enter Web.xml We found /web-inf/struts-html.tld / web-inf / struts-html .TLD You can see its The path name of the is actually not the case, as long as this URI is in JSP. The URI is the same, but it cannot be the same name with the of this Web.xml folder. 3. Enter /Web-inf/Struts-html.Tld Find Text org.apache.struts.taglib.html.textTag ······· Setting ···· 4. This will find which of the texttag.class that implements this markup. If you are interested, you can use the contact tool to compile it, you can see the source code.

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

New Post(0)