Announcement

Collapse
No announcement yet.

Fehlermeldung aus ResourceBundle beziehen

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

  • Fehlermeldung aus ResourceBundle beziehen

    Hallo,

    was ist falsch an Code?

    ich habe folgendes

    in my/package/Resource.properties:
    errors.header=<b>
    errors.nic=darf nicht LEER sein
    errors.footer=</b>

    in web.xml:
    <servlet>
    ...
    <init-param>
    <param-name>application</param-name>
    <param-value>my.package.Resource</param-value>
    </init-param>
    ...
    </servlet>

    in NewUserForm:
    ...
    public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest request) {
    ActionErrors errors = new ActionErrors();
    if (nic.equals("")) {
    errors.add("nic", new ActionError("errors.nic"));
    }
    return errors;
    }
    ...

    und in ausgabe.jsp
    <body>
    <html:errors/><br/>
    ...
    </body>

    Also wenn in den Textfeld nichts eingegeben wird, soll ich die Meldung "darf nicht LEER sein" bekommen, oder? Ich bekomme aber

    HTTP Status 500 - No input attribute for mapping path /newuser

    --------------------------------------------------------------------------------

    type Status report

    message No input attribute for mapping path /newuser

    description The server encountered an internal error (No input attribute for mapping path /newuser) that prevented it from fulfilling this request.

    --------------------------------------------------------------------------------

    Apache Tomcat/4.1.30

    Was ist falsch?

  • #2
    Hallo!

    Hab das Problem gelöst.

    in struts-config muss noch input-Attribute unbedingt angegeben werden (mit der Einstiegsseite)

    <action-mappings>
    <action name="NewUserForm" path="/newuser" scope="request" type="my.package.action.NewUserAction" input="/pages/inputnewuser.jsp">
    <forward name="createnewuser" path="/pages/creatednewuser.jsp" />
    </action>
    </action-mappings&gt

    Comment

    Working...
    X