Announcement

Collapse
No announcement yet.

Cannot retrieve definition for form bean null

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cannot retrieve definition for form bean null

    Hallo zusammen,
    Ich hab nen ganz doofen Fehler und kann nicht nachvollziehen, wie dieser zustande kommt, ich hoffe ihr könnt mir
    helfen, denn ich bin kurz davor mit dem Kopf gegen die Wandd zu rennen :|

    Ich hab ne einfache JSP Seite mit einer FORM, die durch Struts gehandelt werden soll. Tja was soll ich sagen
    es geht einfach nicht, ich bekomme immer wieder die untern angezeigte Exception.

    Muss ich noch irgenetwas beachten, damit die Form auch das Bean findet?
    Wenn ich in meiner LoginAction auf das Formbean zugreife, dann ist es instanziert.

    Ich habe auch schon versucht, die Deployments zu löschen und zu redeployen, den Container neu zu starten etc. alles ohne wirklichen Erfolg.

    Könnte mir bitte jemand helfen....

    <B>JSP:</B>

    <PRE
    <%@ 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>
    </PRE>

    Ich hab verschiedene Möglichkeiten des FormTags ausprobiert, jedoch ohne Erfolg.

    <PRE><html:form action="checkLogin.do"></PRE> oder
    <PRE><html:form action="/checkLogin.do"></PRE> oder
    <PRE><html:form action="/checkLogin"></PRE>

    <B>struts-config.xml</B>

    <PRE>
    <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>
    ...
    <PRE>

    <B>Exception:</B>

    </PRE>
    javax.servlet.jsp.JspException: Cannot retrieve definition for form bean null
    at org.apache.struts.taglib.html.FormTag.lookup(FormT ag.java:831)
    at org.apache.struts.taglib.html.FormTag.doStartTag(F ormTag.java:506)
    at _login._jspService(login.jsp:11) [/login.jsp]
    ...
    </PRE>

    <B>LoginAction:</B>

    <PRE>
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
    return mapping.findForward("success");
    }
    </PRE>

    <B>LoginForm:</B>

    <PRE>
    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;
    }
    </PRE>

    Sorry für diese dumme Frage und ich weiß das sie auch schon oft gestellt wurde,
    aber ich kann einfach keine für mich zur Lösungführenden Anleitung finden.

    Vielen Dank für eure Hilfe und einen schönen Start in die Woche

    Mirko

  • #2
    Hallo,

    Was steht denn im zugehörigen Log-File von Tomcat?

    MfG,

    Jörg Loose

    Comment


    • #3
      Hallo Mirko,

      im ActionMapping von /checkLogin steht niergends welches FromBean er verwenden soll. Genau wie im Mapping von /login muss im Attribut name der Name des FromBeans stehen.

      <action path="/checkLogin" type="de.orb.quick.view.CheckLogonAction" name="loginForm" unknown="false" input="/login.jsp"><br>
      <forward name="success" path="/storeRequestData.do"/><br>
      <forward name="failure" path="/login.do"/><br>
      </action>

      Tschau
      Sve

      Comment

      Working...
      X