处理不是 *** 作请求的分段请求?

处理不是 *** 作请求的分段请求?,第1张

处理不是 *** 作请求的分段请求?

这是“模式”,是处理多部分请求的最佳方法

来自视图层的 *** 作请求转到此方法:

@ActionMapping(params = "javax.portlet.action=sample")public void response(MultipartActionRequest request, ActionResponse response) {    response.setRenderParameter("javax.portlet.action", "success");    List<MultipartFile> fileList = request.getFiles("file");}

渲染阶段如下:

@RequestMapping(params = "javax.portlet.action=success")public ModelAndView process(RenderRequest request, Model model) throws IOException {    Map map = new HashMap();    map.put("test", new Integer(1));    return new ModelAndView("someView", map);}

您创建一个“ bean”视图:

@Component("someView")public class SomeView extends AbstractView {    private Logger logger = Logger.getLogger(SomeView.class);    @Override    protected void renderMergedOutputModel(Map map, HttpServletRequest request, HttpServletResponse response) throws Exception {    logger.info("Resolving ajax request view - " + map);    JSonObject jsonObj = new JSonObject(map);    logger.info("content Type = " + getContentType());    response.setContentType("application/json");    response.setCharacterEncoding("UTF-8");    response.getWriter().write(jsonObj.toString());    response.getWriter().flush();    }}

您将BeanNameViewResolver添加到servlet / portlet上下文中:

<bean  p:order="1" />


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5123167.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-17
下一篇 2022-11-17

发表评论

登录后才能评论

评论列表(0条)

保存