Apache Tiles - 如何在 ViewPreparer 的执行方法中获取 HTTPServlet 请求对象 [英] Apache Tiles - How to get HTTPServlet Request object in execute method of ViewPreparer

查看:44
本文介绍了Apache Tiles - 如何在 ViewPreparer 的执行方法中获取 HTTPServlet 请求对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用带有磁贴配置的 Spring MVC 并使用 ViewPreparer 加载菜单以将菜单加载到应用程序中.我想在 ViewPreparer 的 execute 方法中使用 HTTPServlet 请求对象来获取 HTTP Headers 中设置的 globalid.

Am using Spring MVC with tiles configuration and loading the Menus using ViewPreparer to load the menus into the application. I want HTTPServlet request object in the execute method of ViewPreparer for getting globalid set in HTTP Headers.

请建议如何获取请求对象...

Please suggest how to get request object ...

提前致谢:)

推荐答案

给你.

public class MenuPreparer implements ViewPreparer {


public void execute(TilesRequestContext tilesContext, 
                  AttributeContext attributeContext) throws PreparerException {

    HttpServletRequest request = (HttpServletRequest) tilesContext.getRequest();
}

这篇关于Apache Tiles - 如何在 ViewPreparer 的执行方法中获取 HTTPServlet 请求对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