netbeans - How to implement user authentication in a jsp web application, using a glassfish JDBC Realm? -


we have been attempting create user logins on our jsp web app using jdbc realms, following this tutorial. have followed tutorial like, won't work! basically, login form doesn't accept credentials, don't know if it's due communication issue, or there no communication!

here of our code, enough show went wrong!

our relevant database tables:

database tables

our web.xml file:

<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"> <session-config>     <session-timeout>         30     </session-timeout> </session-config> <jsp-config>     <jsp-property-group>         <description>jsp configuration bandy</description>         <url-pattern>/index.jsp</url-pattern>                     <url-pattern>/web-inf/view/*</url-pattern>         <include-prelude>/web-inf/jspf/menu.jspf</include-prelude>         <include-coda>/web-inf/jspf/seal.jspf</include-coda>     </jsp-property-group>     </jsp-config>      <login-config>     <auth-method>form</auth-method>     <realm-name>bandyrealm</realm-name>     <form-login-config>         <form-login-page>/login.jsp</form-login-page>         <form-error-page>/error.jsp</form-error-page>     </form-login-config>        </login-config>         <security-constraint>             <web-resource-collection>         <web-resource-name>bandy user</web-resource-name>         <url-pattern>/protected/protected.jsp</url-pattern>         <http-method>get</http-method>         <http-method>post</http-method>     </web-resource-collection>             <auth-constraint>         <role-name>admin</role-name>         <role-name>user</role-name>     </auth-constraint> </security-constraint>     

our glassfish-web.xml file:

<glassfish-web-app error-url=""> <class-loader delegate="true"/> <jsp-config>     <property name="keepgenerated" value="true">         <description>keep copy of generated servlet class' java code.</description>     </property> </jsp-config> <security-role-mapping>     <role-name>admin</role-name>     <group-name>admin</group-name> </security-role-mapping> <security-role-mapping>     <role-name>user</role-name>     <group-name>user</group-name> </security-role-mapping>     

our jdbc realm settings:

jdbc realm

our project structure:

project structure

your declared realm in web.xml (bandyrealm) doesn't exist. try setting named in glassfish, namely "jdbc-realm"


Popular posts from this blog