jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Short <...@benshort.co.uk>
Subject JackRabbit + JSP/JSTL
Date Mon, 23 Nov 2009 11:20:19 GMT
Hi,

I'm investigating the use of jackrabbit for a project I am working on.
Considering the following examples accessing the jcr api in a jsp page is
pretty hard to read compared to the same thing using domain
objects. Admittedly the domain object version uses jstl rather than
scriptlets which IMO leads to cleaner code.

Is there any way to access the jcr api in a jsp file in a cleaner way or via
jstl?

Domain Object

<label for="${field.name}">
${field.labelText} <c:if test="${field.required}"><span
class="required">*</span></c:if>
<input type="text" id="${field.name}" name="${field.name}" size="30"
maxlength="${field.maxLength}" value="${param[field.name]}"/>
</label>


JCR

final String fieldName = fieldNode.getName();

%>
<label
for="<%=fieldName%>"><%=fieldNode.getProperty("label").getString()%><%if
(
fieldNode.getProperty("required").getBoolean() ) {%><span
class="required">*</span><%}%>
     <input type="text" id="<%=fieldName%>" name="<%=fieldName%>" size="30"
maxlength="<%=fieldNode.getProperty("maxLength").getLong()%>"
value="<%=request.getParameter(fieldName)%>"/>
</label>
<%

Regards

Ben Short

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message