Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

STRUTS - Cannot retrieve definition for form bean null -aaaarrrrgh

843836May 3 2004 — edited Apr 15 2010
Hi Folks,
my head hurts and i become crazy... i know that a lot of people asked this question before, but i did not found any suitable solution.

I have simple a jsp page, containing a form which should be handled by struts. I tried everything, but i did not found my mistake.

Can anyone help me please?

JSP:
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ page contentType="text/html;charset=windows-1252"%>
<html:html locale="true">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Anmeldung f?r GOLEM Quickplayout</title>
</head>
<body>
<html:errors/>
<html:form action="checkLogin.do">
  <table cellspacing="3" cellpadding="2" border="0" width="100%" align="left">
    <tr>
      <td>
        <bean:message key="prompt.username"/>
      </td>
      <td>
        <html:text property="username"/>
      </td>
    </tr>
    <tr>
      <td>
        <bean:message key="prompt.password"/>
      </td>
      <td>
        <html:text property="password"/>
      </td>
    </tr>
  </table>
</html:form>
i tryed a lot for the FORM -Tag, for instance:
<html:form action="checkLogin.do"> 
or
<html:form action="/checkLogin.do"> 
or
<html:form action="/checkLogin">
but all throws the same exception. :(

struts-config.xml
  <form-beans>
    <form-bean name="loginForm" type="de.orb.quick.view.LoginForm"/>
  </form-beans>
  <action-mappings>
  <action path="/login" type="de.orb.quick.view.LoginAction" name="loginForm" input="/login.jsp" scope="session" unknown="true">
    <forward name="success" path="/showData.jsp"/>
  </action>
    <action path="/checkLogin" type="de.orb.quick.view.CheckLogonAction" unknown="false" input="/login.jsp">
      <forward name="success" path="/storeRequestData.do"/>
      <forward name="failure" path="/login.do"/>
    </action>
...
Exception:
javax.servlet.jsp.JspException: Cannot retrieve definition for form bean null
	at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:831)
	at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:506)
	at _login._jspService(login.jsp:11)	[/login.jsp]
...
LoginAction:
  public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
    return mapping.findForward("success");
  }
LoginForm:
public class LoginForm extends ActionForm  {
  private String password = "";
  private String username = "";
  
  public void reset(ActionMapping mapping, HttpServletRequest request) {
    super.reset(mapping, request);
  }

  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    return super.validate(mapping, request);
  }

  public String getPassword() {
    return password;
  }

  public void setPassword(String password) {
    this.password = password;
  }

  public String getUsername() {
    return username;
  }

  public void setUsername(String username) {
    this.username = username;
  }
Sorry for this stupid question, but how can i avoid this exception while using struts TagLibs?
I tried to face the jsp with another action, but this does not change anything.

Thank you in advance

Mirko
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 13 2010
Added on May 3 2004
8 comments
6,798 views