Solved

Cannot retrieve mapping for action /j_security_check

Posted on 2006-11-13
13
1,449 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
 
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
computer science syllabus 3 53
json format text only 4 65
firstChar challenge 13 86
eclipse java  build path 6 25
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…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now