How to get value from a FormValue bean in Controller?

It’s very easy to get value from a formValue bean, but until you know it, it seems to be difficult.

So let’s try to understand how to get value from a formValue bean. Before going furthere I assume that you have a page XxTrialPG and a controller XxTrailCO and also a formValue in the page XxTrialFormValue and the formValue bean has some value that you want to capture in a variable in your XxTrialCO controller.

Let’s take this in steps for easy understanding and rememberance.

Step 1: To get the value of form value in a controller, please create a handle of the formvalue bean as given below.

OAFormValueBean handleFormValue = (OAFormValueBean)webbean.findChildRecursive(XxTrialFormValue);

Step 2: Create a String type variable and fetch the value using the handle created by calling a method named getValue(pageContext) –

String strFormValue = handleFormValue.getValue(pageContext);

And that’s it, you now just now fetched the value of a formValue bean in a String type variable.

Thanks for reading,

Take Care

Tagged , , . Bookmark the permalink.