aspose file tools*
The moose likes JSF and the fly likes how to add dynamic value in URL from faces-config Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "how to add dynamic value in URL from faces-config" Watch "how to add dynamic value in URL from faces-config" New topic
Author

how to add dynamic value in URL from faces-config

roby george
Ranch Hand

Joined: Sep 08, 2010
Posts: 31
hello,

I have a situation where i have to add dynamic value (like username) in URL from faces-config.xml.
I am using sunRI. In my application i am redirecting page from one page to another through navigation-rule of facec-config.

Ex-
<navigation-rule>
<from-view-id>/EnrEmployer.jsp</from-view-id>
<navigation-case>
<from-outcome>enroll</from-outcome>
<to-view-id>/Enroll.jsp?jobCode=1233</value></to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>
in above code snippet i am redirecting page from EnrEmployer to Enroll . When the Enroll.jap page comes in URL then the URL will be look like as
[Applicatio-context]/Enroll.jsp?jobCode=1233 here url parameter(i.e. jobCode) easly added becouse its a static. I want to add username in URL. I want URL like bellow
[Applicatio-context]/Enroll.jsp?jobCode=1233&username=abc /// supose here abc is username which is currently looged in the application

I have UserDTO which holds all the user ralated information. I also save this DTO into session.

How can i add username in url through facesd-config..

Your suugestion will highly appriciate

Thanks in advance
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15641
    
  15

That's not normally how you do things in JSF. Just aside from everything else, JSF URLs don't track their related resources that accurately.

Plus, to tell the truth, outputting data to the client in a URL and then getting it back again adds a small but definite amount of extra network overhead for the extra data and (more importantly!) makes it easier to hack the app.

Instead, you should consider placing this information in a JSF backing bean that the target can then reference as a POJO property.

An additional caution is in order. Although you can mix vanilla JSPs and JSF, you cannot use JSF navigation rules to invoke a vanilla JSP from a JSF. Navigation rules can only reference JSF Views.


Customer surveys are for companies who didn't pay proper attention to begin with.
roby george
Ranch Hand

Joined: Sep 08, 2010
Posts: 31
thnks for you sugeestion Tim
i know it is not secure to add parameter in URL , BUT i want to add that . If suppose i haved added the property in my backing bean then how can i access that in faces-config.

Thanks in advance
roby george
Ranch Hand

Joined: Sep 08, 2010
Posts: 31
i m still waiting for anysuggestion.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to add dynamic value in URL from faces-config
 
Similar Threads
Cannot find FacesContext and showing the html code in the jsp
jsf newbie, navigation not working
how to use managed bean property in navigation rule tag of faces config.
newbie null reference exception
Getting Cannot find FacesContext and sometime showing html codes in the page