EJB & JSP: Java On The Edge, Unlimited Edition by Lou Marco ISBN: 0764548026 Your Guide to Cutting-Edge J2EE Programming Techniques. Writing an Example Nested Tag Although the formatLine and repeatLine tags in the previous section were shown to execute when nested, the tags can execute independently of each other. In other words, the presence or absence of one tag has no effect on the execution of the other. At times, one tag requires a specific parent to execute, or a parent requires specific children. In JSP terms, parent/child tags that depend on one another for proper execution are called nested tags. Writing nested tags is very similar to writing the sort of tags you ve already learned. The difference is that the objects (beans) in the nested tags need to communicate. The tag library interfaces have methods that enable a child tag to determine its parent. Once done, you can invoke parent tag methods from the child tag. The following sections describe how to construct a case construct as a series of nested tags. The general format is as follows: JSP to evaluate when some_value = case_value1 JSP to evaluate when some_value = case_value2 <%-- Other casevalue tags may follow --%> JSP to evaluate when some_value not equals case_values The relationships you need to enforce are as follows: . A when tag must be enclosed within a case tag. The code has to know about the existence of a case tag (parent) when processing the when tag (child). . An otherwise tag must be enclosed within a case tag. The code has to know about the existence of a case tag (parent) when processing the otherwise tag (child). . The existence of an otherwise tag requires the existence of at least one when tag. The code has to know about the existence of a past-processed when tag when processing the otherwise tag. Of course, you may want to implement the common understanding of a case construct. The case Statement Tag The case statement tag is the first tag that we’ll examine in looking at the implementation of these nested tags. This tag is
Adult web hosting has rich experience in providing unique solutions for the customer’s needs, just check frontpage web hosting services.

Leave a Reply