File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Spring and the fly likes Facelets + Spring Security Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Facelets + Spring Security" Watch "Facelets + Spring Security" New topic

Facelets + Spring Security

Adolfo Eloy
Ranch Hand

Joined: Mar 21, 2009
Posts: 146


I'm trying to use Spring Security 2.0 with a Facelets + JSF 1.2 web application.
I've tried configuring Spring Security with only JSF and it's working fine.
But when I'm using Facelets the problems come.

This my web directory structure:
---- content/
-------- area1/page1.xhtml
-------- area2/page2.xhtml
----- menu.xhtml

So I've configured my applicationContext-security.xml as follows:

My menu.xhtml have a commandLink with an action named page1 which is mapped in my faces-config.xml navigation rules to the correct page which is: /content/area1/page1.xhtml

When I start my application and try to access the page1 link, this page is rendered without calling the spring security login form.
So when I select another item from menu, the login form is rendered in a late way.

It seems to be using an old url.

I'd like to solve this and I've already searched over internet without success.
Any help will be appreciated.


Adolfo Eloy
Software Developer
Adolfo Eloy
Ranch Hand

Joined: Mar 21, 2009
Posts: 146

The problem was exactly with facelets! The problem was happening with JSF by itself.
Reading a Brazilian post at google groups someone give-me help where he was saying to use redirect instead of forward in my faces-config.xml file.

Indeed that solution worked for me.

I'll study more about it to give more conceptual knowledge and maybe I could write something about it to help anybody who can have the same problem.

Even though this is a problem that is more related with JSF forum, follows an example of using the redirect in faces config.

I agree. Here's the link:
subject: Facelets + Spring Security
It's not a secret anymore!