I'm doing something similar in my project.
I use a few Facelets TagHandlers based on Rick Hightower's articles
(
http://www.ibm.com/developerworks/java/library/j-facelets2.html). My page looks
something like this:
| <h:panelGrid id="questionPanel" columns="3">
|
| <crs:customQuestions
| registrationType="#{registrationType}"
| questionTextVar="questionText"
| questionNumberVar="i"
| requiredVar="required">
|
|
| <h:outputLabel for="answerInput#{i}" value="#{i}"
id="questionNumber#{i}"/>
|
| <s:formattedText value="#{questionText}"
id="questionText#{i}"/>
|
| <h:panelGroup>
| <s:decorate>
| <f:facet name="aroundInvalidField">
| <s:span styleClass="errors"/>
| </f:facet>
| <crs:isText>
| <h:inputText id="answerInput#{i}"
| value="#{registrationProcess.pageAnswers[i ].valueString}"
| required="#{required}">
| <a:support event="onblur"
reRender="questionErrors#{i}"/>
| <crs:validateQuestion/>
| </h:inputText>
| </crs:isText>
|
| <crs:isDate>
| <h:inputText id="answerInput#{i}"
| value="#{registrationProcess.pageAnswers[i ].valueDate}"
| required="#{required}">
| <crs:validateQuestion/>
| <s:convertDateTime pattern="MM/dd/yyyy"/>
| <a:support event="onblur"
reRender="questionErrors#{i}"/>
| </h:inputText>
| <s:selectDate for="answerInput#{i}">
| <h:graphicImage url="img/dtpick.gif"
style="margin-left:5px"/>
| </s:selectDate>
| </crs:isDate>
|
| <crs:isBoolean>
| <h:selectBooleanCheckbox
| id="answerInput#{i}"
| value="#{registrationProcess.pageAnswers[i ].valueBoolean}"
| required="${required}">
| <crs:validateQuestion/>
| </h:selectBooleanCheckbox>
| </crs:isBoolean>
|
| <br clear="none"/>
| <a:outputPanel id="questionErrors#{i}">
| <s:message/>
| </a:outputPanel>
| </s:decorate>
| </h:panelGroup>
|
| </crs:customQuestions>
| </h:panelGrid>
|
Note that I haven't updated this to use the newer s:decorate methodology, but you get
the idea.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048799#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...