This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes ui:decorate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "ui:decorate" Watch "ui:decorate" New topic
Author

ui:decorate

greeshma silam
Greenhorn

Joined: Jul 13, 2011
Posts: 14
Hello All,

I am writing a template for form elements and using it in my form so that I can directly pass the label name and form field element instead of repeating required field note and other styles that are common to most fields. But as our web application has to be 508 compliant I have to have a 'for' attribute for label and I am stuck to define 'for' value for each label. Please find the code below:

template code:
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets">
<div class="up">
<label class="label">
<span class="required">*</span><ui:insert name="label"/>
</label>
<span class="width"><ui:insert /></span>
</div>
</ui:composition>

jsf page
<fieldset>
<legend>Enter Credentials</legend>
<ui:decorate template="/templates/fieldProperty.xhtml">
<ui:define name="label">Name:</ui:define>
<h:inputText value="" id="name"/>
</ui:decorate>
<ui:decorate template="/templates/property.xhtml">
<ui:define name="label">Password</ui:define>
<h:inputText value="" id="password"/>
</ui:decorate>
<div class="button-div">
<h:commandButton value="Login" action="welcome" />
</div>
</fieldset>

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: ui:decorate
 
Similar Threads
JSF 2.0 Login
JEE example with EJB, JSF is not working
problem on saving inputText values
Again javax.el.PropertyNotFoundException
SEAM s:decorate template attribute?