MWS - Getting a URL parameter value using a portlet preferen


I’m quite new to MWS and I’m having trouble getting a request parameter from the query string.

I need to be able to get the value from the query string because I have two separate projects and the first project needs to pass a parameter to the second project which will perform some operations based on the parameter value.

To prove the concept and keep it simple I’ve set up a simple new portlet to output the value of a request parameter.

To do this I’ve created a new portlet (called “HelpTest”) and added a preference called “query” with default values.

My portlet has only two items on it, a text box and an asynch command button.

The text box has its value attribute set to:


And the asynch command button has its refresh value set to the name of the form (defaultForm).

When I go to the portlet, adding ?query=12345 to the URL, the value of the text box is blank.

When I hit the asynch command button (causing a refresh) the value of the text box is 12345.

My question is, why isn’t the query parameter captured when the portlet is first loaded? Why do I have to refresh and how to I instead get the value to load when the portlet is first loaded?