Re: Problems with 3.1.0

Splash Forums PrettyFaces Users Problems with 3.1.0 Re: Problems with 3.1.0

#20464

oprisa_vlad
Participant

I realize now that i did not explain myself in a complete manner.

The main concept is to have MyDemo.ear (meening MyDemo as a contextPath).

This app will have more that one View (User interface), just like skins but more custom and not css made, having same jsp file structure.

Each module will be named

demo1

demo2

demoN

so the directory structure of my web (directory) is

MyDemo/web/

MyDemo/web/demo1/pages/test/Home.jsp

MyDemo/web/demo1/pages/test/css/test.css

MyDemo/web/demo2/pages/test/Home.jsp

MyDemo/web/demoN/pages/test/Home.jsp

so in the url i will want

http://localhost:8080/MyDemo/home

to be managed according to appName variable (demo1, demo2 … demoN)

(The ambiguity in my first post was that demo (contextpath) and demo as a directory name were the same.)

so the

<pattern value=”/home”/>

considering the relative path i want it to be

String rst = “/” + appName + “/pages/test/Home.jsf”;

eg:

http://localhost:8080/MyDemo / demo1 /pages/test/Home.jsf

After more digging my friend found a workaround:

String rst = “/faces/” + appName + “/pages/test/Home.jsp”;

to be cautgh by the second filter

<servlet-mapping>

<servlet-name>Faces Servlet</servlet-name>

<url-pattern>*.jsf</url-pattern>

</servlet-mapping>

<!– this one –>

<servlet-mapping>

<servlet-name>Faces Servlet</servlet-name>

<url-pattern>/faces/*</url-pattern>

</servlet-mapping>

I had declared both in my web.xml file.

I don’t find this normal. Am I wrong ?

Also if anybody can provide me with a link on how to use prettyfaces to do something like this:

1.

first request: ../siteCase/value1/value2

having

<url-mapping id=”siteCase”>

<pattern value=”/siteCase”/#{viewBean.value1}/#{viewBean.value2}>

<view-id>#{urlBean.getSiteCase}</view-id>

</url-mapping>

public String getSiteCase() {

String rst = “pretty:home”;

if (loggedIn) {

rst = “/” + appName + “/pages/test/SiteCase.jsf”;

} else {

//here i save the this.desiredUrl

rst = “pretty:login”;

}

return rst;

}

2.

He is not logged in and will be redirected to the login page

3.

He passes login and i want to redirect him to the UrlBean.this.desiredUrl

My problem is that i don’t know how to save this.desiredUrl (and also “parameters”) and how to redirect

public String login(){

//login stuff

return “pretty:???”;//and the parameters ?

}

Thanks in advance!