struts ajax jquery 报错Could not find action or result
这是ajax的代码:应该没有错的。$.ajax({type:"post",url:"initializeProjectSaveAction.action",//readJ...
这是ajax的代码:应该没有错的。
$.ajax({
type : "post",
url : "initializeProjectSaveAction.action",// read JSON data
dataType : "json",
global : false,
data : {
'psu' : psu,
'requirement' : requirement,
'hld' : hld,
'lld' : lld,
'construction' : construction,
'acceptance' : acceptance,
'system' : system,
'package_t' : package_t,
'warranty' : warranty,
'wind' : wind
},
success : function() {
alert("Save Success!");
},
error : function() {
alert("Error");
}
这是xml的代码:
<package name="initializeProjectSearch" extends="default">
<action name="initializeProject"
class="com.tcs.ems.initializeproject.action.InitializeProjectAction">
<result name="success">/WEB-INF/page/initializeproject/initializeProjectSearch.jsp
</result>
</action>
<action name="initializeProjectSearch"
class="com.tcs.ems.initializeproject.action.InitializeProjectSearchAction">
<result name="success">/WEB-INF/page/initializeproject/initializeProjectPsu.jsp
</result>
</action>
</package>
只有这段设及到ajax:
<package name="ajaxjson" extends="json-default">
<action name="initializeProjectSaveAction"
class="com.tcs.ems.initializeproject.action.InitializeProjectSaveAction">
<result name="json"></result>
</action>
</package>
这是Action中execute的代码
public String execute() {
System.out.print(getWind());
workflow.setProId(1);
System.out.print(getWind());
workflow.setProjectStartUp(getPsu());
workflow.setRequirementsAnalysis(getRequirement());
workflow.setHighLevelDesign(getHld());
workflow.setLowLevelDesign(getLld());
workflow.setAcceptanceTesting(getAcceptance());
workflow.setPackageTransition(getPackage_t());
workflow.setConstruction(getConstruction());
workflow.setSystemTest(getSystem());
workflow.setWarrantySupport(getWarranty());
workflow.setWindUp(getWind());
System.out.print(getWind());
ipswfs.saveWorkFlow(initializeProjectSaveWorkFlowDao, workflow);
return "success";
他报这样的错误:
No result defined for action com.tcs.ems.initializeproject.action.InitializeProjectSaveAction and result success
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:364)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:266)
}
关于他的包我加了jsonplugin-0.34.jar和json-lib 的包
求解!!! 展开
$.ajax({
type : "post",
url : "initializeProjectSaveAction.action",// read JSON data
dataType : "json",
global : false,
data : {
'psu' : psu,
'requirement' : requirement,
'hld' : hld,
'lld' : lld,
'construction' : construction,
'acceptance' : acceptance,
'system' : system,
'package_t' : package_t,
'warranty' : warranty,
'wind' : wind
},
success : function() {
alert("Save Success!");
},
error : function() {
alert("Error");
}
这是xml的代码:
<package name="initializeProjectSearch" extends="default">
<action name="initializeProject"
class="com.tcs.ems.initializeproject.action.InitializeProjectAction">
<result name="success">/WEB-INF/page/initializeproject/initializeProjectSearch.jsp
</result>
</action>
<action name="initializeProjectSearch"
class="com.tcs.ems.initializeproject.action.InitializeProjectSearchAction">
<result name="success">/WEB-INF/page/initializeproject/initializeProjectPsu.jsp
</result>
</action>
</package>
只有这段设及到ajax:
<package name="ajaxjson" extends="json-default">
<action name="initializeProjectSaveAction"
class="com.tcs.ems.initializeproject.action.InitializeProjectSaveAction">
<result name="json"></result>
</action>
</package>
这是Action中execute的代码
public String execute() {
System.out.print(getWind());
workflow.setProId(1);
System.out.print(getWind());
workflow.setProjectStartUp(getPsu());
workflow.setRequirementsAnalysis(getRequirement());
workflow.setHighLevelDesign(getHld());
workflow.setLowLevelDesign(getLld());
workflow.setAcceptanceTesting(getAcceptance());
workflow.setPackageTransition(getPackage_t());
workflow.setConstruction(getConstruction());
workflow.setSystemTest(getSystem());
workflow.setWarrantySupport(getWarranty());
workflow.setWindUp(getWind());
System.out.print(getWind());
ipswfs.saveWorkFlow(initializeProjectSaveWorkFlowDao, workflow);
return "success";
他报这样的错误:
No result defined for action com.tcs.ems.initializeproject.action.InitializeProjectSaveAction and result success
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:364)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:266)
}
关于他的包我加了jsonplugin-0.34.jar和json-lib 的包
求解!!! 展开
展开全部
<package name="ajaxjson" extends="json-default">
<action name="initializeProjectSaveAction"
class="com.tcs.ems.initializeproject.action.InitializeProjectSaveAction">
<result name="json">这里没有跳转的页面或者action,如果不需要返回,随便写一个存在的页面或者action即可</result>
</action>
</package>
<action name="initializeProjectSaveAction"
class="com.tcs.ems.initializeproject.action.InitializeProjectSaveAction">
<result name="json">这里没有跳转的页面或者action,如果不需要返回,随便写一个存在的页面或者action即可</result>
</action>
</package>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2011-12-30
展开全部
<result name="json"></result>
改成
<result name="success" type="json"></result>
改成
<result name="success" type="json"></result>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
应该是传参有问题! data:{} 里面试试别的形式传参
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<result name="json"></result> json是数据类型啊,< result name=“success” type="json" >
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询