The BI Beans thin beans use hidden form fields to place query parameters in the URL of a servlet request. If your application has parameters of its own to add to the HTTP request, then you can add query parameters to each HTTP request. You do this by adding form fields to the form that contains the thin bean.
Adding parameters to the request allows you to store more of the application state in the URL.
Form input tags carry information that you ask the user to supply. To pass static information -- information that your application has and that is not input from your users -- you put the parameter values in hidden form fields.
To avoid adding unwanted space to the middle of the HTML page, add the hidden form fields after any content in the form.
The following code shows how to add hidden form fields to a UIX FormBean
.
FormBean form = new FormBean("MyForm"); // first, add contents of the form form.addIndexedChild(thinBeanUINode); // then add hidden form fields to the code form.addIndexedChild(new FormValueBean("appParam1", "appParamValue1")); form.addIndexedChild(new FormValueBean("appParam2", "appParamValue2"));
To retrieve the parameter values from the URL, you call the getApplicationParameterValue
method of the QueryParameterProvider
. The following code shows how to retrieve the value of the appParam1
parameter.
QueryParameterProvider provider = new ServletQueryParameterProvider(request,response); String myParamValue1 = provider.getApplicationParameterValue("appParam1"); //...other code, not provided in this example // requestHandler is my ServletRequestHandler requestHandler.handleEvent(provider);