Look at your servlet filters mapping in web.xml. By default, they
don't trigger on page forwarding. For example, if you have a filter
defined on *.jsf:
1) request /page.jsf -> [FILTERS] -> [servlets, etc.] -> page.jsp
2) request /index.jsp -> <% response.sendRedirect("/page.jsf"); %>
another request for /page.jsf -> [FILTERS] -> [servlets,
etc.] -> page.jsp
3) request /index.jsp -> jsp:forward to "/page.jsf" -> [servlets,
etc.] -> page.jsp
Note that, in case 3 (forward), your filters aren't triggered because
the initially requested page doesn't match their mapping. So, after
the forwards, if servlets rely on filter execution, you'll have
problems.
There is a way to make filters run even for forwards, but only
starting with servlet 2.4 (see if your deployement restrictions allows
it): a new web.xml <dispatcher> tag in filter mappings:
<filter-mapping>
<filter-name>...</filter-name>
<url-pattern>...</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispacther>
</filter-mapping>
Anyway, if you have only some pages that have the problem (for example
a login page) you can simply use a redirect instead of a forward.
Hope this helps
Cosma
2006/6/22, Paulo Cheque <[EMAIL PROTECTED]>:
If I put <% response.sendRedirect("pages/myPage.jsf"); %> in my index.jsp,
this redirect correctly and my navigation menu works properly.
If I change by <jsp:forward...> this redirect correctly, but my menu doesn't
work
(link #, I think some javascript function was not created, maybe the servlet
don't load totally?).
This is not so important, but I think this can be the reason of my main
problem:
I create a Filter with "response.sendRedirect(loginPage);", this redirect
properly but my jsf components don't show up! :-(, only my html tags.
if(!request.getRequestURI().endsWith(loginPage)) {
response.sendRedirect(loginPage);
return; // without return throws an exception.
}
filterChain.doFilter(request, response);
Can anyone help me? Thanks in advance!
Paulo