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/10 09:28:49 UTC

and dont work

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: and dont work

Posted by Tim Pyle <tp...@portiva.com>.
may also try adding these lines so that the page knows where to get the
javascript from....
		<link rel="stylesheet" href="/jscalendar/jscalendar-WH/theme.css"
type="text/css"/>
		<link rel="stylesheet" href="/jscalendar/jscalendar-DB/theme.css"
type="text/css"/>
		<script language="JavaScript" src="/jscalendar/popcalendar.js"
type="text/javascript"></script>

Tim


On Thu, 2005-03-10 at 14:56, Kostas Karadamoglou wrote:
> Thank you Tim very much !!!!! It works now .but why the selectItems tag 
> doesn't  let null values in the as parameters? Isn't strage?
> 
> By the way any idea about the javascript calendar? It renders the  [...] 
> button but when the use clicks on it doen;t pop up the javascript calendar.
> In Internet Explorer when I click it, it gives me an error message in 
> the status bar.
> 
> Thank you, thank you thank you!!!!


Re: and dont work

Posted by Kostas Karadamoglou <ka...@yahoo.gr>.
Tim Pyle wrote:

>I also had this problem, but mine was due to me having an onLoad() in my
>page <body> already.  Removed this and the javascript worked fine worked
>fine. Just curious, does the calendar work if you have
>renderAsPopup="false"
>
>Tim
>
>2005-03-10 at 14:56, Kostas Karadamoglou wrote:
>  
>
>>Thank you Tim very much !!!!! It works now .but why the selectItems tag 
>>doesn't  let null values in the as parameters? Isn't strage?
>>
>>By the way any idea about the javascript calendar? It renders the  [...] 
>>button but when the use clicks on it doen;t pop up the javascript calendar.
>>In Internet Explorer when I click it, it gives me an error message in 
>>the status bar.
>>
>>Thank you, thank you thank you!!!!
>>    
>>
>
>
>  
>
Yes it works with value false!

Re: and dont work

Posted by Tim Pyle <tp...@portiva.com>.
I also had this problem, but mine was due to me having an onLoad() in my
page <body> already.  Removed this and the javascript worked fine worked
fine. Just curious, does the calendar work if you have
renderAsPopup="false"

Tim

2005-03-10 at 14:56, Kostas Karadamoglou wrote:
> Thank you Tim very much !!!!! It works now .but why the selectItems tag 
> doesn't  let null values in the as parameters? Isn't strage?
> 
> By the way any idea about the javascript calendar? It renders the  [...] 
> button but when the use clicks on it doen;t pop up the javascript calendar.
> In Internet Explorer when I click it, it gives me an error message in 
> the status bar.
> 
> Thank you, thank you thank you!!!!


Re: and dont work

Posted by Kostas Karadamoglou <ka...@yahoo.gr>.
Thank you Tim very much !!!!! It works now .but why the selectItems tag 
doesn't  let null values in the as parameters? Isn't strage?

By the way any idea about the javascript calendar? It renders the  [...] 
button but when the use clicks on it doen;t pop up the javascript calendar.
In Internet Explorer when I click it, it gives me an error message in 
the status bar.

Thank you, thank you thank you!!!!

Re: and dont work

Posted by Tim Pyle <tp...@portiva.com>.
May try 

replaceing SelectItem select=new SelectItem(null,"Horror");
with SelectItem select=new SelectItem("","Horror");

Apparently Selectitem doesn't like null.
Tim Pyle

On Thu, 2005-03-10 at 13:47, Kostas Karadamoglou wrote:
> Can anyone solve my problem? It is not so difficult! may be I 
> misconceive a basic rule.
> 
> Can you run the following code correctly?
> 
> <%@ 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: and dont work

Posted by Kostas Karadamoglou <ka...@yahoo.gr>.
Martin I don't know which filders I have to add in the web.xml files. 
Here is the content of my web.xml
Can you tell me which one I have to add.

Thank you in advance, kostas.
//----------------------------------------------------------------------------------------------------------------- 

                               WEB.XML
//----------------------------------------------------------------------------------------------------------------- 

<?xml version="1.0"?>

<!DOCTYPE web-app PUBLIC
  "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
  "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

    <!-- This web.xml can be used during debugging, when there is no 
myfaces.jar
        library available.

        The faces-config.xml file (that is normally in the myfaces.jar) 
must be
        copied to the /WEB-INF directory of the web context.

        The TLDs (that are normally in the myfaces.jar) must be
        copied to the /WEB-INF/lib directory of the web context.-->


    <context-param>
        <param-name>javax.faces.CONFIG_FILES</param-name>
        <param-value>
            /WEB-INF/faces-config.xml
        </param-value>
        <description>
            Comma separated list of URIs of (additional) faces config files.
            (e.g. /WEB-INF/my-config.xml)
            See JSF 1.0 PRD2, 10.3.2
        </description>
    </context-param>

    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>client</param-value>
        <description>
            State saving method: "client" or "server" (= default)
            See JSF Specification 2.5.2
        </description>
    </context-param>

    <context-param>
        <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
        <param-value>true</param-value>
        <description>
            This parameter tells MyFaces if javascript code should be 
