LinkinPark
当你的才华撑不起你野心时,那么请潜下心继续学习,心无旁骛,愿多年以后你们我都能成为自己想象的模样。

1、应用的意义

      

在某些应用下,如果Action类执行的功能比较重要,可以对该Action类进行授权利以实现只有特定角色的用户能够访问,此时可以在struts-config.xml文件中进行配置

 

2、在struts-config.xml文件中进行配置

 

<action-mappings>

           <actionpath="/BookInfo/indexLoginURI"   type="netbook.IndexLoginAction"    name="IndexLoginForm"

                  scope="request"     validate="true"      input="/index.jsp" roles="admin">

                  <forwardname="loginSuccess" path="/BookInfo/ShowBookInfo.jsp" />

                     <forwardname="loginFailure" path="/BookInfo/gotoIndex.htm"/>      

           </action>

 </action-mappings>

 

3、 问该Action

 

如果访问者不是admin 角色的用户,此时将出现如下的错误


posted on 2015-03-04 15:53  LinkinPark  阅读(204)  评论(0)    收藏  举报