`
叶威1992
  • 浏览: 14148 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

Failed to load resource: the server responded with a status of 500 (Internal Ser

阅读更多
用struts2和jquery.ajax进行异步请求的时候在谷歌浏览器的console出现了Failed to load resource: the server responded with a status of 500 (Internal Server Error)而struts2中action中的方法正常执行并且能查询到数据到时这些数据不能返回到页面上,即jquery.ajax中的回调函数没有执行
请问该怎么解决[b][/b]
struts2中的action中的方法如下:
public String quer(){
System.out.println("进了");
message="zen";
propertylist = propertyservice.querypropertyall(pu);
return SUCCESS;
}
struts.xml中的配置如下:
<package name="ddd" extends="json-default">
<action name="json" class="propertyAction" method="quer">
<result type="json"></result>
</action>
</package>
jsp页面的类容如下:
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
   
    <title>My JSP 'Jquerytest.jsp' starting page</title>
   
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">   
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
  <script type="text/javascript" src="js/Jquery-easyui-1.2.6/jquery-1.7.2.min.js"></script>
  <script type="text/javascript">
  function a(){
  alert("!!!!!!!!!!!!!!");
  $.ajax({
  url:'json',
  dataType:'json',
  data:'pu.currentPage=1',
  success:update
  });
  function update(){
  alert("~~~~~~~~~~~~~~~~~~~~");
  }
  }
  </script>
  </head>
 
  <body>
    <input type="button" value="ddd" onclick="a()">
  </body>
</html>
图片是我所用的json的jar包
我的解决办法是:在action中先将该list转换成json字符串,然后再在前台页面接收,然后在转换成oject对象
即action中的添加JSONArray jsonArray = JSONArray.fromObject(articleList);message = jsonArray.toString();
script中添加:
function update(data){

var articletitle= eval('(' + data + ')');

}
  • 大小: 7.4 KB
0
0
分享到:
评论

相关推荐

    vue打包npm run build时候界面报错的解决

    用coding-pages打开后显示Failed to load resource: the server responded with a status of 404 (Not Found), 解决方案: 方案一: 找到config里的index.js,打开修改assetsPublicPath 为“./” 方案二: 或者把...

    编译原理中的一部分答案

    - **解析**:每个文法都生成了不同的语言,例如 `L1` 生成的是以 `ab` 结尾的含有 `a` 和 `c` 的所有字符串。 ### 第三章知识点概览 #### 六、自动机 自动机是计算理论中的一个模型,用于描述输入字符串的处理...

    Ajax报错400的参考解决办法

    在使用Ajax进行数据交互时,有时会遇到"400 Bad Request"的错误,这通常意味着服务器无法理解客户端(浏览器)发送的请求。在这种情况下,错误的根本原因通常是前端发送的数据格式不符合后端接口的预期。...

    mobile-select-area:手机联动选择地区

    移动选择区域 手机联动选择地区效果图如下: 例子见[DEMO]( ) 或( ) npm install mobile-select-area --save-dev 用法 ...或者 打开start.bat 注:依赖于 ...meta name="viewport" content="width=device-width, ...

    node.js中的favicon.ico请求问题处理

     server.on(“request”,function(req,res){5 console.log(req.url);  res.end();  });  server.listen(1337,”127.0.0.1″); 这样的代码在请求时会出现两条请求: 第一条时URL地址为用户输入的客户端请求的...

    iframe中页面显示不全1

    在这个例子中,`&lt;div&gt;`的宽度和高度被设定为500px和300px,而`&lt;iframe&gt;`则被设置为相对定位并充满整个`&lt;div&gt;`。`position: absolute`使`&lt;iframe&gt;`相对于其最近的非静态定位祖先(这里就是`&lt;div&gt;`)定位,`top`和`...

    小程序server请求微信服务器超时的解决方法

    今天有同学在测试小程序的过程中,发现一个问题,调用 微信官方的服务端接口超时 ,比如这个接口,https://api.weixin.qq.com/sns/jscode2session ,因为我们小程序登录的时候,会在自己server端调用微信的API,这个...

    英语翻译常用词组.doc

    例句:The company failed due to lack of funding. 35. nothing but 只不过是:表示某个事情或概念只不过是某种状态或趋势。 例句:The company's success is nothing but a result of hard work. 36. by means ...

    LCTF软件备份VariSpec™ Liquid Crystal Tunable Filters

    In earlier revisions, the error status light was cleared after a VsSetWavelength() call failed, so the user did not see the light turn red to alert that an error had occurred. This has been fixed in ...

    The Start-up J Curve (.epub)

    Author Howard Love calls this pattern the start-up J Curve: The toughest part of the endeavor is the time between the actual start of a new business and when the product and model are firmly ...

    创建项目时VUE报错的解决办法

    Error: Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html". This can be caused by a missing file extension in the URL or an incorrect MIME type configured...

    数据请求的时候遇到 Status code: 431 Request Header Fields Too Large

    当在数据请求过程中遇到“Status code: 431 Request Header Fields Too Large”时,这通常意味着请求头(Header)中的字段过大,超过了服务器能够接受的限制。这个错误可能发生在前端或后端,具体取决于请求的实现...

    The status and impact of prereferral intervention: "We need a better way to determine success"

    The status and impact of prereferral intervention: "We need a better way to determine success" P.~yCholoRy in the Schools Volume 31. October 1994 THE STATUS AND IMPACT OF PREREFERRAL INTERVENTION...

    Programming Active Server Pages(CHM).rar

    When Microsoft first responded to the demand for Internet development tools, products were primitive by any stretch of the imagination. In fact, Web developers joked that their favorite development ...

    Human Insula in Emotion

    The posterior insula showed auditory responses that resemble those observed in Heschl’s gyrus, whereas the anterior insula (AI) responded to the emotional contents of the auditory stimuli in a ...

    Reporting with Microsoft SQL Server 2012 报表开发指南

    Reporting with Microsoft SQL Server 2012 报表开发指南 PDF版 Creating reports is natural in any business, and there are many Microsoft products for ... Microsoft responded to this need with Power View.

    GRE阅读备考试题:动荡的时代背景.docx

    They offer a critique of the economic conditions that led to thesocial unrest of the time. E. They illustrate the effects of the Industrial Revolution on ruralEnglish communities. 7. How might the ...

    Incident Response and Computer Forensics 2nd ed.7z

    where the number one goal of a computer crime was money. Nearly every computer intrusion we have responded to was followed by credit card fraud, extortion, or fraudulent purchases of merchandise by ...

Global site tag (gtag.js) - Google Analytics