[JBoss Seam] - How to retain selected value in dropdown list...
by DamonChong
First and foremost, thanks for any assistance and advice!
I have created a drop down box as below:
| <h:selectOneMenu id="orgTypeSelect" value="#{addStrainCtrl.organism}" required="true">
| <s:selectItems value="#{organismTypes.resultList}" var="organismType" label="#{organismType.description}" noSelectionLabel="Please Select..." />
| <s:convertEntity />
| </h:selectOneMenu>
|
However, I realise if there is any errors during the processing of the submitted form and the user is re-directed to the same form for a chance to correct their "mistakes", the value they selected in the drop down box is reset to "Please Select...". This behaviour is not happening for input text box using the <h:inputText> tag though.
I cracked my brain for a few days now trying to figure out the missing ingredient...it shouldn't be something extremely difficult, i hope ;-)
Appreciate any help and thanks!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4113349#4113349
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4113349
18 years, 7 months
[JBoss Seam] - How to select item in DataTable populated with @Unwrap?
by mteichmann
I like to use the Seam Manager Component pattern in Seam 2.0.0.GA and provide a list using @Unwrap:
| @Name("holidayRequestByApproverList")
|
| public class HolidayRequestByApproverList {
|
| @Unwrap
| public List<HolidayRequest> getHolidayRequestByApproverList() {
|
| ...
| return myList;
| }
| }
In a datatable I display the list :
<rich:dataTable id="dtHolidayRequestList" var="holidayRequest"
| value="#{holidayRequestByApproverList}"
| rendered="#{not empty holidayRequestByApproverList}">
| ...
| <h:column>
| <f:facet name="header">
| <s:span styleClass="columnHeader">Nr</s:span>
| </f:facet>
| #{holidayRequest.id}
| </h:column>
| <h:column>
| <f:facet name="header">Action</f:facet>
|
| <s:button value="Reject"
| action="#{holidayApprovalAction.reject(holidayRequest)}">
| </s:button>
| </h:column>
But in my action I always get null instead of holidayRequest that I selected in datatable.
@Stateful
| @Name("holidayApprovalAction")
| @Scope(ScopeType.SESSION)
| public class HolidayApprovalActionImpl implements HolidayApprovalAction {
|
| private static final long serialVersionUID = 6068522266849679060L;
|
|
| @PersistenceContext(type = PersistenceContextType.EXTENDED)
| EntityManager entityManager;
|
| @Begin
| public void reject(HolidayRequest hr) {
| ...
| entityManager.persist(hr);
| }
|
I read chapter 30.1 of Seam Reference 2.0.0.GA several times and maybe some limitations occur when using JSF but I also tried using facelets and also got 'null' instead of my selected item.
Also in chapter 30.1.1 it is told in a note that you cannot use objects as arguments therefore I also tried using holidayRequest.id as parameter but then I got 0 instead of the id of the selected item.
I used DataModel and DataModelSelection before but then the displayed data in rich table was not refreshed correctly. Therefore I tried to use Unwrap which works perfectly but now I cannot select an item and paa it to my bean.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4113338#4113338
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4113338
18 years, 7 months