aspose file tools*
The moose likes JSF and the fly likes JSF 2.0 , passing URL hidden parameters in ExternalContext.redirect() programmatically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF 2.0 , passing URL hidden parameters in ExternalContext.redirect() programmatically" Watch "JSF 2.0 , passing URL hidden parameters in ExternalContext.redirect() programmatically" New topic
Author

JSF 2.0 , passing URL hidden parameters in ExternalContext.redirect() programmatically

Divya Sudarsan
Greenhorn

Joined: Feb 16, 2010
Posts: 9
Hi , I have the following code on the submit of command button on the jsp page



I need to send all the parameters after rwservlet? as hidden parameters. These values do not come from any form field on the page. They are a part of the properties file on the disk. I would not like them to be displayed to the user when loading the next webpage or on the next web page.

Please let me know if there is any way to mark specific parameters in externalcontext.redirect() as hidden programatically

The xhtml code is

K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2366
    
    7

You mention the parameters are in a properties file on disk... then why not just populate a Properties from the start and put it in a session or application scope. Then use that object instead in the redirected page or whenever you need it.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
Divya Sudarsan
Greenhorn

Joined: Feb 16, 2010
Posts: 9
Thanks for the reply. Can you please help me with samples which can make me understand in detail ?

Also my bad, only some of the properties are on disk. for e.g DB name. The others will be populated dynamically based on some business logic on the code.
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2366
    
    7

Divya Sudarsan wrote:Also my bad, only some of the properties are on disk. for e.g DB name. The others will be populated dynamically based on some business logic on the code.


In that case I suggest you store these so-called properties in a DB table and fetch them when necessary.

As for examples: if you know how to "load" up a Properties, you should be fine. If in doubt check out the java.util.Properties API.
Prabu Pidaran
Greenhorn

Joined: Feb 22, 2010
Posts: 19
Try loading the properties file
Properties urProperties = new Properties().load(new FileInputStream(System.getProperty("YOUR PROPERTY FILE PATH");

Then try to get the values

String dbName = (String) urProperties.get("urKeyValue");

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16012
    
  19


Hi , I have the following code on the submit of command button on the jsp page ...


I don't think so. In Java 2.0, JSP view templates are no longer supported. It would have to be an xhtml View Definition Language Template.

I need to send all the parameters after rwservlet? as hidden parameters. These values do not come from any form field on the page.


If you don't have a form, then you are submitting an HTTP GET request. On an HTTP GET the parameters are part of the URL and by definition, not something that can be hidden.

The cleanest/simplest way to hide data is never to post it out to the client to begin with. In JSF, this is a normal part of the architecture. Just keep your data in (session-scope) backing beans.

On the other hand, it appears that you are attempting to forward a parameterized request to an external server, so session-scope data is not an option. And, in fact, it's the report server that forces the request parameters to be part of the URL.

If you can, reformulate your request to submit the parameters in a form. That well keep them off of the URL and thus invisible to the client. If you cannot, you are probably going to have to serve as a proxy. Instead of forwarding the request, your application code will probably have to submit the request internally, receive the generated report output, and pass that output back to the client. Since the output will probably NOT be in JSF format (and will most likely be something like a PDF), your actual Submit handler is probably better done as a Plain Old Servlet, not routed via JSF.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSF 2.0 , passing URL hidden parameters in ExternalContext.redirect() programmatically