-
1. Re:
damianharvey Jul 23, 2007 4:28 AM (in response to raviies)when you change the value of your dropdown the onchange event launches and does 2 things:
1. Updates the value of dataTransferScheme in the loginBean
2. Calls the setAuthFields method in the loginBean.
The way you have it, you are trying to pass the updated value of dataTransferScheme into #2 when the page doesn't yet have this value.
Try changing your setAuthFields method to have no parameters and instead use the value of dataTransferScheme that has been applied.public void setAuthFields() { System.out.println("dataTransferScheme : "+this.dataTransferScheme); }
Also you may want to get rid of immediate=true. I can't recall if this stuffs up the application of values to the Bean (although I think that it bypassUpdates).
Cheers,
Damian. -
2. Re:
raviies Jul 23, 2007 3:05 PM (in response to raviies)Thanks Damian
I did exactly as you suggested but result is same:
"dataTransferScheme : null"
The value is being set to null. Any suggestions?
TIA
Ravi -
3. Re:
smithbstl Jul 23, 2007 3:53 PM (in response to raviies)I don't understand where the value for dataTransferScheme is supposed to come from.
Typically you should be using a s:selectItems/f:selectItem/f:selectItems to get a list of values for your menu. Then menu then chooses one and passes that value to your backing bean.<f:view> <s:validateAll> <h:form> <h:panelGrid columns="2"> ..... SRB DataTransferScheme * <h:selectOneMenu id="dataTransferCombobox" value="#{loginBean.dataTransferScheme}" <a4j:support event="onchange" action="#{loginBean.setAuthFields(scheme)}" ajaxSingle="true" immediate="true"/> <s:selectItems label="#{scheme}" value="#{schemes}" var="scheme"/> </h:selectOneMenu> </h:panelGrid> ..... <h:commandButton value="Login" action="#{login.login}"/> </s:validateAll> </h:form> //LoginBean.java: [the Backing bean] //system.out.println is ugly, use Seam's logger support @Logger Log log; @Out private List<String> schemes; @Factory("schemes") public void fillSchemes() { //Fill your list here } public void setAuthFields(String dataTransferScheme) { log.info("dataTransferScheme : "+dataTransferScheme); }
-
4. Re:
raviies Jul 23, 2007 6:28 PM (in response to raviies)Thanks smithbstl:
I don't understand where the value for dataTransferScheme is supposed to come from.
My Login Bean has following getter to fill up the comboBox and it works alright:public List<String> getAvailableDataTransferSchemes() { List<String> result = new ArrayList<String>(); for(int i=0; i<dataTransferSchemeArray.length; i++) result.add(dataTransferSchemeArray); return result; }
Coming to the original problem I'm getting dataTransferScheme = "" in my backingBean. Am I missing something obvious?
TIA
RAVI -
5. Re:
raviies Jul 23, 2007 6:47 PM (in response to raviies)Excuse me for not describing my setup earlier:
1> Tomcat 6.0
2> Embedded Jboss: embedded-jboss-beta2
3> JDK 1.5.0_12-b04
4> Interestingly my page source has action empty :<a4j:support event="onchange" action="" ajaxSingle="true"></a4j:support> <select id="j_id2:dataTransferCombobox" name="j_id2:dataTransferCombobox" size="1"> <option value="PLAIN_TEXT">PLAIN_TEXT</option> <option value="SRB_ENCRYPT" selected="selected">SRB_ENCRYPT</option> <option value="KERBEROS_INTEGRITY">KERBEROS_INTEGRITY</option>
TIA
RAVI -
6. Re:
smithbstl Jul 23, 2007 6:51 PM (in response to raviies)perhaps removing the "set" from setAuthFields since EL may be confused because this conforms to javabeans syntax
try thisaction="#{loginBean.authFields(....)"
or rename your setAuthFields method to something without get or set