You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Klaus Schuster <sc...@racon-linz.at> on 2009/06/12 15:20:57 UTC

Re: TOMAHAWK< t:inputCalendar java script problem popup


Simon Kitching <sk...@apache.org> schrieb am 01.04.2009 15:37:00:
>Klaus SCHUSTER schrieb:
>> 
>> Simon Kitching <sk...@apache.org> schrieb am 01.04.2009 11:30:36:
>> 
>>> Klaus SCHUSTER schrieb:
>>> >
>>> > Hi,
>>> >
>>> > I am using a t:inputCalendar tag from Tomahawk 1.1.8:
>>> > [code]
>>> > <t:inputCalendar id="mycal"
>>> >  addResources="false"  
>>> >  monthYearRowClass="yearMonthHeader"
>>> >  weekRowClass="weekHeader"  
>>> >  popupButtonStyleClass="standard_bold"
>>> >  currentDayCellClass="currentDayCell"
>>> >  value="#{BB.geburtsdatum}"
>>> >  renderAsPopup="true"
>>> >  popupTodayString="Heute ist der: "  
>>> >  helpText="MM/DD/YYYY">
>>> > </t:inputCalendar>
>>> > <h:outputText value="#{BB.geburtsdatum}" />
>>> > [/code]
>>> >
>>> > geburtsdatum is a DATE in my BB with its getter and setter.
>>> > The t:inputCalendar is embedded in an form.
>>> > When I open the JSF Page with Internet Explorer 6 I get the following
>>> > JavaScript error:
>>> > [code]
>>> > org_apache_myfaces_PopupCalendar() is undefined
>>> > [/code]
>>>
>>> Does this happen with browsers more modern than IE6? That is pretty
>>> old...
>>>
>> I am currently using Internet Explorer 7. It is not possible to use
>> Firefox for my web project.
>> 
>>> The other likely issue is to do with the ExtensionsFilter. Somewhere in
>>> the generated HTML page there should be something that looks roughly
>>> like
>>>
>>> <script
>>> src="/mywebapp/faces/myfacesExtensionResource/123456/inputCalendar.js">
>>> </script>
>>>
>>> This is what loads the javascript that the calendar component needs. But
>>> these urls require you to set up the tomahawk ExtensionsFilter, as
>>> described by this page:
>>>   http://myfaces.apache.org/tomahawk/extensionsFilter.html
>>>
>>> If you use firefox, then the "live http headers" extension will tell you
>>> whether the url loads correctly or not.
>>>
>>> Regards, Simon
>>>
>>> --
>>> -- Emails in "mixed" posting style will be ignored
>>> -- (http://en.wikipedia.org/wiki/Posting_style)
>> 
>> I am already using the extension filter as mentioned at the given link.
>> Here is my web.xml containing all necessary inputs:
>> 
>>    <filter-mapping>
>>         <filter-name>MyFacesExtensionsFilter</filter-name>
>>         <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
>>     </filter-mapping>
>>     <filter-mapping>
>>         <filter-name>MyFacesExtensionsFilter</filter-name>
>>         <url-pattern>*.faces</url-pattern>
>>     </filter-mapping>
>>     <filter-mapping>
>>         <filter-name>MyFacesExtensionsFilter</filter-name>
>>         <servlet-name>Faces Servlet</servlet-name>
>>     </filter-mapping>
>>     <servlet>
>> 
>> I am using *.faces urls therefore is the url-pattern set to this file
>> extension.
>> I only see the following java Script tags in my renederd JSF File:
>> <script type="text/javascript"
>> >src="/mywebapp/faces/myFacesExtensionResource/org.apache.myfaces.renderkit.html.util.MyFacesResour>ceLoader/12385798/inputTextHelp.HtmlTextHelpRenderer/inputTextHelp.js">
>> 
>> 
>> Is it possible to set this required java script js file manually?
>> I am using Websphere Application Server 6.1
>
>As a quick workaround for whatever the problem is, you could certainly
>unpack the tomahawk jarfile, find the right javascript files, and add
>them directly to your project. Then you would need to manually add the
>right <script src=...> tags into any page that uses t:inputCalendar. See
>the end of the email for the list of javascript files needed by the
>inputCalendar in "popup" mode.
>
>However t:inputCalendar definitely works; the app I work on every day
>uses it. There is a small probability that this is something due to the
>servlet engine (I use tomcat, not websphere) or the JSF impl (I use
>mojarra, not myfaces). But I'm pretty sure we would have had many more
>problem reports if this was a common issue.
>
>Are you using Trinidad? I remember seeing some emails in this list about
>problems with ExtensionsFilter and trinidad (the filters need to be
>declared in web.xml in just the right order for them to work).
>
>You say, however, that the html page doesn't have any <script> tag at
>all that is referencing an inputCalendar script. That is odd. You
>mentioned before that you have been experimenting with changing the
>myfaces resources-handling code. Are you sure you didn't leave any of
>your changes in by accident?
>
>Class org.apache.myfaces.custom.calendar.HtmlCalendarRenderer has this:
>  if(inputCalendar.isAddResources())
>      addScriptAndCSSResources(facesContext, inputCalendar);
>
>The inputCalendar.isAddResources method looks ok. You will find just an
>abstract method with annotation on AbstractHtmlInputCalendar; the actual
>component class HtmlInputCalendar is auto-generated. The generated code
>(found in target/myfaces-builder-plugin dir after doing build) has:
>    public boolean isAddResources()
>    {
>        if (_addResourcesSet)
>        {
>            return _addResources;
>        }
>        ValueBinding vb = getValueBinding("addResources");
>        if (vb != null)
>        {
>            return ((Boolean)
>vb.getValue(getFacesContext())).booleanValue();
>        }
>        return true;
>    }
>In other words, it *does* return true by default, so this looks ok.
>
>The addScriptAndCSSResources method does:
>   if(javascriptLocation==null)
>    {
>       addresource.addJavaScriptAtPosition(facesContext,
>AddResource.HEADER_BEGIN, PrototypeResourceLoader.class, "prototype.js");
>       addresource.addJavaScriptAtPosition(facesContext,
>AddResource.HEADER_BEGIN, HtmlCalendarRenderer.class, "date.js");
>       addresource.addJavaScriptAtPosition(facesContext,
>AddResource.HEADER_BEGIN, HtmlCalendarRenderer.class, "popcalendar.js");
>    }
>so you really should be seeing <script> tags for the three files
>"prototype.js", "date.js", "popcalendar.js" in your generated html file.
>
>
>I can't for the moment think why you would not be seeing these. Is there
>something unusual about your setup that you haven't mentioned yet? Eg
>are you using ajax or frames or SiteMesh or something?
>
>Regards,
>Simon
>
>
>
>-- 
>-- Emails in "mixed" posting style will be ignored
>-- (http://en.wikipedia.org/wiki/Posting_style)
>

I found the resolution of my problem. It depends on the Websphere
Application Server 6.1:
Add:“*com.ibm.ws.webcontainer.invokeFiltersCompatibility*” need be set to
*true*!

-- 
View this message in context: http://www.nabble.com/TOMAHAWK%3C-t%3AinputCalendar-java-script-problem-popup-tp22821461p23998716.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.