reset password
Author Message
p0941
Posts: 95
Posted 22:35 May 20, 2010 |

I tried to pass parameter P to controller C extending  SimpleFormController.  But I can't see the parameter P either in C or C's formview.  So how can I pass  parameter anyway?  

Thanks

rahulajit
Posts: 15
Posted 00:40 May 21, 2010 |

Say your bean name for the controller C is c.html.

If you are trying to get form values, then try the following inside the onSubmit method inside your controller C:

A a = (A) command;

a.getP(); // getP() is the getter method for the property P inside your model class A. Make sure you specify <property name="commandClass" value="A" /> in servlet.xml under the bean specification for your controller C (c.html) .

 

On the other hand if you are trying to pass a parameter from one controller to another then try the following:

Then you pass the parameter P with value say 'val' to the controller C by

c.html?P=val

// I think its bad programming style to pass values from a controller to another as in spring framework values are usually passed from model to view.

Last edited by rahulajit at 00:59 May 21, 2010.