cancel
Showing results for 
Search instead for 
Did you mean: 

Getting content from the CAFContext

Former Member
0 Kudos

Hi!

Like mentioned in the mbsui documentation from MTT2.0 I used the CAFContext to put some data in it to transport values to the JSP. But how do I get the values the user entered on the JSP page (like a form) out of the context and back in my controller which handles the event?

greetings

Michael

EDIT:

I've found some String in the context referenced by the key "page_input" that holds up some data. But I didn't exactly know how to get it out except by using some string operations g but this couldn't be the solution. The mbsui.jar holds some classes in the request package called ComboBoxReturn or InputFieldReturn. But those classes are not documented.

Message was edited by:

Michael Belz

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Michael,

For mbsui the user input is returned to the application in the page_input context attribute. This page_input is parsed by the RequestReturn that creates control return objects. Basically you can either use the DefaultControlReturn to get the data (for basic controls) or, if you know the type of control, use the more specialized control return which are:

SelectionCellInputReturn.java

CheckBoxReturn.java

DateNavigatorNextButton.java

DateNavigatorPreviousButton.java

DefaultControlReturn.java

InputFieldReturn.java

RadioButtonReturn.java

ScrollInputReturn.java

You can also define your own control return by implementing the IControlReturn interface (this is not recommended) and register it with the RequestReturn.

In MTT you have to go throught the RequestReturn found in the FrontServlet (if I am not mistaken), for MAM, this is abstracted from the developer in the CAFContext implementation.

I hope this answer your question. Feel free to ask other question on the MBSUI.

Thank you,

Julien.

Answers (1)

Answers (1)

Former Member
0 Kudos

Solved it on my own so far


   RequestReturn rr = getRequestReturn();
		
   DefaultControlReturn frominput = (DefaultControlReturn) rr.getControlById("combobox_messages");
   String output = frominput.getValue();

As far as I see it should also be possible to bind a model to the UI elements somehow...if somebody knows how to do this I would be grateful.

Former Member
0 Kudos

Hello,

To bind the UI element to a particular control return, than you have to cast the return value of getControlById to whatever the control type you want. In your example, no special control return is needed for comboboxes. For example, if you have a checkbox then you could do:

CheckBoxReturn checkboxvalue = (CheckBoxReturn) rr.getControlById("cb_foo");

You can also get all the controls of a particular type on the page. This is usefull when you have row selection on a table:

Collection rows = rr.getControlsByType(SelectionCellInputReturn.ControlType);

Then you can iterate throught the rows and find the information you want.

I hope this completes the previous information I sent.

Thank you,

Julien.