Solved

Cannot retrieve mapping for action /j_security_check

Posted on 2006-11-13
13
1,483 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
numbers ascending pyramid 101 241
hibernate example using maven 12 82
ejb example issues 3 55
Java array 10 63
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

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