This is my server-side class
public class DefinitionT implements java.io.Serializable {
private int id;
private String value;
.....
The two fields in the class have getters and setters. On the JSP side, I have a variable declared as
<script type="text/javascript">
var g_definitions="<s:property value="definitions"/>";
</script>
In my Struts Action, there is a getter method called getDefinitions which returns a list of DefinitionT objects.
In my JavaScript code, I have the following snippet:
for (var i = 0; i < 2; i++) {
$("#definitionsDiv").append(g_definitions[i].value);
}
Initially, I was attempting to determine the number of objects in the list but g_definitions.size is showing "Undefined". When trying to access g_definitions[0].value, it also shows undefined. How should I appropriately handle this list?