Spring MVC und Fehler 400: SRVE0295E

Problem habe ich mit einfachen MVC-Anwendung.

dayoff.html
<div id="dayoff_operations" class="big_box_1">
    <form:form modelAttribute="dayOff" enctype="multipart/form-data" action="/dayoff.html" >
        <div style="width: 50%; float: left; margin-top: 0px ">
            <form:label path="forDate" ><spring:message code="dayoff.fordate.label"/></form:label>
            <form:input path="ax_forDate" id="datepicker" style="width:65px" readonly="readonly"/>&nbsp;&nbsp;
        </div>
        <div style="width: 50%; float: right; margin-top: 0px ">
            <form:label path="toDate" ><spring:message code="dayoff.todate.label"/></form:label>
            <form:input path="ax_toDate" id="datepicker2" style="width:65px" readonly="readonly" />&nbsp;&nbsp;
        </div>
        <div style="float: left">
            <form:select cssClass="more" path="dayofftype" items="${dayoffTypes.list}" itemLabel="label" itemValue="value" htmlEscape="false" cssErrorClass="errorsField"/>
            <form:errors path="dayofftype" cssClass="errors"/>
        </div>
        <input type="submit" name="add" value="Add"/>
    </form:form>

Hier ist mein controller:

@Controller
@RequestMapping("/dayoff")
@SessionAttributes(types = {DayOff.class})
public class DaysOffController {
private Validator validator;
@Autowired
private ReloadableResourceBundleMessageSource messages;

@ModelAttribute("dayoffTypes")
public Map<String, Object> populateDayoffTypes(Locale locale) {
    return Utils.createComboMap(DayoffType.values(), messages, locale);
}

@RequestMapping(method = RequestMethod.GET)
public String setupForm(Model model) {      
    model.addAttribute("dayOff", new DayOff());
    model.addAttribute("cur_period",SessionManager.getCurrentPeriod());
    return "dayoff";
}

@RequestMapping(method = RequestMethod.POST, params = "add")
public String addNewHoliday(@ModelAttribute DayOff dayOff, BindingResult result, ModelMap model) {
    System.out.println("AAA");
    return "/dayoff";
}

Wenn ich auf die Schaltfläche Hinzufügen, Fehler 400: SRVE0295E: Fehler: 400 angezeigt wird, gibt es keine Informationen zur server-Konsole.
Ich nehme an, es ist realted zu den setupForm () - Methode die Anzeige des Formulars und Zerkleinern es für die Zukunft unterbreitet. Können Sie bitte führe mich mit diesem?

Ist Ihre Aktion von /dayoff.html richtig? Sind Sie auf der mapping - *.html zu Ihrem controller-Methoden? Sie wahrscheinlich auch wollen, verwenden Sie method="post" um sicherzustellen, dass Sie schlagen Ihre korrekte controller-Methode.
Können this Hilfe!!!!!
Ja, meine DispatcherServlet Karten *.html - Dateien. Und method="post" ist nicht erforderlich, da in meinem html-Quelldatei Formular bereits erklärt, wie mit method="post".
Nach ein paar server Neustarts meinem code zu arbeiten beginnen. Nichts wirklich geändert. Input-Triggerung post Aktion erklärt wird: <input type="submit" name="add" value="<fmt:message key='dayoff.add'/>"/> -, controller-Konfiguration: @Controller @RequestMapping("/dayoff") @SessionAttributes(types = {DayOff.class}) public class DaysOffController {...} und Methode reagiert auf die Aktion der POST mit dem Namen add ist deklariert als: @RequestMapping(method = RequestMethod.POST, params = "add") public String addNewHoliday(@ModelAttribute DayOff dayOff, BindingResult result, ModelMap model) {..}

InformationsquelleAutor opad | 2013-05-15

Schreibe einen Kommentar