Passing CAF element id as a request parameter to a JSP

hi All,

Having problem with client side id of an input component.

I have a portlet in which a text area component and a button is present.
Objective:
On click of this button, a jsp page has to be opened (This JSP is part of a webApplication which is deployed in MWS server).While opening this JSP page, I have to pass client side id of text area component (present in MWS portlet) as request parameter. (This is to give the control on text area element to the child JSP page).

Problems I am facing:

  1. var clientSideId = “#{activePageBean.clientIds[‘sampleTextArea’]}”
    This line gives me client side id (as a javascript object).
    How can I convert it to String so that I can pass it as a request parameter while opening jsp page.
    Value ‘[object]’ is going as request parameter - If I pass the above javascript parameter like this : window.open(‘jspPageURL?reqParam=’+clientSideId, ‘childWindow’ ‘’);

  2. Displayed clientSideId javascript object using alert() - it displayed ‘jsfwmp51601:defaultForm:sampleTextArea’.
    As we know, we can not have special characters in request parameters (here it is colon ‘:’ )
    So how can we encode this special character to pass it as request parameter?

  3. once the clientSideId of textArea is passed to the child jsp page,
    parent.opener.<%=request.getParameter(“reqParam”)%>.value - will not give the value present in text area box because of the special character present in the clientsideId of textArea component. .
    Could you please advice what changes need to be done for this expression to work?

Thanks in advance for your help.

Kind regards,
Raja sekhar Kintali

I think you want to use the built in Javascript function (on all browsers) encodeURIComponent and decodeURIComponent.

In your example, the encodeURIComponent(“jsfwmp51601:defaultForm:sampleTextArea”) will be encoded to: jsfwmp51601%3AdefaultForm%3AsampleTextArea and then use the decodeURIComponent to reverse the encoding.

Please see this site for more details: JavaScript encodeURIComponent() Method

Regards,
–mark