troubleshooting Question

Problem in getting form based authentication with weblogic and struts

Avatar of curious81
curious81 asked on
Java App Servers
3 Comments1 Solution2971 ViewsLast Modified:
Hi,
   I am working on an application. It is using Weblogic as app server and struts framework. I am trying to use form based authentication to authenticate users at the presentation tier. I am having issues getting FBA working using struts, although I am able to make it working if I am not using struts. I will put some code snippets here to explain how it is not working with struts:

jsp:
 <html:form name="loginForm" method="post" action="j_security_check" type="com.org.project.form.LoginForm" onSubmit="javascript:clicked(this)">
    <td width="292" valign="top"><p><img src="../public/images/tcc/existing_pv_user.gif" width="291" height="43"></p>
      <table width="85%"  border="0" align="center" cellpadding="2" cellspacing="0">
      <tr>
        <td colspan="2" class="body"><strong>Username:</strong></td>
        </tr><tr> <td colspan="2">
<html:text property="j_username" size="42"/>
</td> </tr> <tr>
   <td colspan="2" class="body"><strong>Password:</strong></td>
   </tr> <tr> <td colspan="2">
<html:password property="j_password" size="42"/>

struts config looks like:
        <action
            path="j_security_check"
            type="com.org.project.action.LoginAction"
            name="loginForm"
            scope="session">
<forward name="success" path="/html-jsp/welcome.jsp"/>            
        </action>  

        <form-bean
            name="loginForm"
            type="com.org.project.form.LoginForm">
       </form-bean>

The error I get when I run this:
javax.servlet.jsp.JspException: Cannot retrieve mapping for action /j_security_check
      at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:810)
      at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:506)
      at jsp_servlet._html_45_jsp.__epvlogin._jsp__tag2(__epvlogin.java:211)
      at jsp_servlet._html_45_jsp.__epvlogin._jsp__tag0(__epvlogin.java:152)
      at jsp_servlet._html_45_jsp.__epvlogin._jspService(__epvlogin.java:116)
      at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)

If I put /j_security_check in struts-config, i dont get the error, but then the form based authentication does not work because it uses j_security_check as a keyword. It appends /context-name/j_security_check.do in the view siurce if I put a slash in the struts-config.xml.

I am confident that web.xml and weblogic.xml entries are correct because form based authentication works if I do not use struts in the jsp. Has anyone faced this problem when using form based authentication with struts?

Thanks!
ASKER CERTIFIED SOLUTION
ECollin

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros