Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Generate value for f:selectItems in bean

977907May 28 2013 — edited May 30 2013
Hello, i use Jdev 10g

values for f:selectItems in bean i'm get from DB and set to list
             list = new ArrayList<SelectItem>();
      
                ViewObject vo = am.findViewObject("CountryView");
                while (vo.hasNext()) {
                    CountryViewRowImpl row = (CountryViewRowImpl)vo.next();
                    SelectItem item = new SelectItem();
                    item.setValue(row.getCountryCode().stringValue());
                    item.setLabel(row.getCountryName());
                    list.add(item);
                }
<af:iterator value="#{informClient_bean.fields}" var="row"
                               rows="40">
                    <af:switcher id="sw1" facetName="#{row.type}"
                                 defaultFacet="Text">
                    
                      <f:facet name="9">
                        <af:selectOneChoice value="#{row.value}"
                                            requiredMessageDetail="обязательное поле не заполнено"
                                            autoSubmit="#{row.autoSubmit}"
                                            immediate="#{row.immediate}"
                                            label="#{row.label}"
                                             required="#{row.requared}"
                                            readOnly="#{row.readOnly}"
                                            onmouseup="validMask();"
                                            shortDesc="#{row.shortDesc}">
                                            
                          <f:selectItems value="#{row.list}"/>
                        </af:selectOneChoice>
                      </f:facet>
                  </af:switcher>
                  </af:iterator>
when working with a form, select a value from the code we get the selected value .... but sometimes (for example, if the field is read-only true) then the selected value is not the same.

value label
1 a
4 b
5 c

If I choose "b" when working on the shape of the code will be 4
if I open the form and read only true in the bean I get a code 1 and the value of "a"

Comments

977907
solved the problem as follows
list = new ArrayList<SelectItem>();
       IdentityCardTypeViewImpl vo = (IdentityCardTypeViewImpl)am.findViewObject("IdentityCardTypeView");
                vo.executeQuery();
                Row[] icTypes = vo.getAllRowsArray();
                for(int i=0; i<icTypes.length; i++) {
                    IdentityCardTypeViewRowImpl row = (IdentityCardTypeViewRowImpl)icTypes;
SelectItem item = new SelectItem();
item.setValue(row.getIdentityCardTypeId().stringValue());
item.setLabel(row.getIctShortName());
list.add(item);
}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
1 - 1
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 27 2013
Added on May 28 2013
1 comment
233 views