2 Replies Latest reply on Aug 24, 2005 8:47 PM by antoine_h

    Bug in ActionRequest impl ?

      indeed, I am going to fix it

      thanks

        • 1. Re: Bug in ActionRequest impl ?

          what version of JBoss Portal are you using ?

          I tested with 2.0 final and I don't have this, it works as expected.

          • 2. Re: Bug in ActionRequest impl ?
            antoine_h

            Hello,

            Your post helped me find what was going on in parameters... but as it took me some time, these more details may help some others. (I also looked for the parameters in the JBossRenderRequest instance in render() instead of in the JBossActionRequest instance in processAction()).

            The map value object is filled with arrays of string, for the case of multiple values for one parameter name.
            Class name is "[Ljava.lang.String;", as you get with the toString method. "[L" stands for "one dimension array".
            (see http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Class.html#getName())

            here is some code to read and show the map of parameters. This method helped me understand what was going on in the RenderRequest and the ActionRequest...
            The method addLine2Cells just do the xhtml to insert in a table tag.

            /**
             * Add the view of a Map instance in the table element.
             * The map items are added to the table (to the yet existing lines in the table).
             */
            public void addCollectionToView(Map map) {
             final Set mapEntrySet = map.entrySet();
             Iterator i = mapEntrySet.iterator();
             Map.Entry eSet;
             String sTempKey = "";
             while (i.hasNext()) {
             eSet = (Map.Entry) i.next();
             sTempKey = eSet.getKey().toString();
             if (eSet.getValue() == null) {
             addLine2Cells(sTempKey + " =>", "null");
             } else if (eSet.getValue().getClass().getName().equals(
             "[Ljava.lang.String;")) {
             Object[] objArray = (Object[]) eSet.getValue();
             if (objArray.length == 0) {
             addLine2Cells(sTempKey + " =>", "null");
             } else if (objArray.length == 1) {
             addLine2Cells(sTempKey + " =>", objArray[0].toString());
             } else {
             for (int j = 0; j < objArray.length; j++) {
             addLine2Cells(sTempKey + "[" + j + "] =>", objArray[j]
             .toString());
             }
             }
             } else {
             addLine2Cells(sTempKey + " =>", eSet.getValue().toString());
             }
             }
            
            }
            


            The result is something like this :
            op => doAction
            toto[0] => blabla_1
            toto[1] => blabla_2

            Hope it helps...