Solved

Cannot retrieve mapping for action /j_security_check

Posted on 2006-11-13
13
1,500 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

726 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