开发者社区> 问答> 正文

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 458 0
1 条回答
写回答
取消 提交回答
  • 用firebug看下请求就知道了,store获取数据首先要从后台拿嘛,url就是你拿数据那个请求 ######为何需要这么复杂。。url 就是一个后台controller中的地址。

    2020-06-09 11:29:15
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
workshop专场-微服务专场-开发者动手实践营-微服务-Spring Cloud Alibaba 微服务全家桶体验 立即下载
云栖社区特邀专家徐雷Java Spring Boot开发实战系列课程(第20讲):经典面试题与阿里等名企内部招聘求职面试技巧 立即下载
微服务架构模式与原理Spring Cloud开发实战 立即下载

相关实验场景

更多