您现在的位置是:主页 > news > 江都建设总部网站/知乎关键词排名工具
江都建设总部网站/知乎关键词排名工具
admin2025/5/6 10:00:52【news】
简介江都建设总部网站,知乎关键词排名工具,网站客户评价,wordpress剧情网嗨我目前正在开发一个春天(3.2.x)应用程序,我必须插入我的内容到一个给定的页面在由ID指定的某个点。春天如何合并一个外部的HTML页面与生成的内容这是我目前在做什么:RequestMapping(value "/{part}", method RequestMethod.POST, produces…
嗨我目前正在开发一个春天(3.2.x)应用程序,我必须插入我的内容到一个给定的页面在由ID指定的某个点。春天如何合并一个外部的HTML页面与生成的内容
这是我目前在做什么:
@RequestMapping(value = "/{part}", method = RequestMethod.POST, produces="text/html")
@ResponseBody
public String enterModul(HttpServletRequest request, @PathVariable String part, @ModelAttribute Body body){
//body handling omitted
//getting the external html
String frame = restTemplate.getForObject("...externalUrl", String.class);
//getting my content
String uri = request.getRequestURL().toString();
String content = restTemplate.getForObject(uri, String.class);
// merge frame and content
String completeView = this.mergeFrameAndContent(frame, content);
return completeView;
}
@RequestMapping(value = "/{part}", method = RequestMethod.GET, produces="text/html")
@ResponseBody
public ModelAndView getInitialContentForPart(@PathVariable String part) {
//irrelevant code/model creation ommited
//just using InternalResourceViewResolver so nothing fancy here
ModelAndView view = new ModelAndView(part, "model", model);
return view;
}
private String mergeFrameAndContent(String frame, String content) {
//id identifies position
String view = frame.replace("id", content);
return view;
}
但做这样莫名其妙地感觉不对。有更好的解决方案吗?我试图用瓷砖3,但没有奏效。
2013-06-04
Tarken
+0
你只是想插入文本或更改代码? –
+0
我想插入内容html到外部html –
+0
好吧,那么为什么你不用jQuery? –