⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 random.jsp

📁 jakarta-taglibs
💻 JSP
字号:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<%@ page session="false" %>
<%@ taglib uri="http://jakarta.apache.org/taglibs/random-1.0" prefix="rand" %>
     <head>
	  <title>Example JSP for the Random taglib</title>
     </head>
     <body bgcolor="#FFFFFF">
	<p>Create a random number between 10000000 and 99999999<br/>
	<rand:number id="random" range="10000000-99999999"/><br/>

	<jsp:getProperty name="random" property="random"/></p>

	<p>Create a random float value<br/>
	<rand:number id="floater" range="0-1"/><br/>

	<jsp:getProperty name="floater" property="random"/></p> 

	<p>Create a random number between 25 and 100<br/>
	<rand:number id="num25" range="25-100"/><br/>

	<jsp:getProperty name="num25" property="random"/></p>

	<p>Create the same  random number between 25 and 100, only use the 
	algorithm and provider attributes to indicate the use of a SecureRandom
	object instead of a Random object<br/>
	<rand:number id="num25sec" range="25-100" algorithm="SHA1PRNG" provider="SUN"/><br/>

	<jsp:getProperty name="num25sec" property="random"/></p>

	<p>Create a random string of all the characters and digits<br/>
	<rand:string id="random1" charset="all"/><br/>

	<jsp:getProperty name="random1" property="random"/></p>

	<p>Get another random string same as above using the jsp:getProperty tag again<br/>

	<br/><jsp:getProperty name="random1" property="random"/></p>

	<p>Create the same random string of all the characters and digits, only use
	the algorithm and provider attributes to indicate the use of a SecureRandom
	object instead of a Random object<br/>
	<rand:string id="random1sec" charset="all" algorithm="SHA1PRNG" provider="SUN"/><br/>

	<jsp:getProperty name="random1sec" property="random"/></p>

	<p>Create a random string that is the default 8 chars long that uses the charset a-zA-Z0-9<br/>

	<rand:string id="rand" charset="a-zA-Z0-9"/><br/>

	<jsp:getProperty name="rand" property="random"/></p>

	<p>Create a random string 15 lowercase letters long<br/>

	<rand:string id="random2" length="15" charset="a-z"/><br/>

	<jsp:getProperty name="random2" property="random"/></p>

	<p>Create a random string with only caps<br/>

	<rand:string id="random3" charset="A-Z"/><br/>

	<jsp:getProperty name="random3" property="random"/></p>

	<p>Create a random string 10 characters long with the charset a-fF-K ! \\ $ % # ^ \- * ? notice that the - and \ had to be escaped with a \
	<br/>
	<rand:string id="last" length="10" charset="a-fF-K ! \\ $ % # ^ \- * ?"/>
	<br/>

	<jsp:getProperty name="last" property="random"/></p>

	<p>Get another random string same as above with the jsp:getProperty tag<br/>

	<br/><jsp:getProperty name="last" property="random"/></p>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -