-
1. Re: Bad redirection with tag <error-page> in web.xml
healeyb Jul 12, 2012 9:11 AM (in response to tremal_naik)1 of 1 people found this helpfulYou're using suffix mapping rather than prefix mapping I imagine, i.e.
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
rather than:
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>/pages/*</url-pattern>
</servlet-mapping>
and the FacesServlet confusingly appends the suffix mapping to resources URLs despite the fact that this does
not correspond to the filename.
I imagine you're seeing the facelets development mode error page. You need to find out what's sending the GET
request for jquery.js, presumably it's something in errorPage.xhtml (or a template), do you see a GET for
errorPage.xhmtl in firebug?
One thing that could trigger this behavior is if you used a script tag to load jquery instead of h:outputScript, but
check out what's trying to load jquery first and perhaps post the contents of the errorPage.
I remember having loads of problems with this sort of thing before switching to prefix mapping (which was not a
straightforward exercise involving much changing of css files, filters, resource handlers you name it etc...).
Regards,
Brendan.
-
2. Re: Bad redirection with tag <error-page> in web.xml
tremal_naik Jul 13, 2012 3:35 AM (in response to healeyb)Hi Brendan,
Your reply is very useful. Using the FireBug there's not a GET por errorPage.xhtml but, this page has a template which invoques <h:outputScript name="jquery.js"/>.
And I have
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
<url-pattern>*.jsf</url-pattern>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
I'll try change the web.xml and discover how avoid this annoying suffix. Thanks.
-
3. Re: Bad redirection with tag <error-page> in web.xml
healeyb Jul 13, 2012 5:01 AM (in response to tremal_naik)<h:outputScript name="jquery.js"/> will load the richfaces packaged jquery and I just checked a backup and when I
was using suffix mapping that was all I specified. Is the h:outputScript tag in the h:head section of the template? I also
had this in web.xml:
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name>
<param-value>*.xhtml</param-value>
</context-param>
Presumably the FACELETS_VIEW_MAPPINGS can be a comma separated list (prob described in the Mojarra FAQ).
Using prefix mapping, i.e.
<servlet-mapping>
<servlet-name>FacesServlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
gets rid of the suffix, but does mean that you have a prefix in your URLs which is also a bit annoying. If you front your app server
with Apache you can use mod_rewrite to get rid of it.
Regards,
Brendan.
-
4. Re: Bad redirection with tag <error-page> in web.xml
tremal_naik Jul 13, 2012 8:08 AM (in response to tremal_naik)Hi Brendan,
I was tried your solutions but the problem persists... Maybe the error is elsewhere. I keep trying.
Thanks!
-
5. Re: Bad redirection with tag <error-page> in web.xml
healeyb Jul 13, 2012 8:49 AM (in response to tremal_naik)Find somewhere that jquery.js loads ok, is it using jquery.js.xhtml or jquery.js? what's the difference in the page where it
loads ok, and the one where it doesn't.
I'm not clear which page is loading that results in the error message. In firebug even if a page references a template you
would see the page loading with a GET or POST.
-
6. Re: Bad redirection with tag <error-page> in web.xml
tremal_naik Jul 23, 2012 8:02 AM (in response to tremal_naik)Hi,
The template is called like this:
<ui:composition template="/template.xhtml">
My template have the next line
<h:outputScript name="jquery.js"/>
The FireBug shows that the request has been with a GET.
A correct request is like this: http://localhost.../javax.faces.resource/script.js.xhtml
When the page do not generates an error, the query.js.xhtml is loaded correctly