aspose file tools*
The moose likes JSF and the fly likes <h:selectOneMenu> issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "<h:selectOneMenu> issue" Watch "<h:selectOneMenu> issue" New topic
Author

<h:selectOneMenu> issue

Naresh Gunda
Ranch Hand

Joined: Oct 15, 2005
Posts: 163
I am getting exception, while retrieving the selected value of '<h:selectOneMenu>' with 'onchange' event. can you please tell me what is wrong with this code?

code in xhtml page:


code in flow:

Exception received:

I would like to pass the value of selected value 'selectOne' as the actionParam value to the flow.

Can you please tell me what is wrong with the EL expression?
Vaibhav Mittal
Greenhorn

Joined: Jun 11, 2008
Posts: 23
<f:param name="state" value="#{document.getElementById('myForm.state').value}" /> I think it should be myform.states because the id for the select menu is states not state.


"Life is good"
Naresh Gunda
Ranch Hand

Joined: Oct 15, 2005
Posts: 163
sorry! I have corrected the typo.


still I am getting ELException.

Vaibhav Mittal
Greenhorn

Joined: Jun 11, 2008
Posts: 23
I do not think you can pass a javascript function in a value expression. The value tag expects EL expression. You do not need to pass any parameter. You can retrieve the value by calling the getState as the new value for the state would already have been set. So just skip the whole line
<f:param name="state" value="#{document.getElementById('myForm.state').value}" />
and use getState() where ever you need the state selected. It should work.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15632
    
  15

Vaibhav is correct. EL value expressions must refer to server-based objects, and JavaScript works on client-based objects.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: <h:selectOneMenu> issue
 
Similar Threads
Dynamically Allocate Array lists to options in a dropdown for struts JSP
Can not Populate the form on combo box change
Doubt in ajax4jsf
ValueChangeListener question
DataTable inside a DataTable