0

我有一个 JSP 页面,它从我的 Hibernate 项目中的控制器调用方法

这是我在 JSP 页面中的一些代码:

...
<jsp:useBean id="acl" scope="request" class="com.angelina.token.controller.AccessControlListsController"/>
     ...
            <c:if test="<c:if test="${acl.allowView(session,7)}">">
            <a style="font-size:12px;" href="<c:url value="/admin/account/"/>">Account Balance</a>
            </c:if>
     ...

这是我的一些控制器

...
@Autowired
private AccessControlListsService aclService;
@Autowired
private UsersService usersService;
...
@RequestMapping(value="")
@ResponseBody
public boolean allowView(HttpSession session, Integer permissionId) throws Exception {
        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
        String userName = auth.getName();
        Users users = usersService.findByUserName(userName).get(0);
        Integer roleId = users.getRoles().getId();
        Boolean status = aclService.getByRoleIdAndPermissionId(roleId, permissionId).getCanView();
        return status;
}
...

usersServiceallowView(HttpSession session, Integer permissionId)是一个服务对象,当我从 JSP 页面调用方法时,usersService总是返回 null。

有没有人知道我应该怎么做才能使我的对象服务不返回 null?

我真的很感激任何帮助。

4

1 回答 1

0

如果您有组件扫描标签,请尝试在您的 spring 上下文中查找

某事喜欢:

<context:component-scan base-package="org.com.******
于 2016-02-19T09:02:54.463 回答