This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Display picture dynamically using outputstrem

 
Avik Mazunder
Ranch Hand
Posts: 39
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to implement a search page where users names will show along with their photos which are stored in db as blob



My xhtml page


but i am getting the following exception


but my arraylist is getting populated as I am getting the names. Then how can it get index out of bound exception..please help..I have been stuck in this code for 4 days...!
 
Jayesh A Lalwani
Rancher
Posts: 2756
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem may be in a list that you don't expect.

Look at the exception. It gives you a line number inside your code. Look at that line. Are you using a list there? What are yo78u doing in line number 269 of MessageSendBean
 
Avik Mazunder
Ranch Hand
Posts: 39
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the exception is in this line

 
Jayesh A Lalwani
Rancher
Posts: 2756
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are there any lists in that line?
 
Avik Mazunder
Ranch Hand
Posts: 39
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getUser() method is the getter of the arraylist..!
 
Jayesh A Lalwani
Rancher
Posts: 2756
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, if the exception says that the line contains an array list with size=0, and getUsers is the only list in that line, then it must follow that get Users returns a list with 0 elements. You should look at what getUsers returns and how it's populated. You haven';t posted the code that populates the users list. If you post that code, it will help.
 
Avik Mazunder
Ranch Hand
Posts: 39
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is in the 12th line of javabean code
 
Avik Mazunder
Ranch Hand
Posts: 39
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please me...! is there any other method to display blob image in jsf page other than this....!! please please please help me...!
 
Tim Holloway
Saloon Keeper
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The simplest and most portable way to display an image on a JSF View is to use the h:graphicImage tag, where you supply a URL which in turn invokes a servlet that will return the image you want.

However, for RichFaces users the a4j:mediaOutput tag can be very useful. It is, however, a challenge to get working right.

Some things that will probably make the job easier:

1. Consider using a h:dataTable instead of an a4j:repeat. Or at least consider using a ui:repeat, if you cannot be persuaded to use a dataTable. There is no virtue in using obsolete extensions to JSF once the functions they provide have become incorporated into the standard.

2. Don't attempt to do all the work in paint1 in a single line of code. The compiler isn't going to make less efficient code if you break it up into multiple statements, and it is easier to debug if the functions are all separate statements where a debugger can examine what each one does one at a time.

 
Avik Mazunder
Ranch Hand
Posts: 39
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks... I implemented that by using h:graphicImage and servlet...!! Thanks once again..!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic