开发者社区 问答 正文

spring mvc:报错

var pageSize = 20;
Ext.define('course.store.CourseStore', {  extend : 'Ext.data.Store',  alias : 'widget.courseStore',  autoLoad : true,  autoSync : true,// 需要同步  model : 'course.model.CourseModel',  proxy : {   type : 'rest',   format : 'json',

  url : ctx + '/course/',  

headers : {    'Content-Type' : 'application/json'   },   reader : {    type : 'json',    root : 'content',    totalProperty : 'totalElements'   },   writer : {    type : 'json',    allowSingle : 'true'   }  },  // 每页显示的记录行数  pageSize : pageSize });

上面代码中代理proxy中的url如何写呀,是指哪个路径,store不是获取数据的吗?如果想要获取后台数据库的数据,该如何写url?其中
ctx=localObj.protocol + "//" + localObj.host + "/" + contextPath;
 var localObj = window.location;  var contextPath = localObj.pathname.split("/")[1];  var basePath = localObj.protocol + "//" + localObj.host + "/" + contextPath;  var ctx = basePath;

展开
收起
kun坤 2020-06-09 11:29:09 504 分享 版权
1 条回答
写回答
取消 提交回答
  • 用firebug看下请求就知道了,store获取数据首先要从后台拿嘛,url就是你拿数据那个请求 ######为何需要这么复杂。。url 就是一个后台controller中的地址。

    2020-06-09 11:29:15
    赞同 展开评论