facebook

Evaluating a selectOne menu

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #221341 Reply

    bradm
    Member

    I have a string variable (sqlQuery) whose value I want to change based upon the selection made in a dropdown control (a selectone menu, whose selected item is wired to the searchType property). The menu is like so:

    <h:selectOneMenu value=”#{BarChartSelectionsBean.searchType}” >
    <f:selectItems value=”#{BarChartSelectionsBean.searchTypeItems}” />
    </h:selectOneMenu>

    In the managed bean, I have the following code that is supposed to evaluate searchType, and set and get a particular string for sqlQuery based upon the searchType selection. It always returns a null pointer exception (even though I know the searchType variable is resolving, as I’m printing it out to the browser):

    public void setSqlQuery()
    {
    if (this.searchType.equals(“consumption”))
    {
    sqlQuery = “this”;
    }
    else
    {
    sqlQuery = “that”;
    }
    }

    public String getSqlQuery()
    {
    return sqlQuery;
    }

    I’m baffled. How do I go about modifying the value of the sqlQuery variable based upon the searchType selection made by the user?

    #221435 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev, this is not an ME issue but a JSF question.

    brad to get a more effective answer we likely need to see the code for the entire form on the JSP page, as well as the bean impl.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Evaluating a selectOne menu

You must be logged in to post in the forum log in