• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Setting an object with c:set from sessionScope

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Through sessionScope I have an object SessionData in which has a Customer object within.

I create a variable customer by the following c:set
<c:set value="${sessionScope.sessionData.customer}" var="customer"></c:set>
This one work perfectly. I am able to access the getters in customer, ${customer.name}

Then I try to create List1 from an object within the customer object(AnObject) of java.util.List
<c:set value="${customer.anObject.aList}" var="List1"></c:set>

When I try to iterate this list I get an error
<c:forEach items="List1" var="agr">
${agr.aNumber }
</c:forEach>


Unable to find a value for "aNumber" in object of class "java.lang.String" using operator "."



When I try to access the List1.getSize() with ${List1.size} I get the following error.


The "." operator was supplied with an index value of type "java.lang.String" to be applied to a List or array, but that value cannot be converted to an integer.



I am trying to create pure JSP and JSTL instead of struts logic
<bean:define id="sessionBean" name="sessionData" scope="session" />
<bean:define id="customer" name="sessionBean" property="customer" type="Customer" />
<bean:define id="List1" name="customer" property="anObject.aList" type="java.util.List" />
 
Marshal
Posts: 67363
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

items="List1"



Carefully examine this attribute. Is it doing what you think it is?
 
Sverre Moe
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I must be getting alsheimer... ${List1} it should be....
 
Bear Bibeault
Marshal
Posts: 67363
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sometimes it just takes somebody leaning over your shoulder...

I call it the "what's that semi-colon doing there?" syndrome.
 
You got style baby! More than this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!