checkbox在jsp中的使用方法

checkboxjsp中的使用方法

本文作者:佚名

所屬分類:網絡編程

加入時間:2006-1-19

點擊次數:396

<%@ page language="java" contentType="text/html" %>

<%@ page import="com.ora.jsp.util.*" %>

<html>

<body bgcolor="white">

<form action="checkbox.jsp">

<input type="checkbox" name="fruits" value="Apple">Apple<br>

<input type="checkbox" name="fruits" value="Banana">Banana<br>

<input type="checkbox" name="fruits" value="Orange">Orange<br>

<input type="submit" value="Enter">

</form>

<%

String[] picked = request.getParameterValues("fruits");

if (picked != null && picked.length != 0) {

%>

You picked the following fruits:

<form>

<input type="checkbox" name="fruits" value="Apple"

<%= ArraySupport.contains(picked, "Apple") ?

"checked" : "" %> >Apple<br>

<input type="checkbox" name="fruits" value="Banana"

<%= ArraySupport.contains(picked, "Banana") ?

"checked" : "" %> >Banana<br>

<input type="checkbox" name="fruits" value="Orange"

<%= ArraySupport.contains(picked, "Orange") ?

"checked" : "" %> >Orange<br>

</form>

<% } %>

</body>

</html>

 

源文檔 <http://cache.baidu.com/c?word=checkbox%2Cjsp&url=http%3A//www%2Esun116%2Ecn/htm/7850%2Easp&b=51&a=19&user=baidu>

 

 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章