0 0

kindeditor+struts,我无法将jsp里的kindeditor的textarea的值传到action5

我无法将jsp中用的kindeditor的值传给struts

 

这是我jsp中form的代码和看kindeditor的js

 

 

<form action="<%=basePath %>view/fault/openFault.action" method="post" name="myform" id="myform">
<div>
<table width="99%" border="0" cellpadding="0" cellspacing="0" class="CContent">

  <tr>
    <td class="CPanel">
		<table border="0" cellpadding="0" cellspacing="0" style="width:100%">
		<tr>
			<td width="100%">
				<fieldset style="height:100%;">
				<legend >打开缺陷</legend>
				<table border="0" cellpadding="2" cellspacing="1" style="width:100%">
				  <tr>
				  <!-- 
				    <td nowrap align="right" width="10%">缺陷编号:</td>
				    <td width="20%"><input name="text" id="fnumber" class="text" style="width:150px" type="text" size="40" /></td>
				     -->
				    <td nowrap align="right" width="13%">缺陷名称:</td>
				    <td width="20%"><input name="faultInfo.fname" id="fname" class="text" style="width:150px" type="text" size="40" /></td>
				    <td align="right" width="17%">项目名称:</td>
				    <td>
					<select name="projectInfo.pid" id="pname" width="50px" onchange="selectAllModelsForProject(this.value);selectAllFlevel(this.value);">
                    	<option value="0">=请选择项目=</option>
                    	</select>
					</td>
				    </tr>
				  <tr>
                  <td align="right" width="17%">模块名称:</td>
                  <td>
                  <select name="modelInfo.mid" id="mname" width="50px">
                    	<option value="0">=请选择模块=</option>
                    	</select>
                  </td>
				   
				    <td nowrap align="right">缺陷状态:</td>
				    <td>打开</td>
				    <td align="right">缺陷级别:</td>
				    <td><select name="faultInfo.flevel" id="flevel" width="50px">
                    	<option value="0">=请选择缺陷级别=</option>
                    </select></td>
				    
				    </tr>
                    <tr>
                    <td nowrap align="right">缺陷类型:</td>
				    <td><select name="faultType.ftid" id="ftype" width="50px">
                    	<option value="0">=请选择缺陷类型=</option>
                    </select></td>
				    <td nowrap align="right" width="10%">原始输入:</td>
				    <td width="20%"><input name="faultInfo.input" id="input" class="text" style="width:150px" type="text" size="40" /></td>
				    <td nowrap align="right" width="13%">预期输出:</td>
				    <td width="20%"><input name="faultInfo.idealOutput" id="idealOutput" class="text" style="width:150px" type="text" size="40" /></td>
				    
				    </tr>
				  <tr>
                  	<td align="right" width="17%">实际输出:</td>
				    <td width="20%"><input name="faultInfo.realOutput" id="realOutput" class="text" style="width:154px" /></td>
                    <td align="right" width="17%">发现人员:</td>
				    <td width="20%">${user.unumber }</td>
                  </tr>
                  <tr>
				    <td nowrap align="right" height="120px">缺陷信息:</td>
				    <td colspan="3">
                    <textarea id="faultInfo.finfo" name="faultInfo.finfo" cols="90" rows="40" style="width:700px;height:200px;visibility:hidden;"><%=htmlspecialchars(htmlData)%></textarea>
                    </td>
				 </tr>

				
				  </table>
				<br />
				</fieldset>			</td>
		</tr>
		
		</table>

	 </td>
  </tr>
	
		<tr>
			<td colspan="2" align="center" height="50px">
			<input type="button" name="Submit" value="保存" class="button" onclick="return checkOpen();return confirm('您确定要打开这个缺陷吗?');"/> 
			
			<input type="button" name="Submit2" value="返回" class="button" onclick="window.history.go(-1);"/></td>
		</tr>
		</table>
	
	
	 </td>
  </tr>
  </table>

</div>
</form>

KindEditor.ready(function(K) {
		var editor1 = K.create('textarea[name="faultInfo.finfo"]', {
			cssPath : '<%=basePath %>kindeditor-4.1.4/plugins/code/prettify.css',
			uploadJson : '<%=basePath %>kindeditor-4.1.4/jsp/upload_json.jsp',
			fileManagerJson : '<%=basePath %>kindeditor-4.1.4/jsp/file_manager_json.jsp',
			allowFileManager : true,
			/* afterCreate : function() {
				var self = this;
				K.ctrl(document, 13, function() {
					self.sync();
					document.forms['myform'].submit();
				});
				K.ctrl(self.edit.doc, 13, function() {
					self.sync();
					document.forms['myform'].submit();
				});
			}  */
		});
		//prettyPrint();
	});
 
这是我Action里的部分代码
public String openFault() throws Exception {
		
		HttpServletRequest request=ServletActionContext.getRequest();
		String temp=request.getParameter("faultInfo.finfo");
		System.out.println("temp="+temp);
。。。。。。
}
我通过struts的getter(定义了faultInfo这个变量)和request都得不到那个值
这是我传过来的参数:
begin---------------------------
Action:com.test.struts.action.FaultAction
Method:openFault
param:modelInfo.mid
2
param:projectInfo.pid
1
param:faultInfo.realOutput
vcreg
param:faultInfo.fname
dvvf
param:faultInfo.flevel
3
param:faultType.ftid
20
param:faultInfo.finfo

param:faultInfo.input
cevre
param:faultInfo.idealOutput
vrgver
temp=


 
2012年12月09日 17:23
  • 大小: 38.1 KB

1个答案 按时间排序 按投票排序

0 0

<%=htmlspecialchars(htmlData)%>

这个htmlspecialchars是在哪里定义的?java中好像没有htmlspecialchars吧?这么写不会报错吗?<%= %>中应该放的是java代码,你这应该不是java代码吧。

把<%=htmlspecialchars(htmlData)%>换成hello试试,看能否在action中得到hello,或者request.getParameter("faultInfo.finfo")能否得到hello。如果能够得到,说明是<%=htmlspecialchars(htmlData)%>的问题。

2012年12月10日 11:26

相关推荐

Global site tag (gtag.js) - Google Analytics