You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by James Reynolds <Ja...@ihc.com> on 2005/10/13 22:31:23 UTC

Bewildered by JSCookMenu

I would love to use the JSCookMenu, but I'm apparently too dumb to make
it work.  I started out with these steps:

1. Grabbed the latest nightly build.
2. Set up a menu file with the component using a standard theme.
3. Included the menu file in my page via <jsp:include>.

The page loads fine, but the menu is not visible.  Viewing the page
source reveals the JavaScript, but the browser throws a "cmDraw is not
defined" error.

After browsing the archives, I found mentions of the <filter> and
<filter-mapping> entries for an Extensions Filter in my web.xml, so I
copied those portions verbatim from the "simple.war" web app.

When I run the app, I get a "page not found" error.  The only thing I've
noticed out of the ordinary in the console output is "FINE: Found no URL
patterns mapping to FacesServlet"

I'm wondering if the filter mapping of: /faces/* is conflicting with my
servlet mapping of the same.

Has anyone beaten their head on this wall before?

Thanks,

JR


Re: Bewildered by JSCookMenu

Posted by Simon Kitching <sk...@obsidium.com>.
James Reynolds wrote:
> I would love to use the JSCookMenu, but I'm apparently too dumb to make
> it work.  I started out with these steps:
> 
> 1. Grabbed the latest nightly build.
> 2. Set up a menu file with the component using a standard theme.
> 3. Included the menu file in my page via <jsp:include>.
> 
> The page loads fine, but the menu is not visible.  Viewing the page
> source reveals the JavaScript, but the browser throws a "cmDraw is not
> defined" error.
> 
> After browsing the archives, I found mentions of the <filter> and
> <filter-mapping> entries for an Extensions Filter in my web.xml, so I
> copied those portions verbatim from the "simple.war" web app.
> 
> When I run the app, I get a "page not found" error.  The only thing I've
> noticed out of the ordinary in the console output is "FINE: Found no URL
> patterns mapping to FacesServlet"
> 
> I'm wondering if the filter mapping of: /faces/* is conflicting with my
> servlet mapping of the same.

You might find this link useful:
   http://myfaces.apache.org/tomahawk/extensionsFilter.html

What you want is for a request to come into the servlet engine, go 
through the Extensions Filter (which sets up a fake response object), 
then go to the faces servlet. When the jsp page gets processed the 
jscookMenu tag stores some "requests" to generate <script> tags into 
page-scope fields in the servlet-request. When the faces servlet 
finishes the Extensions Filter post-processes the response by inserting 
the requested script tags into the response just before the </head> tag.

So what you see is exactly what would be expected if you hadn't set up 
the servlet or filter mappings correctly.

Note that filters and servlets can happily be mapped to the same URL 
patterns (in fact, that's the whole point).

I hope this helps.

Regards,

Simon