Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

j_security_check ( login problem )

800443Aug 29 2008 — edited Aug 29 2008
Dear All,
I am using j_security_check to redirect my JSP page to a login, so I can redirect with out any problem, and the login page ask me for user name and password.
I don't know where I should specify the user name and password.
I have searched alot but I could not find the point which I need, I have found some links regarding this issue but when I implement them, it was not working.
this is the j_security_check which I am using:
<form method="POST" action="j_security_check">
  <table border="0" cellspacing="5">
    <tr>
      <th align="right">Username:</th>
      <td align="left"><input type="text" name="j_username"></td>
    </tr>
    <tr>
      <th align="right">Password:</th>
      <td align="left"><input type="password" name="j_password"></td>
    </tr>
    <tr>
      <td align="right"><input type="submit" value="Log In"></td>
      <td align="left"><input type="reset"></td>
    </tr>
  </table>
</form>
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>guestbook</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <description></description>
    <display-name>Main</display-name>
    <servlet-name>Main</servlet-name>
    <servlet-class>xtokhi.Main</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>Main</servlet-name>
    <url-pattern>/Main</url-pattern>
  </servlet-mapping>
  <servlet>
    <description></description>
    <display-name>DeletedNode</display-name>
    <servlet-name>DeletedNode</servlet-name>
    <servlet-class>xtokhi.DeletedNode</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>DeletedNode</servlet-name>
    <url-pattern>/DeletedNode</url-pattern>
  </servlet-mapping>
  <!--
    Define a security constraint and tell it which abstract roles are
    permitted to access this resource
  -->
  <security-constraint>
    <display-name>Security Constraint</display-name>
    <web-resource-collection>
      <web-resource-name>Protected Area</web-resource-name>
      <url-pattern>/Admin.jsp</url-pattern>
      <http-method>GET</http-method>
      <http-method>POST</http-method>
    </web-resource-collection>
    <auth-constraint>
      <role-name>guest</role-name>
    </auth-constraint>
  </security-constraint>

  <!-- Default a login configuration that uses form-based authentication -->
  <login-config>
    <auth-method>FORM</auth-method>
    <realm-name>Form-Based Authentication Area</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-role>
    <description>A Funky User</description>
    <role-name>guest</role-name>
  </security-role>
</web-app>
I want the user name and password to be stored in an xml file. how can I do this?
Where the user name and password should be stored? and how?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 26 2008
Added on Aug 29 2008
1 comment
436 views