Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to increment the variable in a JSP during button click.  RSS feed

 
Rajesh Manoharan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am new to JSP. I have the following doubt please help me out. please.

I have a string array.

ex: sample[] = {"one"."two","three"};

I need to display the value of this array. one value at a time in a same jsp page. The jsp page contains a button.
when i click the button it should redirect to the same page and the next value should be printed.


I got the logic for the redirecting to the same page.

Please help me in printing first, second and third value of this array on corresponding visit of the particular JSP page.
 
bhanu chowdary
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Put a counter as an attribute in the most appropriate scope and increment it with each hit of the submit button, use this to identify the index of the array.

Just a thought, there may be a better way than this.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!