<f:selectItem>
के लिए <h:selectOneMenu>
के लिए डिफ़ॉल्ट चयन कैसे करें?<f: selectItem> के लिए डिफ़ॉल्ट चयन <h: selectOneMenu>
इसकी आवश्यकता है, पेज लोड होने पर ड्रॉपडाउन के विशेष "20" आइटम को पहले ही चुना जा सकता है।
<h:selectOneMenu value="#{fileSearchCriteriaOut.recordsPerPage}" >
<f:selectItem itemLabel="5" itemValue="5" />
<f:selectItem itemLabel="10" itemValue="10" />
<f:selectItem itemLabel="20" itemValue="20" selected="true"/>
</h:selectOneMenu>
इन चार काम नहीं करते:
<f:selectItem itemLabel="20" selected="true"/>
<f:selectItem itemLabel="20" selected="selected"/>
<f:selectItem itemLabel="20" checked="checked"/>
<f:selectItem itemLabel="20" checked="true"/>
आईएमएचओ, मुझे लगता है कि आपको selectItems में एक आइटम वैल्यू विशेषता चाहिए? –
ऐसा लगता है कि मुझे आपकी बात नहीं दिखाई दे रही है), मैंने डिफ़ॉल्ट चयनित कॉम्बो आइटम का उल्लेख किया था जब .xhtml लोड – sergionni
[वहां] (http://myfaces.apache.org/core11/myfaces-impl/tlddoc/f/selectItem.html) ऐसी विशेषता नहीं है, आपको रीड्रेड की आवश्यकता है जो मैंने उत्तर दिया है –