Robert Alexandersson wrote:
Hello.
I am using JSP 2.0 tagfiles creating custommtags and want a render
controller.
I want to make a sort of <mytag:render property="module.page.part">
In a controller i create the settingbean parameters.
In the jsp I call the tag file.
In the tagfile I try to evaluate the incoming static string byt this I
can not figure out.
The render attribute contains a string "[EMAIL PROTECTED]@[EMAIL PROTECTED]" but
I can not use this in the test of c:if because it evaluates the string
not the bean-param value behind it. Is it possible to set this value
into a new parameter and getting its real value. I can print it using
bean:write but thats it....
Example CODE:
JSP
<mytag:render property="myapp.person.company">
<fieldset>
<legend>Company</legend>
<inparam > ...
</fieldset>
</mytag:render>
JAVA-CODE
public static void createRender(ServletContext context){
context.setAttribute("[EMAIL PROTECTED]@[EMAIL PROTECTED]", new Boolean(true));
}
TAG-FILE
<%@ tag body-content="scriptless" %>
<%@ attribute name="property" required="true" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<jsp:doBody var="thebody" />
<c:set var="render" value="[EMAIL PROTECTED]:replace(property, '.',
'@')}"></c:set>
<c:if test="${render}">
${thebody}
</c:if>
I'm not sure I fully understand what you're after, but maybe this will
do what you want:
<c:set var="renderExp" value="[EMAIL PROTECTED]:replace(property,
'.','@')}"></c:set>
<c:set var="render" value="${requestScope[renderExp]}"/>
You'll need to change your Java code to store the property in request
scope instead of the servlet context, too.
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]