2
我正在開發一個帶有Java EE的Web項目,我希望某些JSP只能由某種類型的用戶訪問。我讀過使用web.xml描述符,我可以將一些資源的可見性設置爲「角色名稱」。但是如何在http會話中設置這個角色名?
例如,我的描述有:很熱定義web項目中的web.xml角色名稱
<security-constraint>
<web-resource-collection>
<web-resource-name>Access to Student pages</web-resource-name>
<url-pattern>/Student/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>Student</role-name>
</auth-constraint>
</security-constraint>
在哪裏/我如何界定「學生」角色的名字嗎?
你是如何得出結論OP是使用Tomcat?根據OP的問題歷史記錄,我可以發現,OP使用的是JBoss AS,它絕對不使用'tomcat-users.xml'文件。 – BalusC 2012-08-24 17:31:34
@BalusC:你說得對,我沒有想到他使用的服務器。無論如何,所有Server/Servlet-Container的一般聲明都是真實的。 - 或者我錯了? – Ralph 2012-08-25 07:18:48