Is it possible to create a page scope variable in a jsp 2.0 tag accessible to the parent page?

lets assume we have a sample.jsp page:

<%@ taglib prefix="custom" tagdir="/WEB-INF/tags" %>
...
<custom:do var="foo"/>
...

      

Is it possible to generate a variable named 'foo' in do.tag that will be visible on our sample.jsp page? page area variable?

+2


source to share


1 answer


so yes it is possible;)

<%@ attribute name="var" required="true" rtexprvalue="false" %>
<%@ variable name-from-attribute="var" alias="mirror" scope="AT_END" %>

<c:set var="mirror" value="works"/>

      



but this attribute cannot be optional: (if you want to do some kind of conditional assignment (for example: if var exists - assign something to it, if not - show something) this is not possible

more details: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPTags5.html#wp89909

+2


source







All Articles