Clicky

Java - JSTL, random number between values

August 28, 2014

Add the bellow tag to your jsp page:

<jsp:useBean id="random” class="java.util.Random” scope="application”/>

, and the followin tag to generate your random number:

${random.nextInt(N)}
Particular case:
Generate a random number, between 1 and 4, in order to display a different background at each page refresh: