This week's book giveaway is in the OCP forum.
We're giving away four copies of OCP Java SE 8 Programmer II Exam Study Guide and have Kathy Sierra, Bert Bates, & Elizabeth Robson on-line!
See this thread for details.
Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Show one by one elements of enum in JSP  RSS feed

 
Ranch Hand
Posts: 1079
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I would like to show one by one each element of an enumeration, in my .JSP

It is a simulation of an online shop, all the element are hard coded in en enum. I would like to have two buttons in my JSP and go next and back in the list.

I have done something like this:




That counter should represents every item from the enum, and from the . JSP when I click next increment the counter and when back decrement it.


       

Any idea, for the implementation, please?

Regards, Isaac

 
Isaac Ferguson
Ranch Hand
Posts: 1079
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using a hidden value, maybe could be a good approach...
 
Isaac Ferguson
Ranch Hand
Posts: 1079
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I made it, this way



 
Author and ninkuma
Marshal
Posts: 66535
160
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As this is as stuff that can be handled after the page is loaded, I would have handled it all in JavaScript.
 
Isaac Ferguson
Ranch Hand
Posts: 1079
3
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes in Javascript it makes more sense....I am not used to javascript, is it there any script for this? Or can it been done in Java?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66535
160
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java is on the server; page manipulation happens in JavaScript. If you are going to be working on the web, you need to up your JavaScript game. And soon. The days of doing all the work on the server are coming to an end. In fact, I'd argue that they've already ended.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!