我正在开发一个web应用程序,试图保护登录用户对JSP的访问,我决定使用glassfish领域,我从互联网上做了很多教程,但问题总是一样的。
我无法登录,是不是因为大多数教程都在使用glassfish 3.x?
我在这里看到过类似的帖子,但没有人给出答案
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<security-constraint>
<display-name>admin</display-name>
<web-resource-collection>
<web-resource-name>prywatne</web-resource-name>
<description/>
<url-pattern>/prywatne/*</url-pattern>
<http-method>GET</http-method>
<http-method>PUT</http-method>
<http-method>HEAD</http-method>
<http-method>POST</http-method>
<http-method>OPTIONS</http-method>
<http-method>TRACE</http-method>
<http-method>DELETE</http-method>
</web-resource-collection>
<auth-constraint>
<description/>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>annRealm</realm-name>
</login-config>
<security-role>
<description/>
<role-name>admin</role-name>
</security-role>
<security-role>
<description/>
<role-name>user</role-name>
</security-role>
</web-app>发布于 2015-01-23 03:24:54
看起来问题是你没有在你的web.xml中设置FacesServlet。
在您的web.xml中添加以下内容
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>loginForm.xhtml</welcome-file>
</welcome-file-list>如果需要,您还可以更改欢迎文件的。
另请参阅:
发布于 2015-01-23 19:35:24
多亏了这段视频https://www.youtube.com/watch?v=1xsU6juUZd0,问题解决了
我没有使用加密,所以我没有设置。无论如何,问题是在用户表和组表的域中,仅有表名是不够的,但模式databasename.tablename可以提供帮助
https://stackoverflow.com/questions/28093454
复制相似问题