Announcement Announcement Module
Collapse
No announcement yet.
How to access map of referenceData Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to access map of referenceData

    What's the name of map that referenceData is returning?

    I need to set it to a bean, so I can use it in a
    tag.


    protected Map referenceData(HttpServletRequest request) throws ServletException {
    Map refData = new HashMap();
    refData.put("directions", getManagerDirection().getListValeurDirections());
    refData.put("arrondissements", getManagerArrondissement().getListValeurArrondisse ments());
    return refData;
    }

    so you see Map contains two elements : "directions" and "arrondissements"

    they are both in a list.

    I have a tag that has a attributes that takes a List, can produce a
    selection option

    What's the name of map in the JSP?

    in the on submit

    could it be "command"?

  • #2
    I think I got it

    I can't just acces my List simply like that

    it has to be in a DTO, a bean with the proper getter and setter

    otherwise, tomcat can't know what to do with it

    It has to contain in a bean.

    $bean.arrondissements can return a list

    and in the bean

    ...
    private List arrondissements

    public List getArrondissements() {
    ...
    }


    Am I right?

    Comment


    • #3
      Data put in the reference data can be accessed directly in your page, so in your case this would be:

      $!directions or $!arrondissements

      When you hit the onSubmit method the command object represents your 'form" data, I guess you probably have a field on your form like 'selectedDirection' or 'selectedArrondissement' that contains the correct data (the select option from the select box). I think you can't access the reference data in the onSublit because it has not been bound to the form. Like the name implies it is just 'reference data' for viewing purposes.

      Grtz

      Comment


      • #4
        "!"

        I try to use it in a tag with this syntax

        listValeur = "${arrondissements}"

        and it tells me that I have a wrong datatype

        and with $!arrondissement, I can access like this:

        <pretag:atag listValeur="$!arrondissements"/>

        ??

        am I wrong?

        Comment

        Working...
        X