Solved

Cannot retrieve mapping for action /j_security_check

Posted on 2006-11-13
13
1,475 Views
Last Modified: 2008-01-09
Hello all,
I'd like to convert my working form-based login page to use struts' html
form taglib. I get the following Exception when trying to load login.jsp:

"javax.servlet.ServletException: Cannot retrieve mapping for action /j_security_check"

This code works:

<form name="login" action="j_security_check" method="POST">
  <table border="3" cellpadding="2" cellspacing="2" align="center">
  <tr>
    <th align="right">Username:</th>
    <td><input type="text" name="j_username" size="20"></td>
  </tr>
  <tr>
    <th align="right">Password:</th>
    <td><input type="password" name="j_password" size="20"></td>
  </tr>
  <tr align="center">
    <td colspan="2"><input type="submit" value="Login"></td>
  </tr>
  </table>
</form>

This does not:

<html:form action="j_security_check" focus="j_username">
  <table border="3" cellpadding="2" cellspacing="2" align="center">
  <tr>
    <th align="right">Username:</th>
    <td><html:text property="j_username"/></td>
  </tr>
  <tr>
    <th align="right">Password:</th>
    <td><html:password property="j_password"/></td>
  </tr>
  <tr align="center">
    <td colspan="2"><html:submit>Login</html:submit></td>
  </tr>
  </table>
</html:form>

Any help would be appreciated.
0
Comment
Question by:sanjaybhatt73
13 Comments
 

Author Comment

by:sanjaybhatt73
ID: 17928768
I have the following entry in my web.xml

      <login-config>
            <auth-method>FORM</auth-method>
            <form-login-config>
                  <form-login-page>login.do</form-login-page>
                  <form-error-page>login.do</form-error-page>
            </form-login-config>
      </login-config>
0
 
LVL 92

Expert Comment

by:objects
ID: 17928985
> This does not:
> <html:form action="j_security_check" focus="j_username">

check what html is it generating.
0
 

Author Comment

by:sanjaybhatt73
ID: 17929065
This is the HTML code generated

<!--
<body ONLOAD="loadForm();">
 -->
<body >

<div class="bodyFullscreen">
<div class="barTitle">
<div class="barTextLeft">EPS</div>
<div class="barTextRight">
<a href="/EPS/mainMenu.do" class="header">Menu</a>&nbsp;|&nbsp;
<a href="/EPS/logout.do" class="header">Exit</a>
</div>
</div>
</div>
</div>
[ServletException in:/jsp/Login.jsp] Cannot retrieve mapping for action /j_security_check'
<div class="bodyFullscreen">
<div class="footer">Copyright &copy; 2004-2008. ING OPS&amp;IT BANKING -
All Rights Reserved.</div>
</div>
</body>
</html>
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 92

Expert Comment

by:objects
ID: 17929070
i meant the html of the form.
0
 

Author Comment

by:sanjaybhatt73
ID: 17929120
Before generating the login form, it is throwing the error.
0
 
LVL 10

Expert Comment

by:mbvvsatish
ID: 17929271
check whether  you have given the maping for *j_security_check* in your struts-config.xml
0
 

Author Comment

by:sanjaybhatt73
ID: 17929321
Thanks for the reply. You may not require to add j_security_check in struts-config.xml. The Container takes cares of it. Please correct me if I am wrong.
0
 
LVL 16

Accepted Solution

by:
Peter Kwan earned 84 total points
ID: 17929378
How about?

<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/login.jsp</form-error-page>
</form-login-config>
</login-config>
0
 
LVL 9

Assisted Solution

by:owenli27
owenli27 earned 83 total points
ID: 17932653
I don't know the solution to convert your Form Login to Struts.   But it is obvious that Struts is trying to locate the action 'j_security_check' in the struts-config.xml file before container capture 'j_security_check'.   You need to find a way to let Struts ignore this so that the container can capture your login request.  Try to remove any Struts tags in your login jsp to see if it OK.
0
 
LVL 92

Assisted Solution

by:objects
objects earned 83 total points
ID: 17934063
u may not be able to use struts tags for your login form
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Android studio getdrawable(int) is deprecated 4 116
jsp login check 12 42
Eclipse Java import and method not resolved 4 48
learn programming 8 34
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question