Samuel Castillo Romero wrote:
Samuel Castillo Romero wrote:
I have been thinking about the problem and I think that the problem is in JSP file (lista.jsp) but I don't know how I can do a JSP file where it shows me a list of students that I have saved into the database before!
Samuel Castillo Romero wrote:
As you can see, there is a method called "lista" and there is where is the error, particularly, this is the error: alumnos = alumnoDao.lista();
The question is that I'm not really sure that this is the error because I have some JUNIT test wich use this function and it works nice.
Samuel Castillo Romero wrote:
Thank you for your help. I'm trying to fix this error since two weeks and I am so overwhelmed
Lucas Mireles wrote:Joe is correct ... In reality all you should need to do is just
unless like he asked if your delegating to Spring to initialize.
Lucas Mireles wrote:Its probably because how your accessing the list.
In your JSP you say value is alumnos ... but you dont have a getter for alumnos you have a getter for lista.
So either change your jsp or change the action and provide a getAlumnos
-Lucas
Lucas Mireles wrote:
In your JSP you say value is alumnos ... but you dont have a getter for alumnos you have a getter for lista.
Joe Ess wrote:
Lucas Mireles wrote:
In your JSP you say value is alumnos ... but you dont have a getter for alumnos you have a getter for lista.
I think you are looking at his DAO class, which has a getter for lista. His action class does have a getAlumnos method.
The original error was caused by the alumnoDao instance on line 38 of AlumnoAction being null. Initialising alumnos does not fix this problem.
@Samuel: Since you are new at this, how about learning one technology at a time? Start with a basic Struts (or Spring or Hibernate) app, get proficient with it, then add another piece to the puzzle. If you expect to throw everything together without understanding how each piece works, you are in for a long, painful process.
Lucas Mireles wrote:Your dao is null.
alumnoDao.lista()
So you probably need to initialize it
Joe Ess wrote:I will say it again (I think this is #3): alumnoDao is null. You need to initialise it.
I have put this new line to initialise it (private AlumnoDao alumnoDao = new AlumnoDaoHibernate();) but it does not work, I have the same error.
Joe Ess wrote:
I have put this new line to initialise it (private AlumnoDao alumnoDao = new AlumnoDaoHibernate();) but it does not work, I have the same error.
That should fix the problem I'm thinking of. Are you sure it is the same error? Check the stack trace.
Joe Ess wrote:Do you have much experience with Java?
No. No. No. No. Changed my mind. Wanna come down. To see this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|