taitoushan 2009-08-14 13:23
浏览 330
已采纳

struts中action怎么都没执行的奇怪问题

我点击了按钮之后就是啥反应都没有,后台也不报错

<%@ include file="/common/taglibs.jsp"%>
<%@ page pageEncoding="GBK"%>

<html>
<head>
<title>工作动态添加</title>
<script type="text/javascript">
function sure(){
alert("表单提交");
contentForm.submit;
}
</script>

</head>

<body bgcolor="#d9e7f8" onload="load()">
<html:form action="/edit/addnew.do?method=save" method="post">
<table width="87%" border="0" align="left">
  <tr>
    <td colspan="2" align="center">
    <b><div id="biaotou" style="font-size: 15px"></div></b></td>
  </tr>
  <tr>
    <td width="7%" height="35" style="font-size: 12px" align="right">标题:</td>
    <td width="93%">
<input type="text" id="title" name="title" size="60"/> </td>
  </tr>
  <tr>
    <td width="7%" height="35" style="font-size: 12px" align="right">来源:</td>
    <td width="93%">
<input type="text" id="source" name="source" size="60"/> </td>
  </tr>
  <tr>
    <td height="51" valign="top" style="font-size: 12px" align="right">内容:</td>
    <td><input type="hidden" name="content" id="content"/>
<iframe id="myiframe" src="editor/editor.htm?id=content&ReadCookie=0" frameborder="0" scrolling="no" width="621" height="457"></iframe>
    </td>
  </tr>
  <tr>
    <td height="51">&nbsp;</td>
    <td align="center">
   <html:button property="sure1" onclick="sure();" id="baocun" >保存</html:button>
<input type="button" value="取消"  onclick="sure();"/> </td>
  </tr>
</table>
  </html:form>
</body>
</html>
----------------------------
配置文件

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">

<struts-config>
  <form-beans>
   <form-bean name="contentForm" type="com.jtpsoft.webapp.form.xtgl.ContentForm"/>
  </form-beans>

  <action-mappings>
 
<action path="/edit/addnew" parameter="method" input="/edit/addNew.jsp"
name="contentForm" type="com.jtpsoft.webapp.action.xtgl.ContentAction"
scope="request" unknown="false" validate="false">
<forward name="list" path="/edit/gzdt.jsp"></forward>
</action>

  </action-mappings>

</struts-config>

------------------------
对应的action


public class ContentAction extends BaseAction {
//录入数据
public ActionForward save(ActionMapping mapping, ActionForm form,HttpServletRequest request,HttpServletResponse response)throws Exception
{
System.out.println("执行action");
}


  • 写回答

1条回答 默认 最新

  • tobackfurture 2009-08-20 17:58
    关注

    很明显,你的这个javascript的代码写错了!到csdn上下点别人的代码看看!就知道了,也可以多学点东西.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制