Skip to Content
author's profile photo Former Member
Former Member

Getting content from the CAFContext

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2007 at 04:30 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 25, 2007 at 12:27 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.