You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by StrutsMailer <bi...@verizon.net> on 2004/12/21 14:16:44 UTC

Struts TestCase and Cactus

I am looking for documentation and best practices for StrutsTestCase and Cactus and interested in hearing how others are testing their web pages written in Struts.
Thanks in advance for your comments and suggestions.
Peter

Re: Problem with and HashMap

Posted by Sunny <su...@collab.net>.
 <logic:iterate id="element" name="hashMap" indexId="index">
    <bean:define id = "vObj"  name="element" property="value" />
    <bean:write name = "vObj" property = "velocity" />
 </logic:iterate>


Peter Neu wrote:

> Hello all,
>
> I have a problem with the <logic:iterate> tag. I need to iterate over a
> HashMap which stores wrapper objects(which include the actual data).
>
> A wrapper class has for example one attribute "velocity". As far
> as I know the only way to access such a HashMap is this method:
>
>  <logic:iterate id="element" name="hashMap" indexId="index">
>     <bean:write name="element" property="key" />
>     <bean:write name="element" property="value" />
>  </logic:iterate>
>
> Is there any way to get the "velocity" attribute out of the wrapper 
> class?
>
> Regards,
>
> Peter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Problem with and HashMap

Posted by Peter Neu <pe...@gmx.net>.
Hello all,

I have a problem with the <logic:iterate> tag. I need to iterate over a
HashMap which stores wrapper objects(which include the actual data).

A wrapper class has for example one attribute "velocity". As far
as I know the only way to access such a HashMap is this method:

  <logic:iterate id="element" name="hashMap" indexId="index">
     <bean:write name="element" property="key" />
     <bean:write name="element" property="value" />
  </logic:iterate>

Is there any way to get the "velocity" attribute out of the wrapper class?

Regards,

Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts and JDK 1.4.2_06

Posted by Mike Darretta <mi...@metnet.navy.mil>.
I performed a quick tweak of the JSP, but still get the same error. 
After more inspection, though, I think your assessment is on target. 
There are a handful of places where the accessor methods are overloaded 
(needlessly), and they typically correspond to my problem properties. I 
will need to do some refactoring later.

Thanks again for the input.
Mike

Mike Darretta wrote:

> Andrew,
>
> BINGO! I looked back, and indeed, the property in question has 
> multiple getters/setters. I'm going to modify the names of the 
> extraneous getters/setters and see if this makes a difference.
>
> Thanks for the tip!
>
> Mike
>
>
> Andrew Hill wrote:
>
>> Ive not seen your code so Ive no idea if this is what you are doing 
>> (probably not from the sound of it), but its been my experience that 
>> when I dont quite follow the bean specs for my getters and setters it 
>> still sometimes works... until I change something else like my JVM 
>> version or add some other property or something at which point it 
>> falls overs.
>>
>> Last time I had something like that I was trying to have two setters 
>> or getters with the same method name but different parameter types. 
>> It worked for a while but then after some other change I found it 
>> stopped working. Removal (renaming) of one of the overloaded setter 
>> methods fixed it.
>>
>> Heres the thread from back in 2002 when I hit this problem:
>> [http://marc.theaimsgroup.com/?l=struts-user&m=102696975022454&w=2]
>>
>> hth
>> Andrew
>>
>> Mike Darretta wrote:
>>
>>> Has anyone else experienced any issues with Struts (current release) 
>>> and JDK 1.4.2_06? I have found my second 'oddity' with JDK release 06.
>>>
>>> My previous post showed that a form property named "currentView" 
>>> caused the infamous "no getter method for property ..." error. When 
>>> I changed the property name and accessor, all was well. Now, I have 
>>> experienced another issue with a form property.
>>>
>>> In this case, my form property "cmd" - used to differentiate submit 
>>> actions - works for one html:submit button, but fails for another. 
>>> The one that fails generates the ever-frustrating:
>>>
>>> BeanUtils.populate: javax.servlet.ServletException: BeanUtils.populate
>>>     at 
>>> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:497)
>>>     at 
>>> org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798) 
>>>
>>>     at 
>>> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205) 
>>>
>>>        ...
>>>
>>> Fortunately, I was able to get around this issue fairly easily....
>>>
>>> Please, if anyone else finds any strange behavior with release 06, 
>>> please let us know.
>>>
>>> Thanks!
>>> Mike
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts and JDK 1.4.2_06

Posted by Mike Darretta <mi...@metnet.navy.mil>.
Andrew,

BINGO! I looked back, and indeed, the property in question has multiple 
getters/setters. I'm going to modify the names of the extraneous 
getters/setters and see if this makes a difference.

Thanks for the tip!

Mike


Andrew Hill wrote:

