Skip to Content
avatar image
Former Member

how to get Array values from context

In my jsp page, I have a group of checkboxes, named "checkbox" and each of them has a different value.

<form>

<input type=checkbox name=checkbox value=1>

<input type=checkbox name=checkbox value=2>

...

After I submit the form, I need to get the checkbox's values from next page's control file, which is a Java file. In the Java file, I use "com.sap.mbs.core.api.Context" class,

String cbString = (String)context.getNodeList().get("checkbox");

but I can only get the value of the first checkbox.

I have tried context.getValue("checkbox", 0), context.getValue("checkbox", 1), context.getValue("checkbox", 2), but all I got is "null".

I beleive the context has the value of the checkbox array. But how to get them out? Thanks a lot!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Oct 27, 2006 at 05:56 PM

    hello annie,

    you can add an attribute to the context using the method

    addValue or setValue. you will retrieve your values

    depending on how you set them.

    when you are posting to your controller servlet, you have

    to retrieve the values using the HTTPServletRequest interface

    thru the methods, getParameter or getParameterValues.

    you can then set them into your Context instance using

    Context.addValue method...

    let me know if you still need details.

    btw, im assuming that you have your own front controller.

    regards

    jo

    additional. try:

    String[] cbString = (String[])context.getNodeList().get("checkbox");

    Message was edited by: Jo Gel Santiago

    Message was edited by: Jo Gel Santiago

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      hi annie,

      > To me this is more like a bug rather than 'unsupported'.

      i also think that this could be a bug. or it could be that

      the implementation had changed for performance reason with

      this trade-off. perhaps creating an OSS message will clear

      this out...

      good luck.

      jo