allowed in the
            rendered HTML output.
            If javascript is allowed, command_link anchors will have 
javascript code
            that submits the corresponding form.
            If javascript is not allowed, the state saving info and 
nested parameters
            will be added as url parameters.
            Default: "true"
        </description>
    </context-param>

    <context-param>
        <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
        <param-value>true</param-value>
        <description>
            If true, rendered HTML code will be formatted, so that it is 
"human readable".
            i.e. additional line separators and whitespace will be 
written, that do not
            influence the HTML code.
            Default: "true"
        </description>
    </context-param>

    <!-- Listener, that does all the startup work (configuration, init). -->
    <listener>
        
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
    </listener>

    <!-- Faces Servlet -->
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>

    <!-- Welcome files -->
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

</web-app>

Martin Marinschek wrote:

>The javascript calendar is a component that has some basic flaws in
>the javascript itself - and we can't use any of the other available
>javascript source bases due to the restrictive license.
>
>I still wonder why it wouldn't work in your case, though - have you
>set up the extensions filter in your web.xml (like in the examples
>webapp)?
>
>regards,
>
>Martin
>  
>

Re: and dont work

Posted by Martin Marinschek <ma...@gmail.com>.
The javascript calendar is a component that has some basic flaws in
the javascript itself - and we can't use any of the other available
javascript source bases due to the restrictive license.

I still wonder why it wouldn't work in your case, though - have you
set up the extensions filter in your web.xml (like in the examples
webapp)?

regards,

Martin


On Thu, 10 Mar 2005 22:36:22 +0100, Slawek <ss...@o2.pl> wrote:
> so You cant see popup...
> do You have any JS error?
> 
> x:inpuCallendar kick balls when we conside graphic but
> i had strange experience with that component...
> generally it renders ok, but sometimes it causes JS erros in firefox
> (opera and exploder - ok)
> ...somme callendarBar stuff inst defined or something
> and it hasnt basic JS events so i give up using it:/
> 
> my advice: find something insted of (on monday i can send u callendar that
> we are using right now)
> 
> Slawek
> 
> <ka...@yahoo.gr> napisał:
> 
> > Can anyone solve my problem? It is not so difficult! may be I
> > misconceive a basic rule.
> >
> > Can you run the following code correctly?
> >
> > <%@ 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: and dont work

Posted by Slawek <ss...@o2.pl>.
so You cant see popup...
do You have any JS error?

x:inpuCallendar kick balls when we conside graphic but
i had strange experience with that component...
generally it renders ok, but sometimes it causes JS erros in firefox 
(opera and exploder - ok)
...somme callendarBar stuff inst defined or something
and it hasnt basic JS events so i give up using it:/

my advice: find something insted of (on monday i can send u callendar that 
we are using right now)


Slawek

<ka...@yahoo.gr> napisał:

> Can anyone solve my problem? It is not so difficult! may be I 
> misconceive a basic rule.
>
> Can you run the following code correctly?
>
> <%@ 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: and dont work

Posted by Kostas Karadamoglou <ka...@yahoo.gr>.
Can anyone solve my problem? It is not so difficult! may be I 
misconceive a basic rule.

Can you run the following code correctly?

<%@ 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: and dont work

Posted by Kostas Karadamoglou <ka...@yahoo.gr>.
steve rock wrote:

>Is your eventHandler bean registered as a managed bean in faces-config.xml?
>-Steve
>
>
>
>On Thu, 10 Mar 2005 17:40:10 +0000, Kostas Karadamoglou
><ka...@yahoo.gr> wrote:
>  
>
>>Does anyone know what's the problem? I really need your help because I
>>stucked to this error and I cannot solve it!!! :-(
>>
>>    
>>
>
>  
>
Of course, If I delete the <f:selectItems> tag, the page works fine and 
the eventHandler.selectedDate (which is used above the selectItems) 
works!!!!!

anyway, thanks for your attention!!!

Re: and dont work

Posted by steve rock <st...@gmail.com>.
Is your eventHandler bean registered as a managed bean in faces-config.xml?
-Steve



On Thu, 10 Mar 2005 17:40:10 +0000, Kostas Karadamoglou
<ka...@yahoo.gr> wrote:
> Does anyone know what's the problem? I really need your help because I
> stucked to this error and I cannot solve it!!! :-(
>

Re: and dont work

Posted by Kostas Karadamoglou <ka...@yahoo.gr>.
Does anyone know what's the problem? I really need your help because I 
stucked to this error and I cannot solve it!!! :-(