Skip to main content

Java Server Faces - put views in seperate directories

No replies
jmail22
Offline
Joined: 2010-05-17

I don't know where too put this. I was trying posting this on sun.com (Oracle forums) but each time I get error 500

Hi everyone!

I am new to Java Server Faces. I would like to ask about something what is very anoing for me.

Let's take a look at my project dirs (I am developing app with NetBeans 6.8 JSF 2.0 Hibernate)

Source Packages
|
Libraries
|
WebPages
__WEB-INF
__|
__resources
__|
__template.xhtml
__index.html

Nothing more is needed.

I've go the managedbean

settingsController

in which I've go the method index. this method should return String with template (index) name. And if it returns "index" everything is ok, but... I would like to change location for views. After my operation my project tree should looks like:

Source Packages
|
Libraries
|
WebPages
__WEB-INF
__|
__resources
__|
__templates
____|
____settings
______|
______index.html
______template.xhtml
template.xhtml
index.html

I am trying to put the views in seperate directory for each controller. I have tried to return template with directory like this:

public String index(){
return "templates/settings/index";
}

but this returns me an error

Unable to find matching navigation case with from-view-id '/index.xhtml' for action '#{settingsController.index}' with outcome 'settings/index'

Can anyone explain me how to make this working? Just for example for two cases: settings/index and user/changePass

I'll be very grateful.

Best regards

jmail

Message was edited by: jmail22