You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Kostas Karadamoglou <ka...@yahoo.gr> on 2005/03/09 21:48:49 UTC

Problems with selectItems and inputCalendar tags

Hello again!!!
I started creating some jsp files with jsf and I have some problems with 
the <f:selectItems> and the javascript pop up calendar (I click the 
"..." button but I cannot see the pop up. Although, I can see it in the 
myfaces example ) when I request the search.jsp file I get this 
Exception from Tomcat:
Do you know the cause of the exception? (When I remove the selectItems 
tag I dont get the exception)

*exception*

javax.servlet.ServletException: Expression: '#{eventHandler.categories}'
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:125)
	org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)

*root cause*

javax.faces.FacesException: Expression: '#{eventHandler.categories}'
	org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:411)
	org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:277)
	org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300)
	javax.faces.webapp.FacesServlet.service(FacesServlet.java:110)
	org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)

Below I have put the code of the search.jsp file and the method that creates the problem:

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/extensions" prefix="x"%>

<f:view>

    <h:form id="form">
        <x:inputCalendar id="date" value="#{eventHandler.selectedDate}" renderAsPopup="true"
                    popupTodayString="Today String" popupWeekString="Week String" />
           
        <h:selectOneMenu id="category" value="#{eventHandler.selectedCategory}">
           <f:selectItems id="items" value="#{eventHandler.categories}" />
        </h:selectOneMenu>
        
        <h:commandButton id="submit" title="Submit" action="succes"/>
    </h:form>
</f:view>

The method:

    public List getCategories(){
        ArrayList retValue=new ArrayList();
        SelectItem select=new SelectItem(null,"Horror");
        retValue.add(select);
        select=new SelectItem(new Boolean(true),"Comedy");
        retValue.add(select);
        select=new SelectItem(new Boolean(true),"Drama");
        retValue.add(select);
        select=new SelectItem(new Boolean(true),"Opera");
        retValue.add(select);        
        return retValue;
    }

Thank you in advance, Kostas




Re: Problems with selectItems and inputCalendar tags

Posted by Kostas Karadamoglou <ka...@yahoo.gr>.
Sorry about the format of my previous message,I resent it  again

I started creating some jsp files with jsf and I have some problems with 
the <f:selectItems> and the javascript pop up calendar (I click the 
"..." button but I cannot see the pop up. Although, I can see it in the 
myfaces example ) when I request the search.jsp file I get this 
Exception from Tomcat:
Do you know the cause of the exception? (When I remove the selectItems 
tag I dont get the exception)

//-----------------------------------------------------------------------------------------------------------------
exception

javax.servlet.ServletException: Expression: '#{eventHandler.categories}'
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:125)
    
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)

root cause

javax.faces.FacesException: Expression: '#{eventHandler.categories}'
    
org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:411)
    
org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:277)
    
org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:300)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:110)
    
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)

//-----------------------------------------------------------------------------------------------------------------
Below I have put the code of the search.jsp file and the method that 
creates the problem:

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/extensions" prefix="x"%>

<f:view>

    <h:form id="form">
        <x:inputCalendar id="date" value="#{eventHandler.selectedDate}" 
renderAsPopup="true"
                    popupTodayString="Today String" 
popupWeekString="Week String" />
          
        <h:selectOneMenu id="category" 
value="#{eventHandler.selectedCategory}">
           <f:selectItems id="items" value="#{eventHandler.categories}" />
        </h:selectOneMenu>
       
        <h:commandButton id="submit" title="Submit" action="succes"/>
    </h:form>
</f:view>
//-----------------------------------------------------------------------------------------------------------------
The method:

    public List getCategories(){
        ArrayList retValue=new ArrayList();
        SelectItem select=new SelectItem(null,"Horror");
        retValue.add(select);
        select=new SelectItem(new Boolean(true),"Comedy");
        retValue.add(select);
        select=new SelectItem(new Boolean(true),"Drama");
        retValue.add(select);
        select=new SelectItem(new Boolean(true),"Opera");
        retValue.add(select);       
        return retValue;
    }

Thank you in advance, Kostas