Difference between revisions of "Best Practice/JSF useful tipps etc"
Jump to navigation
Jump to search
m (User:Tschraut/BestPractice JSF etc moved to Best Practice/JSF useful tipps etc: removed as user page) |
m |
||
Line 13: | Line 13: | ||
*** The first element in a trinidad iterator may not be a simple html element like <div>. You will have to use "active" components instead like <h:panelgroup layout="block">. This will generate a <div> element. | *** The first element in a trinidad iterator may not be a simple html element like <div>. You will have to use "active" components instead like <h:panelgroup layout="block">. This will generate a <div> element. | ||
*** if you need the index of the current iterator row you can add the tag "varstatus". Example: <tr:iterator var="component" id="fileUploads" value="#{EasySubmission.files}" binding="#{EasySubmission.fileIterator}" varStatus="index">. Then you can get the current row index by querying like this: <h:outputText value="#{EasySubmission.fileIterator.rowIndex}" />. NOTE: you will have to create a binding with the related baccking bean in the iterator (binding="#{EasySubmission.fileIterator}"). For this you have to add the following to the backing bean: private UIXIterator fileIterator = new UIXIterator(); Don't forget to gererate getters and setters!!! This binding is necessary for the component in the jsp page to get a row index. | *** if you need the index of the current iterator row you can add the tag "varstatus". Example: <tr:iterator var="component" id="fileUploads" value="#{EasySubmission.files}" binding="#{EasySubmission.fileIterator}" varStatus="index">. Then you can get the current row index by querying like this: <h:outputText value="#{EasySubmission.fileIterator.rowIndex}" />. NOTE: you will have to create a binding with the related baccking bean in the iterator (binding="#{EasySubmission.fileIterator}"). For this you have to add the following to the backing bean: private UIXIterator fileIterator = new UIXIterator(); Don't forget to gererate getters and setters!!! This binding is necessary for the component in the jsp page to get a row index. | ||
[[Category:Best_Practice]] |
Revision as of 14:29, 10 November 2008
[edit]
JSF general[edit]
HTML behavior[edit]
Trinidad components[edit]
- Trinidad iterator <tr:iterator>
- you can use html components for output i.e. <h:outputText>
- you can use html components for text input i.e. <h:inputText>
- you should avoid html components for triggering actions in the iterator like add / remove elements. If you notice strange behaviour when performing actions (i.e. ArrayOutOfBoundsExceptions) look for non-Trinidad components in the iterator first
- The first element in a trinidad iterator may not be a simple html element like . You will have to use "active" components instead like <h:panelgroup layout="block">. This will generate aelement.
- if you need the index of the current iterator row you can add the tag "varstatus". Example: <tr:iterator var="component" id="fileUploads" value="#{EasySubmission.files}" binding="#{EasySubmission.fileIterator}" varStatus="index">. Then you can get the current row index by querying like this: <h:outputText value="#{EasySubmission.fileIterator.rowIndex}" />. NOTE: you will have to create a binding with the related baccking bean in the iterator (binding="#{EasySubmission.fileIterator}"). For this you have to add the following to the backing bean: private UIXIterator fileIterator = new UIXIterator(); Don't forget to gererate getters and setters!!! This binding is necessary for the component in the jsp page to get a row index.
- Trinidad iterator <tr:iterator>