[jboss-user] [JBoss Seam] - Re: Drop Down Menu Using Seam and Facelets
yj4jboss
do-not-reply at jboss.com
Mon Sep 25 03:05:43 EDT 2006
Hello Denis,
I had declared getModel() in the interface.....I could only get your code to work by doing the following changes:
|
| public Map<String,Object> model = new TreeMap<String,Object>();
|
| // Instead of public Map<String,Object> model;
|
|
|
| public void fillMaps(){
|
| //model = new TreeMap<String,Object>();
|
| model.clear();
| model.put("2004","-1"); // Add 2004 for test element if needed
|
| for (Object o: yearList) {
| String label = o.toString();
| model.put(label, o );
| }
|
|
| }
|
|
|
| public Map<String,Object> getModel(){ // f:selectItems value
| log.debug("Initializing Model");
| log.debug("Model Size = "+model.size());
| getYearList(); // retrieves all years and places it in yearList
| fillMaps();
| return model;
| }
|
My code in my searchbox.xhtml page is as follows:
|
| <h:form>
|
|
| <h:selectOneMenu value="#{companySearch.criterion.year}" converter="#{companySearch.converter}">
| <f:selectItems value="#{companySearch.model}"/>
| </h:selectOneMenu>
|
| <h:commandButton action="#{companySearch.findCompaniesByYearWithFinancialStatements}"
| value="Search Company"
| class="formButton" style="width: 166px;"/>
|
|
| </h:form>
|
|
Though this works by listing All Years in the drop down menu, there are two problems that i face:
(1) value specified in <h:selectOneMenu> is not selected as default
( I tested this with another example)
(2) When submitting the form, the submitted value is returned as null
| 2006-09-25 10:49:01,863 DEBUG [accountingAudit.actions.CompanySearchBean] criterion =null
|
However, if i use a plain <h:inputText> to submit this value, the search is carried out correctly.
Could you please enlighten me on these two issues ....I am using this for a small application and do not want to use custom annotation as long as your code can get me working ;0)
Thnx in advance
Cheers,
Yogesh
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3973804#3973804
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3973804
More information about the jboss-user
mailing list