下面这个程序有点怪, 如果表单是这样的
<form enctype="multipart/form-data" action="submit.jsp" method="post" name="form1">
request收到的值全是NULL
而当改成
<form enctype="multipart/form-data" action="submit.jsp" method="get" name="form1">
时, 就能正确收到request值
这是为什么呢?
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page language="java" import="com.fredck.FCKeditor.*" %>
<%@ page import="com.oa2007.tool.*"%>
<link rel="stylesheet" type="text/css" href="../../../../theme/1/style.css"><script language="javascript">
function highlight(obj){
var hightlightBgColor = '#d6d6d6';
obj.onmouseover = function(){
var o = event.srcElement; if(o.tagName=="TD"){
with(o.parentElement){
style.backgroundColor = hightlightBgColor;
}
}
}
obj.onmouseout = function(){
var o = event.srcElement;
if(o.tagName=="TD"){o.parentElement.style.backgroundColor = '';}
}
}</script>
<html>
<head>
<title>发布新闻</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><script Language="JavaScript">
function CheckForm()
{
if(document.form1.SUBJECT.value=="")
{ alert("新闻的标题不能为空!");
return (false);
}
return (true);
}function sendForm()
{ if(CheckForm())
document.form1.submit();
}
</script>
</head><body class="bodycolor" topmargin="5">
<form enctype="multipart/form-data" action="submit.jsp" method="post" name="form1">
<table border="0" width="100%" cellspacing="1" cellpadding="0" class="small">
<tr class="tablehead1">
<td><img src="../../../../images/notify_new.gif" align="absmiddle"> 新建新闻
</td>
</tr>
<tr class="tablehead2">
<td>
<a href="#" onclick="sendForm();"><img src="../../../../images/button/issue.gif" border="0" title="发布"></a>
<a href="#" onclick="javascript:EDIT_HTML.location.reload()"><img src="../../../../images/button/reset.gif" border="0" title="重填"></a>
<a href="#" onClick="location='../'"><img src="../../../../images/button/return.gif" border="0" title="返回"></a>
</td>
</table>
<br>
<table border="0" width="100%" cellpadding="5" cellspacing="1" align="center" class="small">
<tr>
<td nowrap class="TableLine2"> 标题:</td>
<td class="TableLine1">
<input type="text" name="SUBJECT" size="40" maxlength="40" class="BigInput" value="">
</td>
</tr> <tr>
<td class="TableLine2" colspan="2">
<%
String text="";
FCKeditor oFCKeditor ;
oFCKeditor = new FCKeditor( request, "EditorDefault" ) ;
oFCKeditor.setBasePath( "/oa2007/FCKeditor/" ) ;
oFCKeditor.setValue("input");
oFCKeditor.setValue( Convert.toSpaceStr(text) );
out.println( oFCKeditor.create() ) ;
%>
</td>
</tr>
</table>
</form></body>
</html>
<form enctype="multipart/form-data" action="submit.jsp" method="post" name="form1">
request收到的值全是NULL
而当改成
<form enctype="multipart/form-data" action="submit.jsp" method="get" name="form1">
时, 就能正确收到request值
这是为什么呢?
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page language="java" import="com.fredck.FCKeditor.*" %>
<%@ page import="com.oa2007.tool.*"%>
<link rel="stylesheet" type="text/css" href="../../../../theme/1/style.css"><script language="javascript">
function highlight(obj){
var hightlightBgColor = '#d6d6d6';
obj.onmouseover = function(){
var o = event.srcElement; if(o.tagName=="TD"){
with(o.parentElement){
style.backgroundColor = hightlightBgColor;
}
}
}
obj.onmouseout = function(){
var o = event.srcElement;
if(o.tagName=="TD"){o.parentElement.style.backgroundColor = '';}
}
}</script>
<html>
<head>
<title>发布新闻</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><script Language="JavaScript">
function CheckForm()
{
if(document.form1.SUBJECT.value=="")
{ alert("新闻的标题不能为空!");
return (false);
}
return (true);
}function sendForm()
{ if(CheckForm())
document.form1.submit();
}
</script>
</head><body class="bodycolor" topmargin="5">
<form enctype="multipart/form-data" action="submit.jsp" method="post" name="form1">
<table border="0" width="100%" cellspacing="1" cellpadding="0" class="small">
<tr class="tablehead1">
<td><img src="../../../../images/notify_new.gif" align="absmiddle"> 新建新闻
</td>
</tr>
<tr class="tablehead2">
<td>
<a href="#" onclick="sendForm();"><img src="../../../../images/button/issue.gif" border="0" title="发布"></a>
<a href="#" onclick="javascript:EDIT_HTML.location.reload()"><img src="../../../../images/button/reset.gif" border="0" title="重填"></a>
<a href="#" onClick="location='../'"><img src="../../../../images/button/return.gif" border="0" title="返回"></a>
</td>
</table>
<br>
<table border="0" width="100%" cellpadding="5" cellspacing="1" align="center" class="small">
<tr>
<td nowrap class="TableLine2"> 标题:</td>
<td class="TableLine1">
<input type="text" name="SUBJECT" size="40" maxlength="40" class="BigInput" value="">
</td>
</tr> <tr>
<td class="TableLine2" colspan="2">
<%
String text="";
FCKeditor oFCKeditor ;
oFCKeditor = new FCKeditor( request, "EditorDefault" ) ;
oFCKeditor.setBasePath( "/oa2007/FCKeditor/" ) ;
oFCKeditor.setValue("input");
oFCKeditor.setValue( Convert.toSpaceStr(text) );
out.println( oFCKeditor.create() ) ;
%>
</td>
</tr>
</table>
</form></body>
</html>
为什么要这样?