control param of HtmlCommandLink

Hi,

Plz, how to get the control param value of a HtmlCommandLink in server side (i mean in my data return method)??

thanks and regards

The command parameters should be accessible as request parameters.

For example:

String value = (String)resolveExpression("#{param['domaine']}");

Or:

String value2 = (String)getFacesContext().getExternalContext().getRequestParameterMap().get("domaine");

Hi Eric,

The return result is always null using the 2 over lines :frowning:
I don’t know why, i’m using an htmlCommandLink, i don’t know if i can read them off the current portlet request via the faces ExternalContext or in a binding expression ??

my return action :


	public String domaineSelected() {
	    String value = (String)resolveExpression("#{param['domaineParam']}");  
	    //String value2 = (String)getFacesContext().getExternalContext().getRequestParameterMap().get("domaineParam"); 
	    return value;
	}	

knowing that my param contains always a value on the url request :

Thanks and regards

Well, that technique worked for me.

Can you create a simple test portlet that demonstrates the problem? If so, you may need to open a support request with your findings to get a more formal review.

Hi,

i did it here

http://tech.forums.softwareag.com/techjforum/posts/list/0/26169.page#77333

is that a support request ?

thanks

No, you should create the support incident @ https://empower.softwareag.com

okay :slight_smile:

thank you

Hi Eric,

I tried to create a simple project with a portlet, I create a view in which I put a control HtmlCommandLink with a param and an inputText to retrieve the value of this param.
The example works well when I run my page on MWS local server and return the value of my param, BUT when i run it on the MWS remote server the value is null.

MWS local server : when i click on the link

the request :

MWS Remote server : when i click on the link

the request :

the difference between the two request below is “jsf” and “jsfwmp22710”


javascript:;CAF.model("jsfwmp22710:defaultForm:htmlCommandLink").go({'myparam':'helloWorld'});
javascript:;CAF.model("jsf:defaultForm:htmlCommandLink").go({'myparam':'helloWorld'});

I use the resolveExpression() to get the param value


    String value = (String)resolveExpression("#{param['myparam']}");  

have you a suggestion for what it is?
do i have to set something for my view ?

Thanks and regards

Yassine

Well, the difference in the client side control id is probably related to the address being used to render the page.

If you are rendering a CAF view in a portlet, the control id is prefixed with the string “jsf[_portlet_namespace_here]:” to make it possible to have multiple instances of the same portlet type on one page. It makes the client side control ids unique for each portlet instance.

Alternatively, if you are rendering a standalone caf view outside of a portlet (e.g. directly loading something like this: http://localhost:8585/YourAppName/page.view) the control id is prefixed with the string “jsf:”. The additional control id namespacing (for portlet requests) isn’t required in this case since it assumes that your CAF view is rendering the entire page so you don’t need to worry about the IDs colliding with other fragments of the page.

I’m not sure why it is not working for you. Hopefully the engineer assigned to your support incident can provide you some assistance.