select component not rendered correctly

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

select component not rendered correctly

Mathieu Avoine
Hi,

I observed a weird behavior with select components after upgrading to Stripes 1.5. It can easily be reproduced.

I put 2 select components with similar attributes, and only the first one is rendered correctly; the other is missing
attributes. Ex:

        <stripes:select id="select1" name="selected1" multiple="true" size="10">
                <stripes:options-collection collection="${bean.items1}"/>
        </stripes:select>

        <stripes:select id="select2" name="selected2" multiple="true" size="10">
                <stripes:options-collection collection="${bean.items2}"/>
        </stripes:select>
                       

Notice that both selects have an attribute "multiple" and "size". The html generated is as follows:

        <select multiple="multiple" size="10" name="selected1" id="select1">
                <option value="1">1</option><option value="2">2</option><option value="3">3</option>
        </select>

        <select name="selected2" id="select2">
                <option value="1">1</option><option value="2">2</option><option value="3">3</option>
        </select>

Notice that attributes "multiple" and "size" are not added for the second select.

I'm running Stripes 1.5rc1. I attached the jsp and ActionBean class to reproduce the issue.

Thanks for any help!

Math


package com.mobicom.presentation.action;

import java.util.ArrayList;
import java.util.List;

import net.sourceforge.stripes.action.ActionBean;
import net.sourceforge.stripes.action.ActionBeanContext;
import net.sourceforge.stripes.action.Resolution;

import com.mobicom.presentation.stripes.config.SessionContext;


public class Sandbox implements ActionBean {
       
        private SessionContext context;

        public SessionContext getContext() {
                return context;
        }

        public void setContext(ActionBeanContext context) {
                this.context = (SessionContext) context;
        }

       
        private List selected1 = null;
        private List selected2 = null;
       
        public List<String> getItems1(){
                List a = new ArrayList();
                a.add("1");
                a.add("2");
                a.add("3");
                return a;
        }

        public List<String> getItems2(){
                List a = new ArrayList();
                a.add("1");
                a.add("2");
                a.add("3");
                return a;
        }

       
        public List getSelected1() {
                return this.selected1;
        }

       
        public void setSelected1(List selected1) {
                this.selected1 = selected1;
        }

       
        public List getSelected2() {
                return this.selected2;
        }

       
        public void setSelected2(List selected2) {
                this.selected2 = selected2;
        }
       
        public Resolution action1(){
                return null;
        }

        public Resolution action2(){
                return null;
        }

}

<%@ taglib prefix="stripes" uri="http://stripes.sourceforge.net/stripes.tld" %>

<stripes:useActionBean beanclass="com.mobicom.presentation.action.Sandbox" var="bean"/>

<stripes:layout-render name="/stripes/inc/main-blank.jsp" pageTitle="Sandbox">
        <stripes:layout-component name="pageContent">
       
                <stripes:form beanclass="com.mobicom.presentation.action.Sandbox" action="action1">
               
                        <stripes:select id="select1" name="selected1" multiple="true" size="10">
                                <stripes:options-collection collection="${bean.items1}"/>
                        </stripes:select>

                        <br>
       
                        <stripes:select id="select2" name="selected2" multiple="true" size="10">
                                <stripes:options-collection collection="${bean.items2}"/>
                        </stripes:select>
                       
                </stripes:form>
       
        </stripes:layout-component>
</stripes:layout-render>


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: select component not rendered correctly

Ben Gunter
I know this isn't the response you were hoping for, but I can't reproduce the problem. I cut & pasted your code exactly as it is, and both of the select elements show up with the proper attributes.

On Wed, May 28, 2008 at 10:00 AM, Ben Gunter <[hidden email]> wrote:
 I know this isn't the response you were hoping for, but I can't reproduce the problem. I cut & pasted your code exactly as it is, and both of the select elements show up with the proper attributes.

On Tue, May 27, 2008 at 12:43 PM, Mathieu Avoine <[hidden email]> wrote:
Hi,

I observed a weird behavior with select components after upgrading to Stripes 1.5. It can easily be reproduced.

I put 2 select components with similar attributes, and only the first one is rendered correctly; the other is missing attributes. Ex:

       <stripes:select id="select1" name="selected1" multiple="true" size="10">
               <stripes:options-collection collection="${bean.items1}"/>
       </stripes:select>

       <stripes:select id="select2" name="selected2" multiple="true" size="10">
               <stripes:options-collection collection="${bean.items2}"/>
       </stripes:select>
                       

Notice that both selects have an attribute "multiple" and "size". The html generated is as follows:

       <select multiple="multiple" size="10" name="selected1" id="select1">
               <option value="1">1</option><option value="2">2</option><option value="3">3</option>
       </select>

       <select name="selected2" id="select2">
               <option value="1">1</option><option value="2">2</option><option value="3">3</option>
       </select>

Notice that attributes "multiple" and "size" are not added for the second select.

I'm running Stripes 1.5rc1. I attached the jsp and ActionBean class to reproduce the issue.

Thanks for any help!

Math


package com.mobicom.presentation.action;

import java.util.ArrayList;
import java.util.List;

import net.sourceforge.stripes.action.ActionBean;
import net.sourceforge.stripes.action.ActionBeanContext;
import net.sourceforge.stripes.action.Resolution;

