[ 
https://issues.apache.org/struts/browse/WW-2690?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rainer Hermanns updated WW-2690:
--------------------------------

       Flags:   (was: [Patch, Important])
    Priority: Minor  (was: Major)

> CLONE -Autocomplenter don't submit the attribute value to the url action when 
> use valueNotifyTopics.
> ----------------------------------------------------------------------------------------------------
>
>                 Key: WW-2690
>                 URL: https://issues.apache.org/struts/browse/WW-2690
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Dojo Tags
>    Affects Versions: 2.1.0, 2.1.1, 2.1.2
>         Environment: Windows Server 2003, JDK1.5.0.11, Tomcat5.5.25, IE 7 & 
> Firefox2
>            Reporter: Wilson M Penha Jr.
>            Assignee: Musachy Barroso
>            Priority: Minor
>             Fix For: 2.1.3
>
>
> TEST CASE INSERTED!
> Hi Musachy Barroso,
> Let me send you the test case, so you can see it happens with you.
> 1o. Build a simple Pojo class into "org.apache.struts2.showcase.ajax" package:
> package org.apache.struts2.showcase.ajax;
> public class Pojo {
>       private Long Id;
>       public Long getId() {
>               return Id;
>       }
>       public void setId(Long id) {
>               Id = id;
>       }
> }
> 2o. Than put a pojo attribute into the 
> "org.apache.struts2.showcase.ajax.AutocompleterExampleAction.java";
> public class AutocompleterExampleAction extends ActionSupport {
>   private String select;
>   private List<String> options = new ArrayList<String>();
>   private Pojo pojo; // Pojo to reproduce the issue for the AutoCompleter bug.
>  :
>  :
>  :
> }
> 3o. Than from the WebContent/ajax/index.jsp file, put a <s:textfield...> into 
> the "selectForm" form tag, this will work with the colors, fruit example;
> Link two autocompleter elements. When the selected value in 'Autocompleter 1' 
> changes, the available values in 'Autocompleter 2' will change also.
> <br/>
> <form id="selectForm">
> <s:textfield theme="simple" id="id" name="pojo.id" cssStyle="display:none"/> 
> <!-- This is for reproduce the issue -->
> 4o. Than run the server in debug mode, and place a breakpoint into the 
> execute method into the action class;
>   public String execute() throws Exception {
>     if ("fruits".equals(select)) { // put here a debug breakpoint
>       options.add("apple");
> 5o. Than run rebuild the showcase project and run it in debug mode.
> 6o. Go the "Ajax plugin for Struts"->"Autocompleter combobox tag ".
>        In this very moment the app will hang in the breakpoint, than look at 
> the Variables tabs from Debug perspective and colapse the "this" object,
>        you will see the value of the "select" attribute as null, then no 
> matter you try from the Autocompleter 1 field, been a colors or fruits, if 
> you change it
>       you will see the same thing into the debug.
> That is the issue you need to fix, and it also happens for kind of 
> <sx:autocompleter implementation../> regarding silence submit by <s:url.../>
> Conclusion:
> I can make it works, but the fix for one thing will produce more issues, see 
> that:
> 1o. first change the <s:textfield.../> with "pojo.id" to <input type="hidden" 
> name="pojo.id"> into the index.jsp, than put the  @SkipValidation anotation 
> right above the execute method from the action class 
> "AutocompleterExampleAction", build the project and run it again. You will 
> able to see it working, however this kind of fix, can build others issue for 
> not doing the validation.
> Think about it, now you have what you ask, and I think it is very enough to 
> fix the bug.
> I could done this, but I am very busy with my project and can't go deep into 
> this Dojo stuff.
> Thanks and regards.
> ORIGINAL ISSUE!
> I got three days running on this issue, and now I could identify what happens 
> and when, but I could not say why?
> I'm doing one app with Struts2.1.x, Spring2.5.x, Hibernate3.
> I've been trying to run a autocompleter with valueNotifyTopics to another 
> component such as <s:div and/or <s:autocompleter.
> See my code:
> .jsp
> <form id="formEditar">
> <s:textfield theme="simple" id="id" name="proposta.id" 
> cssStyle="display:none"/>
> <sx:autocompleter 
>    id="condicaoPagamentoId" name="proposta.condicaoPagamento.id" 
>    list="condicaoPagamentoList" keyName="proposta.condicaoPagamento.id" 
> listKey="id"
>    listValue="descricao"
>    valueNotifyTopics="/condicaodepagamento"
>    forceValidOption="true" />
> <s:url var="getParcelas" namespace="/proposta" action="gerarParcelas">
> </s:url> 
>   <sx:div id="divParcelas" href="%{#getParcelas}" 
> listenTopics="/condicaodepagamento" formId="formEditar" autoStart="true">
>   </sx:div>
> </form>
> struts.xml
> <package name="proposta" extends="struts2" namespace="/proposta">
> <action name="gerarParcelas" class="propostaAction" method="gerarParcelas">
>       <interceptor-ref name="defaultStack">
>       <param name="validation.excludeMethods">gerarParcelas</param>
>       </interceptor-ref>
>       <result>/WEB-INF/jsp/proposta/parcelas.jsp</result>
> </action>
> </package>
> Behave 1 at IE7:
> When I open my jsp it isn't sending the value for 
> "proposta.condicaoPagamento.id" to my action, it appears as null, causing an 
> error.
> Behave 2 at IE7:
> I changed the "proposta.id" attribute to be set with <input type="hidden"...> 
> instead <s:textfield...>, so when I open my jsp I got another exception 
> before it reach the action, is was: 
> java.lang.NumberFormatException: For input string: 
> "[Ljava.lang.String;@1d1cd0d"
>       at java.lang.NumberFormatException.forInputString(Unknown Source)
>       at java.lang.Long.parseLong(Unknown Source)
>       at java.lang.Long.parseLong(Unknown Source)
> .....
> ognl.MethodFailedException: Method "setId" failed for object [EMAIL 
> PROTECTED] [java.lang.NoSuchMethodException: setId([Ljava.lang.String;)]
> ....
> expr: proposta.condicaoPagamento.id val: [Ljava.lang.String;@1d1cd0d context: 
> [EMAIL PROTECTED] root:[EMAIL PROTECTED], [EMAIL PROTECTED] value: 
> [Ljava.lang.String;@1d1cd0d
> 2008-06-07 12:29:30,234 ERROR 
> (com.opensymphony.xwork2.interceptor.ParametersInterceptor:24) - 
> ParametersInterceptor - [setParameters]: Unexpected Exception caught setting 
> 'proposta.condicaoPagamento.id' on 'class scoweb.app.action.PropostaAction: 
> Error setting expression 'proposta.condicaoPagamento.id' with value 
> '[Ljava.lang.String;@1d1cd0d'
> 2008-06-07 12:29:30,515 ERROR (org.apache.struts2.dispatcher.Dispatcher:28) - 
> Could not find action or result
> No result defined for action scoweb.app.action.PropostaAction and result input
>       at 
> com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:357)
>       at 
> com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:259)
>                     .............
> The attribute type for Id is set to Long
> private Long Id;
> setId(Long id)...
> Long getId()...
> Behave 3 at Firefox:
> For both cases it's show the same as Behave 2 does.
> I tried to change the attributes from the autocompleter to do like the 
> showcase example, see what happens:
> .jsp
> <s:textfield theme="simple" id="id" name="proposta.id" 
> cssStyle="display:none"/>
> <sx:autocompleter 
>   name="select" 
>   list="{'fruits','colors'}" 
>   value="colors"
>    valueNotifyTopics="/condicaodepagamento"
>    forceValidOption="true" />
> <s:url var="getParcelas" namespace="/proposta" action="gerarParcelas">
> </s:url> 
>   <sx:div id="divParcelas" href="%{#getParcelas}" 
> listenTopics="/condicaodepagamento" formId="formEditar" autoStart="true">
>   </sx:div>
> Behave 1 at IE7 
> The attribute "select" appears as null into the action
> Behave 2 at IE7:
> I changed the "proposta.id" attribute to be set with <input type="hidden"...> 
> instead <s:textfield...>, so when I open my jsp the "select" attribute was 
> right populated.
> Behave 3 at Firefox2.
> In both cases the attribute "select" was filled by the action.
> Now I'm stuck on that and asking for help for you guys.
> NOTE: If just use a <s:select...> component instead <s:autocompleter...> to 
> select the "proposta.condicaoPagamento.id" and ignoring the <s:div...> thing, 
> it just work as should. 
> Thanks and regards,
> Wilson M. Penha Jr. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to