Hi,

It looks like you are right Raffy. The first here is the result of using
1.1-b2 (does not work) -

<td align=CENTER>
<input type="submit" name="cmd"[17] value="Approve" class="tableButton"
title="help text for approvescreen.button.approve">
</td>

and this is what results using 1.1-b1 (works fine) -

<td align=CENTER>
<input type="submit" name="cmd[12]" value="Approve" class="tableButton"
title="help text for approvescreen.button.approve" alt="???en_GB.null???">
</td>

I guess it is a bug ?

Dan
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 19 August 2002 20:38
To: Struts Users Mailing List
Subject: Re: upgrade 1.1-b1 to 1.1-b2 breaks indexed attribute under
iterate ?



Take a look at your source code (view jsp source)

The source being generate for the submit button is

     <input type="submit" name="cmd"[0] value="Edit">

where the [0] is outside the quotes.

The generated code should be

     <input type="submit" name="cmd[0]" value="Edit">

With the currently generated source, when the form is submitted, beanUtils
looks for a setCmd(String value) method instead of setCmd(int index, String
 value).

Is it a bug?








Daniel Haynes <[EMAIL PROTECTED]> on 08/19/2002 10:31:39 AM

Please respond to "Struts Users Mailing List"
      <[EMAIL PROTECTED]>

To:   "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
cc:
Subject:  upgrade 1.1-b1 to 1.1-b2 breaks indexed attribute under iterate ?


Hi All,

I've been attempting to upgrade a web app from jakarta-struts-1.1-b1 to
jakarta-struts-1.1-b2.zip and it appears to be breaking some code.

Specifically a piece of code 'Using the Indexed Attribute in the Scope of
the Iterate Tag' (as in 'Using Struts' by Maturo).

jsp:-

<logic:iterate id="approvalList" collection="<%= approvals %>">
...
<td align=CENTER>
<html:submit indexed="true" property="cmd" value="Details"
styleClass="tableButton" titleKey="approvescreen.button.details"/>
</td>

ActionForm: -

private int index;
private String cmd;

public void setCmd(int index, String value)
{
   this.index = index;
   cmd = value;
  }
  public String getCmd(int index)
  {
   return cmd;
  }
  public String getCmd()
  {
   return cmd;
  }
  public int getIndex()
  {
   return index;
  }

When changing from jakarta-struts-1.1-b1 to jakarta-struts-1.1-b2 I get a
browser error:


java.lang.reflect.InvocationTargetException: Cannot set cmd
 at
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:922)
 at
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:726)
 at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:978)
 at
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j

ava:779)
 at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:246)
 at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
 at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application

FilterChain.java:247)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh

ain.java:193)
 at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja

va:243)
 at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5

66)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
 at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
 at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja

va:190)
 at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5

66)
 at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2

46)
 at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5

64)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
 at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
 at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
 at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180

)
 at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5

66)
 at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.

java:170)
 at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5

64)
 at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170

)
 at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5

64)
 at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
 at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5

64)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
 at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
 at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java

:174)
 at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5

66)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
 at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
 at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:

1012)
 at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107

)
 at java.lang.Thread.run(Thread.java:536)
Caused by: java.lang.NoSuchMethodException: Property 'cmd' has no setter
method
 at
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.j

ava:1643)
 at
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.j

ava:1545)
 at
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:15

74)
 at
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:919)

By using the 'old' files (for 1.1-b1): struts.jar, commons-beanutils.jar
and
commons-digester.jar (with all others from1.1-b2) I do not get an error and
the code works fine.

Does anyone know why this happens and what I need to do to fix the code to
work under 1.1b2 ?

many thanks



Dan


Daniel Haynes



--
To unsubscribe, e-mail:   <
mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <
mailto:[EMAIL PROTECTED]>






**********************************************************************
Please Note:
The information in this E-mail message, and any files transmitted
with it, is confidential and may be legally privileged.  It is
intended only for the use of the individual(s) named above.  If you
are the intended recipient, be aware that your use of any confidential
or personal information may be restricted by state and federal
privacy laws.  If you, the reader of this message, are not the
intended recipient, you are hereby notified that you should not
further disseminate, distribute, or forward this E-mail message.
If you have received this E-mail in error, please notify the sender
and delete the material from any computer.  Thank you.
**********************************************************************




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to