How to use s:iterator s:include s:param

2019-02-16 Thread albert kao
This display properly:

  

  


I refactor to the following two files, which display nothing.
I have other codes in items.jsp which confirms that items.jsp is being used
in showitems.jsp.
Please help.
Thanks.

items.jsp:



  

  




showitems.jsp:

  



RE: Array of submit buttons

2019-02-16 Thread Yasser Zamani
>From: Prasanth 
>Sent: Friday, February 15, 2019 3:02 AM
>To: Struts Users Mailing List 
>Subject: Array of submit buttons
>
>Hi,
>
>I have a form with tabular data and need to have delete buttons for each row. 
>So
>have a ArrayList in the action and the form has name="delete[%{#rowNumber}]" value="Delete"/> inside an iterator. When the
>user clicks on the Delete button the ArrayList was not populated. So
>changed the ArrayList to a Map. Interestingly the map is populated but the 
>value
>in the map is a String array, rather than a single String, with one element 
>having
>string Delete.
>
>Do s:submit work differently from s:textfield when it comes to saving data to
>ArrayList or Map?


No, AFAIK finally both are http parameters.

I expect ArrayList to work also e.g. for rowNumber=3, I expect delete={null, 
null, null, "Delete"} :( Could you please set devMode and increase log levels 
to WARN and check the output? What Struts version do you use?

Regards.


RE: Map backed form

2019-02-16 Thread Yasser Zamani
I think a file named yourActionClass-conversion.properties beside your action 
with following contents should help [1]:

Key_xxx=java.lang.Long
Element_xxx=java.lang.Double

(where xxx is the field name of the collection property in your action or 
object)

Regards.

[1] 
https://struts.apache.org/core-developers/type-conversion.html#collection-and-map-support

>-Original Message-
>From: Prasanth 
>Sent: Friday, February 15, 2019 9:08 PM
>To: user@struts.apache.org
>Subject: Re: Map backed form
>
>Does struts follow a specific logic as to what the data type of the object 
>would be
>based on user input? Meaning when is it converted to a Double vs Integer vs
>String?
>
>Thanks,
>Prasanth
>
>On 2/15/19 7:45 AM, Lukasz Lenart wrote:
>> pt., 15 lut 2019 o 00:17 Prasanth  napisaƂ(a):
>>> I have a map (Map) but based on the data entered by the
>>> user the value in the Map is Double or String. Example if the user enters a
>value of 10 then it is coming in as double but if the user enters 10.5 then a 
>string
>is present in the value. Does Struts2 look at the data types of the key and 
>value of
>the map and set the key and values in the map accordingly?
>> Struts is not a problem here, generic types are erased at runtime, so
>> basically this a Map at the end
>> https://docs.oracle.com/javase/tutorial/java/generics/erasure.html
>>
>>> If not, what is the best practice for the declaration of Map, is there a 
>>> way to
>force Struts2 to only have Double objects as values?
>> I would probably use a custom type instead of Double and implement
>> converter for it, or even replace the Map with a List of custom
>> objects.
>>
>>
>> Regards