> Ive not seen your code so Ive no idea if this is what you are doing 
> (probably not from the sound of it), but its been my experience that 
> when I dont quite follow the bean specs for my getters and setters it 
> still sometimes works... until I change something else like my JVM 
> version or add some other property or something at which point it 
> falls overs.
>
> Last time I had something like that I was trying to have two setters 
> or getters with the same method name but different parameter types. It 
> worked for a while but then after some other change I found it stopped 
> working. Removal (renaming) of one of the overloaded setter methods 
> fixed it.
>
> Heres the thread from back in 2002 when I hit this problem:
> [http://marc.theaimsgroup.com/?l=struts-user&m=102696975022454&w=2]
>
> hth
> Andrew
>
> Mike Darretta wrote:
>
>> Has anyone else experienced any issues with Struts (current release) 
>> and JDK 1.4.2_06? I have found my second 'oddity' with JDK release 06.
>>
>> My previous post showed that a form property named "currentView" 
>> caused the infamous "no getter method for property ..." error. When I 
>> changed the property name and accessor, all was well. Now, I have 
>> experienced another issue with a form property.
>>
>> In this case, my form property "cmd" - used to differentiate submit 
>> actions - works for one html:submit button, but fails for another. 
>> The one that fails generates the ever-frustrating:
>>
>> BeanUtils.populate: javax.servlet.ServletException: BeanUtils.populate
>>     at 
>> org.apache.struts.util.RequestUtils.populate(RequestUtils.java:497)
>>     at 
>> org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798) 
>>
>>     at 
>> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205) 
>>
>>        ...
>>
>> Fortunately, I was able to get around this issue fairly easily....
>>
>> Please, if anyone else finds any strange behavior with release 06, 
>> please let us know.
>>
>> Thanks!
>> Mike
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts and JDK 1.4.2_06

Posted by Andrew Hill <an...@gridnode.com>.
Ive not seen your code so Ive no idea if this is what you are doing 
(probably not from the sound of it), but its been my experience that 
when I dont quite follow the bean specs for my getters and setters it 
still sometimes works... until I change something else like my JVM 
version or add some other property or something at which point it falls 
overs.

Last time I had something like that I was trying to have two setters or 
getters with the same method name but different parameter types. It 
worked for a while but then after some other change I found it stopped 
working. Removal (renaming) of one of the overloaded setter methods 
fixed it.

Heres the thread from back in 2002 when I hit this problem:
[http://marc.theaimsgroup.com/?l=struts-user&m=102696975022454&w=2]

hth
Andrew

Mike Darretta wrote:

> Has anyone else experienced any issues with Struts (current release) and 
> JDK 1.4.2_06? I have found my second 'oddity' with JDK release 06.
> 
> My previous post showed that a form property named "currentView" caused 
> the infamous "no getter method for property ..." error. When I changed 
> the property name and accessor, all was well. Now, I have experienced 
> another issue with a form property.
> 
> In this case, my form property "cmd" - used to differentiate submit 
> actions - works for one html:submit button, but fails for another. The 
> one that fails generates the ever-frustrating:
> 
> BeanUtils.populate: javax.servlet.ServletException: BeanUtils.populate
>     at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:497)
>     at 
> org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798) 
> 
>     at 
> org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205) 
> 
>        ...
> 
> Fortunately, I was able to get around this issue fairly easily....
> 
> Please, if anyone else finds any strange behavior with release 06, 
> please let us know.
> 
> Thanks!
> Mike
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Struts and JDK 1.4.2_06

Posted by Mike Darretta <mi...@metnet.navy.mil>.
Has anyone else experienced any issues with Struts (current release) and 
JDK 1.4.2_06? I have found my second 'oddity' with JDK release 06.

My previous post showed that a form property named "currentView" caused 
the infamous "no getter method for property ..." error. When I changed 
the property name and accessor, all was well. Now, I have experienced 
another issue with a form property.

In this case, my form property "cmd" - used to differentiate submit 
actions - works for one html:submit button, but fails for another. The 
one that fails generates the ever-frustrating:

BeanUtils.populate: javax.servlet.ServletException: BeanUtils.populate
	at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:497)
	at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)
	at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205)
        ...

Fortunately, I was able to get around this issue fairly easily....

Please, if anyone else finds any strange behavior with release 06, please let us know.

Thanks!
Mike




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts TestCase and Cactus

Posted by Bill Siggelkow <bi...@bellsouth.net>.
StrutsMailer wrote:

> I am looking for documentation and best practices for StrutsTestCase and Cactus and interested in hearing how others are testing their web pages written in Struts.
> Thanks in advance for your comments and suggestions.
> Peter

Peter,

There was a recent article on OnJava that discusses testing Struts with 
Cactus. It can be found online at 
http://www.onjava.com/pub/a/onjava/2004/09/22/test-struts.html. Also, 
<blatant-plug> the Jakarta Struts Cookbook 
(http://www.oreilly.com/catalog/jakartastrutsckbk)</blatant-plug> has an 
entire chapter on testing Struts. You might also want to check out 
Struts - The Complete Reference -- it also has a chapter on testing.

Let me know if you have some specific questions; I will be glad to help 
if I can.

-Bill Siggelkow


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org