Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Multiple level logic:iterate

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi to all.

This is my first message in this forum, please sorry for the english..:P

I have this two classes:


And the other one:


What I have to do is display the collection of "Spettacolo" mapped in the database with hibernate. So I create an action wich loads the collection in the session and then in the jsp I do this:


I can display the property "nome" "descrizione" but when I have to deal with the collection property everything goes wrong, it gives me a jasperexeception in the second iterate and I can't find a solution.

Please someone help me, I'm desperate, is being two days that I'm stuck here.
 
Ranch Hand
Posts: 213
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the error message?
 
Richard Golebiowski
Ranch Hand
Posts: 213
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried out your code and it worked. Hawever if dateRappresentazione is null I get the following errror:

org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: No collection found
 
andrea casini
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Richard Golebiowski wrote:I tried out your code and it worked. Hawever if dateRappresentazione is null I get the following errror:

org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: No collection found



LOL..Thanks for your reply..
So the problem may be in the action anyway I get this error:

The code of the action is the following:


And the method "getAll":

 
Richard Golebiowski
Ranch Hand
Posts: 213
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are getting to the JSP page then the error is somewhere on the page. When I've gotten errors similar to what you are displaying, the error is usually somewhere else on the page, not in the lines displayed on the error message. Try removing everything from the JSP so that the JSP page loads and then adding things it back piece by piece until the error occurs.
 
andrea casini
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Richard Golebiowski wrote:If you are getting to the JSP page then the error is somewhere on the page. When I've gotten errors similar to what you are displaying, the error is usually somewhere else on the page, not in the lines displayed on the error message. Try removing everything from the JSP so that the JSP page loads and then adding things it back piece by piece until the error occurs.



It seems that the error is actually a lazyinitialition and struts could'nt see the list "dateRappresentazione". So I set "fetch = FetchType.EAGER" in the "Spettacolo" beans and it WORKED. How do you get this working without setting the fethtype?

Anyway now I have another problem..
It display in the jsp as many object as many are contained in the list "dateRappresentazione". I don't know why, maybe because of the syntax of logic iterate.
 
Richard Golebiowski
Ranch Hand
Posts: 213
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


It seems that the error is actually a lazyinitialition and struts could'nt see the list "dateRappresentazione". So I set "fetch = FetchType.EAGER" in the "Spettacolo" beans and it WORKED. How do you get this working without setting the fethtype?



Good catch on the problem. FetchType is a Hibernate setting, and I'm not that experienced with Hibernate so I can't answer your question. Any questions about that setting should be posted in the Object Relational Mapping forum.



It display in the jsp as many object as many are contained in the list "dateRappresentazione". I don't know why, maybe because of the syntax of logic iterate.


If you are saying that it is displaying everything in the list then the iterate is working correctly. If you only want to display a certain part of the list you will need to change the logic.
reply
    Bookmark Topic Watch Topic
  • New Topic