Created
July 26, 2011 12:33
-
-
Save agentgt/1106650 to your computer and use it in GitHub Desktop.
Conditionally set attribute in JSPX element.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" | |
xmlns:c="http://java.sun.com/jsp/jstl/core"> | |
<jsp:output omit-xml-declaration="yes"/> | |
<jsp:directive.attribute name="name" type="java.lang.String" required="true" rtexprvalue="true" description="Name"/> | |
<jsp:directive.attribute name="value" type="java.lang.String" required="true" rtexprvalue="true" description="Value"/> | |
<jsp:scriptlet> | |
//<![CDATA[ | |
String name = (String) jspContext.getAttribute("name"); | |
String value = (String) jspContext.getAttribute("value"); | |
out.write(" " + name + "=" + "\"" + value + "\""); | |
//]]> | |
</jsp:scriptlet> | |
</jsp:root> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" | |
xmlns:spring="http://www.springframework.org/tags" | |
xmlns:c="http://java.sun.com/jsp/jstl/core"> | |
<jsp:output omit-xml-declaration="yes"/> | |
<jsp:directive.attribute name="name" type="java.lang.String" required="true" rtexprvalue="true" description="Name"/> | |
<jsp:scriptlet> | |
//<![CDATA[ | |
String name = (String) jspContext.getAttribute("name"); | |
if (name != null) { | |
out.write("</" + name + ">"); | |
} | |
//]]> | |
</jsp:scriptlet> | |
</jsp:root> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" | |
xmlns:c="http://java.sun.com/jsp/jstl/core"> | |
<jsp:output omit-xml-declaration="yes"/> | |
<jsp:directive.attribute name="name" type="java.lang.String" required="true" rtexprvalue="true" description="Name"/> | |
<jsp:scriptlet> | |
//<![CDATA[ | |
String name = (String) jspContext.getAttribute("name"); | |
out.write("<" + name); | |
//]]> | |
</jsp:scriptlet> | |
<jsp:doBody /> | |
<jsp:scriptlet> | |
//<![CDATA[ | |
out.write(">"); | |
//]]> | |
</jsp:scriptlet> | |
</jsp:root> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" | |
xmlns:c="http://java.sun.com/jsp/jstl/core" | |
xmlns:help="urn:jsptagdir:/WEB-INF/tags/help"> | |
<jsp:output omit-xml-declaration="yes"/> | |
<spring:url var="baseUrl" value="/" /> | |
<help:element-start name="div"> | |
<c:if test="${device.html5 }"> | |
<help:attribute name="data-position" value="fixed" /> | |
</c:if> | |
<help:attribute name="data-role" value="header" /> | |
</help:element-start> | |
Some stuff here and tags here... | |
<help:element-end name="div" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Stick all the tagx files into the /WEB-INF/tags/help directory.
Then see example.jspx.