import com.mobicom.presentation.stripes.config.SessionContext;


public class Sandbox implements ActionBean {

       private SessionContext context;

       public SessionContext getContext() {
               return context;
       }

       public void setContext(ActionBeanContext context) {
               this.context = (SessionContext) context;
       }


       private List selected1 = null;
       private List selected2 = null;

       public List<String> getItems1(){
               List a = new ArrayList();
               a.add("1");
               a.add("2");
               a.add("3");
               return a;
       }

       public List<String> getItems2(){
               List a = new ArrayList();
               a.add("1");
               a.add("2");
               a.add("3");
               return a;
       }


       public List getSelected1() {
               return this.selected1;
       }


       public void setSelected1(List selected1) {
               this.selected1 = selected1;
       }


       public List getSelected2() {
               return this.selected2;
       }


       public void setSelected2(List selected2) {
               this.selected2 = selected2;
       }

       public Resolution action1(){
               return null;
       }

       public Resolution action2(){
               return null;
       }

}

<%@ taglib prefix="stripes" uri="http://stripes.sourceforge.net/stripes.tld" %>

<stripes:useActionBean beanclass="com.mobicom.presentation.action.Sandbox" var="bean"/>

<stripes:layout-render name="/stripes/inc/main-blank.jsp" pageTitle="Sandbox">
       <stripes:layout-component name="pageContent">

               <stripes:form beanclass="com.mobicom.presentation.action.Sandbox" action="action1">


                       <stripes:select id="select1" name="selected1" multiple="true" size="10">
                               <stripes:options-collection collection="${bean.items1}"/>
                       </stripes:select>

                       <br>


                       <stripes:select id="select2" name="selected2" multiple="true" size="10">
                               <stripes:options-collection collection="${bean.items2}"/>
                       </stripes:select>

               </stripes:form>

       </stripes:layout-component>
</stripes:layout-render>


--
Ben Gunter



--
Ben Gunter
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Adding non-standard attributes to stripes tag

Farouk Alhassan
I am using the dijit toolkit to do some clent-side looka nd feel as well as validation before form is submitted
but this requires that i do sth like this

<stripes:button id="next" dojoType="dijit.form.Button" name="next" class="btTxt" type="submit" tabindex="23">Submit</stripes:button>

but this throws en exception that the TLD doesn ot support "dojoType"

so i change to this

<button id="next" dojoType="dijit.form.Button" name="next" class="btTxt" type="submit" tabindex="23">Submit</button>

but the event goes to the default handler instead of the defined event handler


  @DefaultHandler
  public Resolution processTransfer() throws Exception{
    init();
    ApiResponse res = BusinessDelegate.doNewTransfer();
    if(res.isSuccess()){
      MtViewMoneyTransfer view = (MtViewMoneyTransfer) res.getObject("MtViewTransfer");
      if(view != null){
        getTransferBean().setView(view);
      }
    }
    return new ForwardResolution("/business/mtrans.jsp");
  }
 
  @HandlesEvent("next")
  public Resolution next(){
    if(log.isDebugEnabled()){
      log.debug("next()");
    }
    return new ForwardResolution("/business/mtrans.jsp");
  }

Since i really have to use this dijit tool, is there a work arround this so i can get my events handled directly


Messenger's gone Mobile! Get it now!
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users
Reply | Threaded
Open this post in threaded view
|

Re: Adding non-standard attributes to stripes tag

jk-44
Check here http://www.stripesframework.org/display/stripes/Tag+Library+Doc

Pay attention to anything related to "dynamic attributes"

>
> I am using the dijit toolkit to do some clent-side looka nd feel as well  
> as validation before form is submitted
> but this requires that i do sth like this
>
> <stripes:button id="next" dojoType="dijit.form.Button" name="next"  
> class="btTxt" type="submit" tabindex="23">Submit</stripes:button>
>
> but this throws en exception that the TLD doesn ot support "dojoType"
>
> so i change to this
>
> <button id="next" dojoType="dijit.form.Button" name="next" class="btTxt"  
> type="submit" tabindex="23">Submit</button>
>
> but the event goes to the default handler instead of the defined event  
> handler
>
>
>   @DefaultHandler
>   public Resolution processTransfer() throws Exception{
>     init();
>     ApiResponse res = BusinessDelegate.doNewTransfer();
>     if(res.isSuccess()){
>       MtViewMoneyTransfer view = (MtViewMoneyTransfer)  
> res.getObject("MtViewTransfer");
>       if(view != null){
>         getTransferBean().setView(view);
>       }
>     }
>     return new ForwardResolution("/business/mtrans.jsp");
>   }
>  @HandlesEvent("next")
>   public Resolution next(){
>     if(log.isDebugEnabled()){
>       log.debug("next()");
>     }
>     return new ForwardResolution("/business/mtrans.jsp");
>   }
>
> Since i really have to use this dijit tool, is there a work arround this  
> so i can get my events handled directly
>
> _________________________________________________________________
>
> http://clk.atdmt.com/UKM/go/msnnkmgl0010000007ukm/direct/01/



--
Best Regards
Evgeny K. Shepelyuk


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Stripes-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/stripes-users