【发布时间】:2012-07-09 16:12:47
【问题描述】:
我使用 HTML+JQuery 作为 UI,Spring-Roo 生成包含 Json 对象字符串转换的服务层。它对我们很有效,就像下面的示例代码:
@RequestMapping(headers = "Accept=application/json")
@ResponseBody
public ResponseEntity<String> ArticleController.listJson() {
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json; charset=utf-8");
List<Article> result = Article.findAllArticles();
return new ResponseEntity<String>(Article.toJsonArray(result), headers, HttpStatus.OK);
}
但是在开发了几个示例页面之后,我有一些问题:
1) 我们想使用 Spring-Security 作为访问控制模块,这个框架可以吗?服务器如何知道它是来自浏览器的同一个会话请求?
2) 代替jsp服务器技术,纯HTML+JQuery真的可以吗?因为我在html中看到很多Ajax代码注入,而且很多不能复用。正如我们所知,服务器技术具有可以最大限度地重用代码的模板。我担心开发困难和维护工作。
PS: Why we decided using HTML+JQuery+Json is because we directly get HTML+CSS from Art designer,
and we have plan to support different client besides browser, so Json might be a good choice.
谢谢。
【问题讨论】:
标签: spring-mvc spring-security spring-roo