?
Solved

Cannot retrieve mapping for action /j_security_check

Posted on 2006-11-13
13
Medium Priority
?
1,520 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 336 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 332 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 332 total points
ID: 17934063
u may not be able to use struts tags for your login form
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
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…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Suggested Courses
Course of the Month10 days, 14 hours left to enroll

770 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