Java Reference
In-Depth Information
<c:set var="index" value="0"/>
<s:form beanclass="stripesbook.action.UserListActionBean">
<d:table name="${actionBean.users}" id="user" requestURI=""
defaultsort="1" pagesize="10">
<d:column titleKey="user.lastName" sortable="true">
${fn:escapeXml(user.lastName)}
</d:column>
<d:column titleKey="user.firstName" sortable="true">
${fn:escapeXml(user.firstName)}
</d:column>
<d:column titleKey="user.email" sortable="true">
${fn:escapeXml(user.username)}@stripesbook.org
</d:column>
<d:column titleKey="user.roles">
<c:forEach var="role" items="${actionBean.roles}">
<s:checkbox name="users[${index}].roles"
value="${role}" checked="${user.roles}"/>
${role}
</c:forEach>
<c:set var="index" value="${index + 1}"/>
</d:column>
</d:table>
<br>
<s:submit name="save"/>
</s:form>
Including
UserListActionBean
in
MenuViewHelper
adds it to the menu:
public
enum Section {
MessageList(MessageListActionBean.
class
),
ContactList(ContactListActionBean.
class
),
Compose(MessageComposeActionBean.
class
),
UserList(UserListActionBean.
class
),
Logout(LogoutActionBean.
class
);
}
Now that the User List page is ready, let's see how we restrict access to
it by requiring the
Administrator
role.
Restricting Access with the Stripes-Security plug-In
Oscar Westra van Holthe-Kind developed a neat plug-in called Stripes-
tor, a simple API, and a tag library to easily control authorization in
a Stripes application. It leaves the authentication up to you—we have
already covered that with our Login page.
Search WWH ::
Custom Search