我正在超越异常,但我在我调用的那个动作类中有动作类和方法。
这是struts-config.xml。
<action path="/common/DepartmentAction" name="SecurEyesForm" type="com.secureyes.eswastha.struts.action.DepartmentAction" scope="request" parameter="method" validate="false">
<forward name="departmentHome" path="/WEB-INF/Masters/DepartmentMaster.jsp"></forward>
</action>
这就是我的 Action 课:
public class DepartmentAction extends DispatchAction {
/* forward name="success" path="" */
private String forwardRequestTo = "success";
public ActionForward goToHome(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
//call method to verify Pagetoken
forwardRequestTo = "departmentHome";
return mapping.findForward(forwardRequestTo);
}
}
这就是我在 javascript 中调用该方法的方式:
function dataSave(){
document.forms[0].action="DepartmentAction.htm";
document.forms[0].method.value="saveDepartmentDetails";
document.forms[0].target="workFrame";
document.forms[0].submit();
}
当我看到堆栈跟踪时,我看到如下内容:
SEVERE: Action[/common/DepartmentAction] does not contain method named ''
By which should i to conclude that the method parameter is '' but i have given parameter as method.
堆栈跟踪 :
Oct 23, 2012 12:29:50 PM org.apache.struts.actions.DispatchAction dispatchMethod
SEVERE: Action[/common/DepartmentAction] does not contain method named ''
java.lang.NoSuchMethodException: com.secureyes.eswastha.struts.action.DepartmentAction.(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
at java.lang.Class.getMethod(Class.java:1622)
at org.apache.struts.actions.DispatchAction.getMethod(DispatchAction.java:348)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:252)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:170)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Oct 23, 2012 12:29:50 PM org.apache.struts.util.PropertyMessageResources loadLocale
WARNING: Resource org/apache/struts/action/ActionResources_en_US.properties Not Found.
Oct 23, 2012 12:29:50 PM org.apache.struts.util.PropertyMessageResources loadLocale
WARNING: Resource org/apache/struts/action/ActionResources_en.properties Not Found.
Oct 23, 2012 12:29:50 PM org.apache.struts.action.RequestProcessor processException
WARNING: Unhandled Exception thrown: class java.lang.NoSuchMethodException
这是struts框架的版本问题,因为1.29中的dispatch action而我的项目配置的版本是1.3.9?如果是版本问题如何将 struts 1.2.9 配置到 Netbeans7.2 IDE?`
更新 :
包含所有框架的主页
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="shortcut icon" href="favicon.ico">
<title>SecureEyes - Infusing Security</title>
<script language="javascript" type="text/javascript" src="<%=resourcePath%>/scripts/frameset.js"></script>
<script language="javascript" type="text/javascript" src="<%=resourcePath%>/scripts/commonForHomePageTemplate.js"></script>
<script language="javascript">
<!--
var opt_no_frames = false;
var opt_integrated_mode = false;
var _help_prefix = "";
var _help_module = "";
var _context = "";
//-->
</script>
</head>
<frameset border="0" frameborder="0" framespacing="0" rows="64,*">
<frame border="0" frameborder="0" framespacing="0" id="topFrame" name="topFrame" src="<%=resourcePath%>/common/header.jsp" marginheight="0" marginwidth="0" noresize="noresize" scrolling="no">
<frameset border="0" frameborder="0" framespacing="0" id="MainFrameSet" cols="209,*">
<frame noresize="noresize" border="0" frameborder="0" framespacing="0" id="leftFrame" name="leftFrame" src="<%=resourcePath%>/common/left_menu.jsp" >
<frame border="0" frameborder="0" framespacing="0" id="workFrame" name="workFrame" src="<%=resourcePath%>/common/WelcomePage.jsp" marginheight="7" marginwidth="7" noresize="noresize" scrolling="auto">
</frameset>
</frameset>
</html>
和DepartemtMaster.jsp
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> <%@ page contentType="text/html"%> <%@ page pageEncoding="UTF-8"% > <% String resourcePath = request.getContextPath(); %> SecureEyes - 注入安全性
<link rel="stylesheet" type="text/css" href="<%=resourcePath %>/css/autocomplete.css"/>
/scripts/prototype/prototype.js"> /scripts/script.aculo.us/effects.js"> /scripts/script.aculo.us/controls.js"> /scripts/autocomplete.js">
<script src="<%=resourcePath%>/scripts/blanket.js"></script>
<script src="<%=resourcePath%>/data-page/jquery-latest.js" type="text/javascript"></script>
<script type="text/javascript" src="<%=resourcePath%>/data-page/jquery.tablesorter.js"></script>
<link href="<%=resourcePath%>/data-page/table-sorter.css" rel="stylesheet" type="text/css">
<link href="<%=resourcePath%>/css/eswastha.css" rel="stylesheet" type="text/css">
<script src="<%=resourcePath%>/data-page/smartpaginator.js" type="text/javascript"></script>
<link href="<%=resourcePath%>/data-page/smartpaginator.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="<%=resourcePath%>/scripts/commonForHomePageTemplate.js"></script>
<script language="javascript" type="text/javascript" src="<%=resourcePath%>/data-page/main.js"></script>
<script language="javascript" type="text/javascript" src="<%=resourcePath%>/header_data/tooltip.js"></script>
<link rel="stylesheet" type="text/css" href="<%=resourcePath%>/header_data/general.css">
<link rel="stylesheet" type="text/css" href="<%=resourcePath%>/data-page/custom.css">
<link rel="stylesheet" type="text/css" href="<%=resourcePath%>/data-page/layout.css">
<link rel="stylesheet" type="text/css" href="<%=resourcePath%>/data-page/desktop.css">
<script src="<%=resourcePath%>/data-page/custom.js"></script>
<link rel="stylesheet" type="text/nonsense" href="<%=resourcePath%>/header_data/misc.css">
<script src="../dwr/interface/DepartmentAction.js"></script>
<script src="../dwr/engine.js"></script>
<script src="../dwr/util.js"></script>
<script type="text/javascript">
function updateList(autocompleter, textBoxValue) {
document.getElementById("INST_ID_LOADER").style.display = 'none';
if(textBoxValue!=null && textBoxValue!="" && textBoxValue.length>0){
document.getElementById("INST_ID_LOADER").style.display = '';
DepartmentAction.getAutocompleteDepartMentData(textBoxValue,function(data) {
document.getElementById("INST_ID_LOADER").style.display = 'none';
autocompleter.setChoices(data)
});
}
}
function nameValueSelector(tag){
return tag;
}
function isDepartmentExist(){
var departmentName= document.getElementById('department').value;
DepartmentAction.isDepartmentExist(departmentName,isDepartmentTrue);
}
function isDepartmentTrue(isDepartmentExist){
if(isDepartmentExist){
document.getElementById('department').value="";
alert("Department exist already");
return false;
}
}
function getDepartmentData(){
var departmentName= document.getElementById('departmentName').value;
DepartmentAction.getDepartmentResultHTML(departmentName,loadDepartmentHTML);
}
function loadDepartmentHTML(htmlTable){
if(htmlTable){
document.getElementById("departmentList").style.display = "";
document.getElementById("departmentList").innerHTML = htmlTable;
document.getElementById("total").value="20";
//for paginator
t=40;
r=0;
$(function () {
r = document.getElementById('rec_per_page').value;
$('#paginator').smartpaginator({ totalrecords: t, recordsperpage: 10, datacontainer: 'product-table', dataelement: 'tr', initval: 0, next: 'Next', prev: 'Prev', first: 'First', last: 'Last'});
});
prepareForSearch();
}
}
function prepareForSearch(){
$(function() {
$("#product-table").tablesorter();
});
}
function deleteDepartment(departmentid){
if(confirm("Are you sure to delete")){
alert("departmentid : D :"+departmentid);
}
}
function updateDepartment(departmentid){
if(confirm("Are you sure to Update")){
alert("departmentid : U :"+departmentid);
}
}
function addDepartment(){
document.getElementById("addDepartment").style.display = '';
}
function cancelAddDepartment(departmentid){
document.getElementById("addDepartment").style.display = 'none';
}
function saveDepartment(){
var department= document.getElementById('department').value;
if(department.length<=0){
alert("Please Enter Department Name");
return false;
}else {
var answer = confirm("Do You Want to Continue?");
if (answer){
dataSave();
}
}
}
function dataSave(){
getBlanket('continueDIV');
document.forms[0].action="DepartmentAction.htm?method=saveDepartmentDetails";
document.forms[0].method.value="saveDepartmentDetails";
document.forms[0].target="workFrame";
document.forms[0].submit();
}
</script>
</head>
<body >
<div id="blanket" style="display:none;"></div>
<div id="continueDIV" style="display:none;" align="center" class="loadingRequest">
<img src="<%=resourcePath%>/images/loading_1.gif" align="middle" border="0"><br /><bean:message key="reqinprogress" />
</div>
<form method="get" autocomplete="off">
<table style="display: none;" id="loaderContainer" onclick="return false;" border="0" cellpadding="0" cellspacing="0" width="100%">
<tbody><tr><td id="loaderContainerWH"><div id="loader" style="z-index: 10;"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td><p><img alt="1x1.gif" title="" id="loaderAnimation" style="background-image: url(/skins/vista/images/loading.gif);" src="left_data/1x1.gif" height="20" width="20"><strong>Please wait. Loading...</strong></p></td></tr></tbody></table></div><script language="JavaScript" type="text/javascript">_lanim_start(24, 20);</script></td></tr></tbody></table>
<table id="pageLayout" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td id="screenWH">
<div class="titleWrapper">
<div class="pathbar clear">
<span class="pathbarItem"><a href="#">Home</a></span>
<span class="pathbarItem separator">></span>
</div>
<div class="screenTitle">
<table cellspacing="0" width="100%">
<tbody><tr>
<td class="title">
<div class="titleContainer clear"><h1>Master: Department</h1></div>
</td>
</tr>
</tbody></table>
</div>
</div>
<div id="addDepartment" style="display: none">
<table id="commonBodyTable" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<table width="100%" align="center" class="tableBorder2" border="0" cellpadding="2" cellspacing="0">
<tr>
<td colspan="4" class="mainheader">Add Department</td>
</tr>
<tr class="lightrow">
<td width="30%" class="textalign"> </td>
<td width="5%" class="mandatory"> </td>
<td width="65%" colspan="2" class="textfieldalign" > </td>
</tr>
<tr class="darkrow">
<td width="30%" class="textalign">Department Name</td>
<td width="5%" class="mandatory">*</td>
<td width="65%" colspan="2" class="textfieldalign" ><input type="text" class="textbox" name="department" id="department" maxlength="20" onblur="isDepartmentExist()"></td>
</tr>
<tr class="lightrow">
<td width="30%" class="textalign"> </td>
<td width="5%" class="mandatory"> </td>
<td width="65%" colspan="2" class="textfieldalign" ><input type="button" class="submitbu" name="save" id="save" value="Save" onclick="saveDepartment()">
<input type="button" class="submitbu" name="exit" id="exit" value="Exit" onclick="cancelAddDepartment();"></td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div class="screenBody" id="">
<div class="listArea">
<div class="searchArea">
<table cellspacing="0" cellspacing="0">
<tbody>
<tr>
<td>
<label>Department Name</label>
<input type="text" name="departmentName" id="departmentName" size="50" maxlength="245" onfocus="new Autocompleter.DWR('departmnet','departmentNameList',updateList,{ valueSelector: nameValueSelector });">
<img id="INST_ID_LOADER" style="display:none;" src="<%=resourcePath%>/images/loading_3.gif" align="middle" border="0">
<div id="departmentNameList" class="auto_complete"></div>
</td>
<td>
<div class="commonButton" id="bid-search">
<input type="button" name="bname_search" class="submitbu" value="Search" onclick="getDepartmentData()">
</div>
</td>
</tr>
</tbody>
</table>
</div>
<form method="post" autocomplete="off" id="mainform">
<div class="report-heading" >
<div align="right">
<a href='#' onclick="addDepartment()">Add Department</a>
<label>Export to:</label>
<select>
<option value="">Excel</option>
<option value="">CSV</option>
<option value="">PDF</option>
</select>
<input type="button" class="submitbu" value="Export" />
<input type="hidden" id="method" name="method" />
</div>
</div>
<div class="gridArea">
<div id="departmentList"></div>
</div>
<input type="hidden" name="total" id="total" value="40" />
<input type="hidden" name="rec_per_page" id="rec_per_page" value="10" />
</form>
<div id="paginator"></div><!-- for paginator -->
</div>
</div>
</td>
</tr>
</tbody>
</table>
<div class="LeftFrameSwitcher" id="divLeftFrameSwitcher">
<img alt="bar_close.gif" title="Hide/show the navigation pane" id="imgLeftFrameSwitcher" onclick="SwitchLeftFrame();" src="<%=resourcePath%>/data-page/bar_close.gif" height="60" width="8">
</div>
<input type="hidden" name="method" >
</form>
</body>
请帮我,