Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Example for working this out.

 
Cathy Latte
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys do you have any link that like

for example: The user enter number 1 in the textfield and when onclick right, it will show the number 1 image on another jsp page. And if the user enter number 2, it will show the number 2 image. I placed the images in database.

Is it something to do with like for loop that is embedded inside the jsp or is it using swich case?

Thanks
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well, since you only want to show one single picture according to what the user entered as a number, there is no need for a for loop ...

you would want sth like that
 
Cathy Latte
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Is this from the datbase?

Thanks!
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh, sorry i missed that part ...

in this case, direct the action of the form to a servlet, read the parameter using request.getParameter("number") and lookup your image in the database using JDBC ...

alternatively, you can use the JSTL SQL tag libraries in your jsps, however, usually database calls are considered business logic and hence does not belong in a jsp file.
 
Cathy Latte
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it we have to generate getter and setter and in the servlet page we have to use the getter method to get the image like for example request.getParameter("number") and the user type in 2 the number2 image from database wil display out.


Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic