Struts Error / Cannot retrieve definition for form bean null on action
Hello,
have the problem that apparently no FormBean of my ActionForm class can be found /instantiated..
Tried very hard to find the error but I failed. Hope somebody can help me out. Many Thanks in advance!Code as follows:
ArtikelErfassung.jsp:
<%@ taglib uri='/struts-html' prefix='html' %>
<%@taglib uri='/struts-logic' prefix='logic'%>
<%@ taglib uri='/struts-bean' prefix='bean' %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:import url="/banner"/>
<html>
<head>
<title><bean:message key="ArtikelErfassung.jsp.title"/></title>
</head>
<body>
<font face="Frutiger Light"><b>Anzeige Erfassung </b></font>
<html:errors/>
<html:form action='/view/ArtikelErfassung.do'>
<table>
<tr>
<td>Artikelnummer</td><td><html:text property="artikelNummer"/></td>
</tr>
<tr>
<td>Titel </td> <td> <html:text property="titel"/> </td>
</tr>
<tr>
<td>Autor</td> <td><html:text property="autor"/> </td>
</tr>
<tr>
<td>Preis </td> <td><html:text property="preis"/> </td>
</tr>
<tr>
<td>Erscheinungsjahr</td>
<td><html:textproperty="erscheinungsJahr"/> </td>
</tr>
<tr>
<td>Verlag </td> <td><html:text property="verlag"/> </td>
</tr>
<tr>
<td>Beschreibung </td> <td><html:text property="beschreibung"/>
</td>
</tr>
<tr>
<td>Seitenzahl / Abspielzeit(min)</td> <td><html:text
property="seitenZahl"/> </td>
</tr>
<tr>
<td>
</td></tr>
<tr>
<td><html:submit>ArtikelErfassung </html:submit></td>
<td> <html:reset>Zuruecksetzen</html:reset></td>
</tr>
</table>
</html:form>
</body>
</html>
STRUTS-CONFIG.XML:
.
.
.
<struts-config>
<!-- ========== Form Bean Definitions ================= -->
<form-beans>
<form-bean name="AdministratorLoginForm"
type="actions.AdministratorLoginForm"/>
<form-bean name="ArtikelErfassungForm"
type="actions.ArtikelErfassungForm"/>
</form-beans>
<!-- ========== Action Mapping Definitions ============ -->
<action-mappings>
<action path="/view/AdministratorLogin"
type="actions.AdministratorLoginAction"
name="AdministratorLoginForm"
scope="request"
validate="true"
input="/view/AdministratorLogin.jsp">
<forward name="artikelErfassung"
path="/view/ArtikelErfassung.jsp"/>
</action>
<action path="/view/ArtikelErfassung"
type="actions.ArtikelErfassungAction">
name="ArtikelErfassungForm"
scope="request"
validate="true"
input="/view/ArtikelErfassung.jsp">
<forward name="artikelErfassungAnzeigen" path="/view/ArtikelErfassungAnzeige.jsp"/>
</action>
.
.
.
ARTIKELERFASSUNGACTION:
package actions;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class ArtikelErfassungAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
ArtikelErfassungForm artikelErfassungForm = (ArtikelErfassungForm) form;
return mapping.findForward("artikelErfassungAnzeigen");
}
}
ARTIKELERFASSUNGFORM:
package actions;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
public class ArtikelErfassungForm extends ActionForm {
private String artikelNummer = null;
private String titel = null;
privateString autor = null;
privateString preis = null;
privateString erscheinungsJahr = null;
privateString verlag = null;
privateString beschreibung = null;
privateString seitenZahl = null;
public String getArtikelNummer() {
return artikelNummer;
}
public void setArtikelNummer(String artikelNummer) {
this.artikelNummer = artikelNummer;
}
public String getAutor() {
return autor;
}
public void setAutor(String autor) {
this.autor = autor;
}
public String getBeschreibung() {
return beschreibung;
}
public void setBeschreibung(String beschreibung) {
this.beschreibung = beschreibung;
}
public String getErscheinungsJahr() {
return erscheinungsJahr;
}
public void setErscheinungsJahr(String erscheinungsJahr) {
this.erscheinungsJahr = erscheinungsJahr;
}
public String getPreis() {
return preis;
}
public void setPreis(String preis) {
this.preis = preis;
}
public String getSeitenZahl() {
return seitenZahl;
}
public void setSeitenZahl(String seitenZahl) {
this.seitenZahl = seitenZahl;
}
public String getTitel() {
return titel;
}
public void setTitel(String titel) {
this.titel = titel;
}
public String getVerlag() {
return verlag;
}
public void setVerlag(String verlag) {
this.verlag = verlag;
}
public void reset(ActionMapping mapping, HttpServletRequest request)
{
artikelNummer = null;
titel = null;
autor = null;
preis = null;
erscheinungsJahr = null;
verlag = null;
beschreibung = null;
seitenZahl = null;
}
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
{
ActionErrors errors = new ActionErrors();
if((artikelNummer == null) || (artikelNummer.length() < 1))
{
errors.add("artikelNummer.erforderlich", new ActionError("error.artikelNummer.erforderlich"));
}
if(( titel == null) || ( titel.length() < 1))
{
errors.add("titel.erforderlich", new ActionError("error.titel.erforderlich"));
}
if((autor == null) || (autor.length() < 1))
{
errors.add("autor.erforderlich", new ActionError("error.autor.erforderlich"));
}
if((preis == null) || (preis.length() < 1))
{
errors.add("preis.erforderlich", new ActionError("error.preis.erforderlich"));
}
if((erscheinungsJahr == null) || (erscheinungsJahr.length() < 1))
{
errors.add("erscheinungsJahr.erforderlich", new ActionError("error.erscheinungsJahr.erforderlich"));
}
if((verlag == null) || (verlag.length() < 1))
{
errors.add("verlag.erforderlich", new ActionError("error.verlag.erforderlich"));
}
if((beschreibung == null) || (beschreibung.length() < 1))
{
errors.add("beschreibung.erforderlich", new ActionError("error.beschreibung.erforderlich"));
}
if((seitenZahl == null) || (seitenZahl.length() < 1))
{
errors.add("seitenZahl.erforderlich", new ActionError("error.seitenZahl.erforderlich"));
}
return errors;
}
MESSAGERESOURCES.PROPERTIES:
AdministratorLogin.jsp.title=Bitte zur Artikelerfassung autorisieren
ArtikelErfassung.jsp.title=Artikel erfassen
error.password.erforderlich=Error: Passwort erforderlich!
error.password.falsch=Error: Passwort falsch!
error.artikelNummer.erforderlich=Error: Artikelnummer erforderlich!
error.titel.erforderlich=Error: Titel erforderlich!
error.autor.erforderlich=Error: Autor erforderlich!
error.preis.erforderlich=Error: Preis erforderlich!
error.erscheinungsJahr.erforderlich=Error: ErscheinungsJahr erforderlich!
error.verlag.erforderlich=Error: Verlag erforderlich!
error.beschreibung.erforderlich=Error: Beschreibung erforderlich!
error.seitenZahl.erforderlich=Error: Seitenzahl erforderlich!
error.preis.ungueltig=Error: Preis ungueltig!

