¹ØÓÚ¸´Ñ¡¿òµÄÑéÖ¤ÓëjspÈ¡Öµ(תÔØ)
±íµ¥ÈçÏ£º
<form name="form1" action="test.jsp" method="post" onsubmit="return checkData();">
<input name="checkall1" type="checkbox" value="0" onClick="checkAllBox(this);"/>È«Ñ¡<br>
<input name="answer" type="checkbox" value="a"/>A<br>
<input name="answer" type="checkbox" value="b"/>B<br>
<input name="answer" type="checkbox" value="c"/>C<br>
<input name="answer" type="checkbox" value="d"/>D<br>
<input name="answer" type="checkbox" value="e"/>E<br>
<input name="answer" type="checkbox" value="f"/>F<br>
</form>
È«Ñ¡¼°ÑéÖ¤javascriptÈçÏ£º
<script type="text/javascript">
function checkAllBox(obj){
var answer= document.getElementsByName("answer");
if(obj.checked==true){
for(var i=0;i<answer.length;i++){
answer[i].checked = true;
}
}else{
for(var i=0;i<answer.length;i++){
answer[i].checked = false;
}
}
}
function checkData(){
var answer= document.getElementsByName("answer");
var flag = false;
for(var i=0;i<income.length;i++){
if(income[i].checked == true){
flag = true;
break;
}
}
if(!flag){
alert("ÇëÖÁÉÙÑ¡ÔñÒ»Ïî");
}
return flag;
}
</script>
test.jspÖÐÈ¡ÖµÈçÏ£º
String[] answer= request.getParameterValues("answer");//ÕâÀïֻȡµÃÁËÑ¡ÖеÄÏÈç¹ûûÓÐÑ¡ÖÐÈκÎÒ»ÏÔòΪnull
if(answer!=null){
for(String i:answer){
System.out.println(i);
}
}
Ïà¹ØÎĵµ£º
1. jspÒ³ÃæÏÔʾÖÐÎÄÂÒÂ룺
jspÒ³ÃæµÄ±àÂ뷽ʽÓÐÁ½¸öµØ·½ÐèÒªÉèÖãº
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page contentType="text/html;charset=utf-8"%>
ÆäÖУºpageEncoding Ö¸µÄÊÇjspÎļþ±¾É ......
<%@page import="com.opensymphony.xwork2.util.ValueStack"%><%
ValueStack vs = (ValueStack)request.getAttribute("struts.valueStack");
String aa = (String)vs.findValue("downloadContent");
response. ......
¡¡¡¡1 MySQL´æ´¢´óÈÝÁ¿µÄ¶þ½øÖÆÎļþµÄ¸ñʽÊÇblob£¬Æäʵ³ýÁËͼƬ»¹¿ÉÒÔ´æ±ðµÄ
¡¡¡¡2 ÒªÏòÊý¾Ý¿â´æ´¢¶þ½øÖƵÄÎļþÒ»¶¨Òª°ÑÒª´æ´¢µÄÊý¾Ýת»»³É¶þ½øÖÆÁ÷
¡¡¡¡·Ï»°¾Í²»¶à˵ÁË£¬´ó¼Ò¿´¿´´úÂëºÜÈÝÒ×Ã÷°×£¬ÏÈÀ´¿´Ò»¸öapp³ÌÐò£¬µ±È»Ê×ÏÈÄúÒªÔÚÊý¾Ý¿âÖÐÏȽ¨Á¢Ò»¸öÓÃÓÚ±£´æͼƬµÄ±íºÍÏàÓ¦µÄÁУ¬Êý¾Ý¸ñʽΪblob
¡¡¡¡ package ......
tomcat ĬÈÏʹÓõÄ×Ö·û¼¯ÊÇISO-8859-1£¬²»Ö§³ÖÖÐÎÄ×Ö·û£¬ËùÒÔÔÚÏÖʵÖÐÎÄʱÐèҪת»»×Ö·ûºÍÉèÖÃ×Ö·û¼¯¡£
server.mxl¸ÄΪ<Connector port="8080" protocol="HTTP/1.1" maxThreads="150" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" /> £¬Ìí¼Ó´úÂëת»»×Ö·ûString.getBytes("ISO-8859-1"),"UTF-8 ......
Ò»°ãµÄÍøÒ³¶¼ÓÐÕâÖÖ¹¦ÄÜ£ºÔÚÒ³ÃæÉ϶¯Ì¬ÏÔʾµ±Ç°Ê±¼ä£¬Õâ¸öµÄʵÏÖÒ²ºÜ¼òµ¥£¬»ù±¾ÉÏÒ»ÐдúÂë¾ÍʵÏÖÁË
<span id="curTime"></span>
<script type="text/javascript"><!--
setInterval("curTime.innerHTML=new Date().toLocaleString()+' ÐÇÆÚ'+'ÈÕÒ»¶þÈýËÄÎåÁù'.charAt(new Date().getDay());",1000 ......