• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Looping in jstl with condition choosing by String From the List

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello i have folder for images and all image names and attributes are added in a List, the main problem i would like to loop in the List and choose only images that are specific for some kind, as example in the Photo folder i have photos for 1.spices,2.beverages,3.chess and so on. please check the list<> i want to upload all images in the same folder and when needed want to show just the section of chess or Spices, the main issue regarding JSTL, i tried and got all the images, i added some conditions but now i'm confused, so please if you can help show me the right way i will be pleased






[/code]
 
Bartender
Posts: 667
14
TypeScript Fedora
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's probably a much better idea to organize it in the servlet, then you can have your sections for different types with their own array of items.  
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Al Hobbs wrote:It's probably a much better idea to organize it in the servlet, then you can have your sections for different types with their own array of items.  



If you do not wish to antagonize the Bear, use the JSP as a View Template and put the Model Data into JavaBeans created and managed by a Controller Servlet. If you put logic on the View Template (JSP), you will offend him.

Actually, although I prefer other frameworks, no matter which framework you use, don't put logic on the View. When you do this A) it's a   to debug, since JSPs are not designed to be executed/debuggable code units and B) you've created a "Treasure Hunt" situation where you have to bop around looking for what gets done where. Was it in the JSP? Was it in the servlet? Ganesha help me! It's both! if I change it here, I have to remember to change the corresponding other part over there! And forget about sharing the resource anywhere else, because then you're hunting Easter Eggs.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:
If you do not wish to antagonize the Bear, use the JSP as a View Template and put the Model Data into JavaBeans created and managed by a Controller Servlet. If you put logic on the View Template (JSP), you will offend him.



Never poke the bear!

Seriously, head over to this article to read about how Java servlet/JSP apps should be organized.
 
Quick! Before anybody notices! Cover it up with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic