[jboss-user] [JBoss Seam] - Re: <s:validateAll> and

vladimir.kovalyuk do-not-reply at jboss.com
Fri Jan 19 07:47:26 EST 2007


I fixed some lines in that class got NPE.
I realized that validate() takes script component tag parameters instead of evaluated expression. I debugged a lot JSF RI 1.2 and EL and realized that EL defers evaluation. Thus by calling valueBinding.getExpressionString() in ModelValidator.validate() Seam obtains just expression as it looks like but not as it should be evaluated.
I don't see a workaround. I commented <s:validateAll> and now all works fine except hibernate validators. But I love this feature in Seam and will count on it in the future.

Some excerpts from my code:
source tag:<ui:composition>
  | 
  | 	<c:if test="#{empty id}">
  | 		<c:set var="id" value="#{name}"/>
  | 	</c:if>
  | 	
  | 	<c:if test="#{empty readonly}">
  | 		<c:set var="readonly" value="#{details.readonly}"/>
  | 	</c:if>
  | 	
  | 	<!-- detect type of editor -->
  | 	<c:if test="#{empty editor}">
  | 		<c:set var="editor" value="#{my:detectEditor(object, name)}"/>
  | 	</c:if>
  | 	
  | 	<!-- insert controls -->
  | 	
  | 	<c:if test="#{editor == 'text'}">
  | 		<h:inputText id="#{id}" value="${object[name]}" readonly="#{readonly}">
  | 			<ui:insert/>
  | 		</h:inputText>
  | 	</c:if>
  | 	
  | 	<c:if test="#{editor == 'textarea'}">
  | 		<h:inputTextarea id="#{id}" value="#{object[name]}" readonly="#{readonly}">
  | 			<ui:insert/>
  | 		</h:inputTextarea>
  | 	</c:if>
  | 	
  | 	<c:if test="#{editor == 'selectBooleanCheckbox'}">
  | 		<h:selectBooleanCheckbox id="#{id}" value="#{object.name}" readonly="#{readonly}">
  | 			<ui:insert/>
  | 		</h:selectBooleanCheckbox>
  | 	</c:if>
  | 	
  | </ui:composition>
how tag is used:
<s:decorate>
  | <my:property object="#{details.object}" name="name"/>
  | </s:decorate>
  | 

As the result expression string is "object[name]". But facelets calculates it as #{details.object.name}
NPE is due to the fact that there is no "object" in searchable contexts.

Please give me an advice how to work around this problem.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4003803#4003803

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4003803



More information about the jboss-user mailing list