Spring MVC フレームワークを使用し、ビュー プリペアラーを使用してメニューをロードしています。viewpreparer クラスでリクエスト オブジェクトを取得する必要があります。そのために、ビュー作成者で次のコードを使用しています
@Service
public class MenuViewPreparer implements ViewPreparer {
HttpServletRequest request = ServletActionContext.getRequest();
// HttpSession session = request.getSession();
public void execute(TilesRequestContext tilesContext,
AttributeContext attributeContext) throws PreparerException {
// MenuList fetches the list of all the main menus by calling the getMenuList() method present in MenuServiceDAOImpl
// which is of type MenuDTO
String user=null;
System.out.println("Menu :"+request.hashCode());
UserDTO userDTO = UserName.getUserName(request);
user=userDTO.getUserId();
}
}
execute メソッドで request オブジェクトが必要です。しかし、すべてがnullのリクエストオブジェクトに入っています。したがって、例外が発生します。入手方法を誰か教えてくれませんか?
前もって感謝します。