cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Sending parameter through from UI to the bean

AntonBagryanov
3-Visitor

Sending parameter through from UI to the bean

Hi!

Sometimes I need to send some value from UI to the bean that will handle this value. As I Inderstand I can do it through commandBean. For example I can set parameter to the request: request.addParameter("par1", "val1"). But when I want to get it in formProcessor like request.getParameter("par1") I get null value.

What is wrong? Thanks!

1 REPLY 1

In your FormProcessor, try getting the parameter like this:

HashMap<String,Object> params = ((ObjectBean)list.get(i)).getParameterMap();

String[] operations = (String[])params.get("operation");

Or if you don't know the exact name of the parameter, like this:

String valueString = null;

Iterator<String> iterator = params.keySet().iterator();

while (iterator. hasNext()) {

String keyName = (String) iterator.next();

if (keyName.contains("myParam___textbox") && !keyName.contains("___old")) {

String[] valueArray = (String[])params.get(key);

valueString = valueArray[0];

}

}

Something like that.

Top Tags