File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes not getting list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "not getting list" Watch "not getting list" New topic
Author

not getting list

Swapna latha
Ranch Hand

Joined: Dec 18, 2011
Posts: 70
hai i am having the doubt on getters and setters.

I have Messages.java as follows:



I have UserLoginServiceImpl.java



I am not getting the list of items in service implementation class. I think theres a problem in getter in Message. java


Thanks & Regards
Swapna
Manoj Kumar Jain
Ranch Hand

Joined: Aug 22, 2008
Posts: 191

Can you post only code that is required and running, there is lot of commented code that makes reading hard.
Also please mention the line no where the output is expected and what you are getting..


Do not wait to strike till the iron is hot; but make it hot by striking....
Manoj Kumar Jain
Ranch Hand

Joined: Aug 22, 2008
Posts: 191

Many times I experienced that eclipse doesn't work with getter/setter when we create them manually.
Its better to delete your getter/setter and create them again with Eclipse.
Swapna latha
Ranch Hand

Joined: Dec 18, 2011
Posts: 70
Messages.java



This Messages.java is working fine

UserLoginServiceImpl.java



In service implementation class i am unable to get the list from getMessages of Messages.java. I am getting the size as zero. I want to get the list from Messages.java to ServiceImpl class.

Why i am not getting the list ?

Thanks & Regards
Swapna
Manoj Kumar Jain
Ranch Hand

Joined: Aug 22, 2008
Posts: 191



If you are talking about this code snap ? I can't see anywhere you initialized the value of messages ArrayList. If you haven't add any value to this list then how this can return you something.
Swapna latha
Ranch Hand

Joined: Dec 18, 2011
Posts: 70
ya i am not understanding manoj exactly. help me please.
Manoj Kumar Jain
Ranch Hand

Joined: Aug 22, 2008
Posts: 191

Your problem is that you are not getting data from the list..right ?
So, Just check in your code where you are filling that list..where are you adding data in that list..
Swapna latha
Ranch Hand

Joined: Dec 18, 2011
Posts: 70
ya i am adding the list values in Messages.java. I want to retrieve the values in service class from the method getMessages()

Regards
Swapna
Manoj Kumar Jain
Ranch Hand

Joined: Aug 22, 2008
Posts: 191

Swapna latha wrote:ya i am adding the list values in Messages.java. I want to retrieve the values in service class from the method getMessages()

Hey I am confused here, am I missing something?
In the line 67 you are creating a new object of Messages class
that's correct but where you have add the values in that messges object for the list ? I cant see anything in the constructor as well.
Swapna latha
Ranch Hand

Joined: Dec 18, 2011
Posts: 70
Manoj Kumar Jain wrote:
Swapna latha wrote:ya i am adding the list values in Messages.java. I want to retrieve the values in service class from the method getMessages()

Hey I am confused here, am I missing something?
In the line 67 you are creating a new object of Messages class
that's correct but where you have add the values in that messges object for the list ? I cant see anything in the constructor as well.


I have resolved the issue. Any Thanks for sparing time

Regards
Swapna
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: not getting list