在Spring启动时更新表单时遇到问题

时间:2017-11-07 04:26:03

标签: spring spring-boot web-deployment

我想在spring boot中更新表单 - 所有输入字段都是从检索到的数据中成功填充的,但当我按“submit”进行更新时,系统会给出此错误消息。

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Tue Nov 07 09:41:44 IST 2017
There was an unexpected error (type=Internal Server Error, status=500).
For input string: "updateApplication"

我的DAO代码:

public interface SLSNotificationRepository extends CrudRepository<SLSNotification, Integer> {

    @Override
    SLSNotification save(SLSNotification slsNotification);

    @Override
    SLSNotification findOne(Integer integer);


    @Override
    long count();

    @Override
    void delete(Integer integer);

    @Override
    void delete(SLSNotification slsNotification);

    @Override
    void delete(Iterable<? extends SLSNotification> iterable);

    @Override
    List<SLSNotification> findAll();

    @Query("select a from SLSNotification a where a.slsiUnit in :unitList")
    List<SLSNotification> getApplicationsByUnit(@Param("unitList")List <String> unitList);

    @Query("select a from SLSNotification a where a.userId = :userId")
    List<SLSNotification> getApplicationsByUserId(@Param("userId")String userId);

    @Query("select a from SLSNotification a where a.slsNo = :slsNo")
    SLSNotification getApplicationBySLSNumber(@Param("slsNo") String slsNo);

   @Query("select a from SLSNotification a where a.importerVAT = :importerVAT group by slsNo")
    List<SLSNotification> getproductByUserId(@Param("importerVAT")String importerVAT);
}

我的服务:

public boolean update(SLSNotification slsNotification) {
        serviceLogger.info("Staring adding/updating the SLS Notification data . data : [{}]", slsNotification);
        try {
            serviceLogger.info("Saving data in the database. [{}]", slsNotification);
            slsNotificationRepository.save(slsNotification);
            return true;
        } catch (Exception e) {
            serviceLogger.error("Error occurred while saving SLS Common data . [{}]", e);
            rollBack.rollback();
            return false;
        }
    }

My controller is


@RequestMapping(path = "/updateApplication", method = RequestMethod.POST)
    public String updateApplication(@ModelAttribute("applicationForm") @Valid SLSNotification slsNotification,
            BindingResult result,
            HttpSession session) {
        slsiLogger.info("Request received to register new product. [{}]", slsNotification);
        if (result.hasErrors()) {
            slsiLogger.error("Rejecting the request due to binding errors, [{}]", result.getFieldErrors());
            return "redirect:/applicationManage?";
        }

        if (applicationServices.update(slsNotification)) {
            slsiLogger.info("Product registered successfully");
            session.setAttribute(MESSAGE_KEY, "Product registered successfully");
        } else {
            session.setAttribute(MESSAGE_KEY, "Error occurred while registering the product");
        }
        return "redirect:/applicationManage?" + MESSAGE_KEY;
    }

我的JSP:

<form:form name="applicationForm" id="applicationForm" action="updateApplication" commandName="app" method="post">
                         <c:if test="${edit}">
                             <input  type="hidden" id="snumber" name="snumber" value="${app.snumber}"/>
                        </c:if>
                        <div class="panel panel-default">
                            <div class="panel-body" >

                                <div class="row">
                                    <label id="aaa" for="manufacturer" class="col-sm-2 col-form-label col-form-label-lg">Manufacturer Name &
                                        Address <div class="req" >&nbsp;*</div></label>
                                    <label id="bbb" for="manufacturer" class="col-sm-2 col-form-label col-form-label-lg">Manufacturer Name <div class="req" >&nbsp;*</div></label>
                                    <div id="">
                                        <div class="col-sm-4">
                                            <div class="checkbox">
                                                <label><input type="checkbox" value="" id="registered">Registered Manufacturer in SLSI</label>
                                            </div>
                                            <div id="regManu">
                                                <select id="companies">
                                                    <c:forEach items="${manu}" var="com">
                                                        <option value="${com.manufacturerName}">${com.manufacturerName}</option>
                                                    </c:forEach>
                                                </select>
                                            </div>
                                            <textarea name="manufacturer" class="form-control form-control-lg"
                                                      id="manufacturer"
                                                      placeholder="Enter the name & Address. Press Enter at the end of each line"
                                                      aria-descrribedby="exportertHelp" data-error="Name & Address is required!"
                                                      required rows="4" maxlength="254"></textarea>
                                            <input  type="hidden" id="manufacture" name="manufacture" value="${app.manufacturer}"/>
                                            <div class="help-block with-errors"></div>
                                        </div>
                                        <label for="exporterAddress" class="col-sm-2 col-form-label col-form-label-lg">Exporter Name &
                                            Address <div class="req">&nbsp;*</div></label>
                                        <div class="col-sm-4">
                                            <textarea name="exporterAddress" class="form-control form-control-lg" id="exporterAddress"
                                                      placeholder="Enter the name & Address. Press Enter at the end of each line"
                                                      aria-descrribedby="exportertHelp" data-error="Name & Address is required!"
                                                      required rows="5" maxlength="254"></textarea><br/><br/>
                                            <input  type="hidden" id="exp" name="exp" value="${app.exporterAddress}"/>
                                            <div class="help-block with-errors"></div>
                                        </div>
                                    </div>


                                    <div class="row">
                                        <br/> <label for="importerVAT" class="col-sm-2 col-form-label col-form-label-lg">Importer VAT <div class="req">&nbsp;*</div></label>
                                        <div class="col-sm-4">
                                            <input class="form-control" type="text" name="importerVAT" id="importerVAT"
                                                   aria-describedby="importerVATHelp" placeholder="Ex : 174625588-7000 (White spaces not allowed)"
                                                   data-error="VAT number is required!" onkeyup="lettersOnly(this)" required value="${app.importerVAT}">
                                            <div class="help-block with-errors"></div>
                                        </div>

                                        <label for="declarantVAT" class="col-sm-2 col-form-label col-form-label-lg">Declarant VAT <div class="req">&nbsp;*</div></label>
                                        <div class="col-sm-4">
                                            <input class="form-control" name="declarantVAT" type="text" id="declarantVAT"
                                                   aria-describedby="declarantVATHelp" placeholder="Ex : 174625588-7000 (White spaces not allowed)"
                                                   data-error="VAT number is required!" onkeyup="lettersOnly(this)" required value="${app.declarantVAT}">
                                            <div class="help-block with-errors"></div>
                                        </div>
                                    </div>

                                    <div class="row" >
                                        <label for="importerDetails" class="col-sm-2 col-form-label col-form-label-lg">Importer Name &
                                            Address <div class="req">&nbsp;*</div></label>
                                        <div class="col-sm-4">
                                            <textarea name="importerDetails" class="form-control form-control-lg" id="importerDetails"
                                                      placeholder="Enter the name & Address. Press Enter at the end of each line"
                                                      aria-descrribedby="exportertHelp" data-error="Name and Address is required!"
                                                      required rows="4" maxlength="254"></textarea>
                                            <input  type="hidden" id="imp" name="imp" value="${app.importerDetails}"/>
                                            <div class="help-block with-errors"></div>
                                        </div>
                                        <label for="declarantDetails" class="col-sm-2 col-form-label col-form-label-lg">Declarant Name &
                                            Address <div class="req">&nbsp;*</div></label>
                                        </div>
                                    </div>

                                    <div class="form-group row">
                                        <label for="cusOffice" class="col-sm-2 col-form-label col-form-label-lg">CusDec No &
                                            Date</label>
                                        <div class="col-sm-2">
                                            <input class="form-control" type="text" name="cusOffice " id="cusOffice " style="float:left;"
                                                   aria-describedby="importerVATHelp" placeholder=" Ex : KTIM1" value="${app.cusOffice}">
                                        </div>
                                </div>
                            </div>
                            <div class="tabbable">
                                <br/>
                                <div class="row">
                                    <div class="col-md-12">
                                        <ul class="nav nav-pills">
                                            <li class="active"><a href="#tab1" data-toggle="pill" style="text-decoration: none;">Product
                                                    Details</a></li>
                                            <li><a href="#tab2" data-toggle="pill">Consignment Details</a></li>
                                            <li><a href="#tab3" data-toggle="pill">Attachments</a></li>
                                        </ul>
                                        <br/>
                                        <div class="tab-content">
                                            <div class="tab-pane active" id="tab1">
                                                <div class="form-group row">
                                                    <label for="slsNo" class="col-sm-5 col-lg-2 col-xs-12 col-form-label col-form-label-lg">Relevant
                                                        SLS Standard No <div class="req">&nbsp;*</div></label>
                                                    <div class="col-sm-3 col-sm-4">
                                                        <input class="form-control" type="text" id="slsNo" name="slsNo"
                                                               aria-describedby="slsNoHelp"
                                                               placeholder=" Enter SLS No here"
                                                               data-error="SLSI Standard No is required!" onkeyup="numbersOnly(this)" required value="${app.slsNo}">
                                                        <div class="help-block with-errors"></div>
                                                    </div>
                                                    <label for="slsiUnit" class="col-sm-1 col-form-label col-form-label-lg">
                                                        SLSI Unit <div class="req">&nbsp;*</div></label>
                                                    <div class="col-sm-2">
                                                        <select class="form-control" id="slsiUnit" name="slsiUnit"
                                                                data-error="SLSI Unit is required!" required>
                                                            <option>UNIT1</option>
                                                            <option>UNIT2</option>
                                                            <option>UNIT3</option>
                                                            <option>UNIT4</option>
                                                            <option>UNIT5</option>
                                                            <option>UNIT6</option>
                                                        </select>
                                                        <input  type="hidden" id="ut" name="ut" value="${app.slsiUnit}"/>
                                                    </div>


                                                    <label for="invoiceValue" class="col-sm-5   col-xs-6 col-md-5 col-lg-2 col-form-label col-form-label-lg">Invoice
                                                        Value (FOB) of the Product in US$ <div class="req">&nbsp;*</div></label>
                                                    <div class="col-sm-6 col-md-3 col-lg-2 col-xs-6">
                                                        <div class="input-group">
                                                            <span class="input-group-addon">US$</span>
                                                            <input class="form-control" type="text" name="invoiceValue" id="invoiceValue"
                                                                   aria-describedby="invoiceValueHelp"
                                                                   placeholder="Value"
                                                                   data-error="Invoice Value is required!" onkeyup="numbersOnly(this)" required value="${app.invoiceValue}"/>
                                                            <div class="help-block with-errors"></div>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="form-group row">
                                                    <label for="invoiceValue" class="col-sm-4 col-xs-6 col-md-2 col-lg-2 ">Total
                                                        Quantity <div class="req">&nbsp;*</div></label>
                                                    <div class="col-md-3 col-lg-3 col-sm-3 col-xs-3">
                                                        <input class="form-control" type="text" name="totalQty" id="totalQty"
                                                               aria-describedby="totQtyHelp"
                                                               placeholder="Total Net Weight in Number"
                                                               data-error="Total Net Weight is required!" onkeyup="numbersOnly(this)" required value="${app.totalQty}">
                                                    </div>
                                                    <div class="col-md-3 col-lg-3 col-sm-3 col-xs-3">
                                                        <select class="form-control" id="uom" name="uom" style="float:left;">
                                                            <option>KGM</option>
                                                            <option>UNITS</option>
                                                            <option>LITERS</option>
                                                            <option>CANS</option>
                                                        </select>
                                                        <input  type="hidden" id="um" name="um" value="${app.uom}"/>
                                                    </div>
                                                </div>

                                                <div class="row">
                                                    <div class="col-sm-4 col-md-4">
                                                        <div class="form-group">
                                                            <label for="shippingMarks" class="col-sm-12 col-form-label col-form-label-lg">Shipping
                                                                Marks & Container No/s </label>
                                                            <textarea name="marksNumber" class="form-control form-control-lg"
                                                                      id="marksNumber" placeholder="If no of containers greater than 10 please attach the container numbers as an attachment"
                                                                      data-error="Shipping marks are required!" maxlength="250" rows="5" ></textarea>
                                                            <input  type="hidden" id="shims" name="shims" value="${app.marksNumber}"/>
                                                            <div class="help-block with-errors"></div>
                                                        </div>
                                                    </div>
                                                    <div class="col-sm-4 col-md-4">
                                                        <div class="form-group">
                                                            <label for="productDesc" class="col-sm-12 col-form-label col-form-label-lg">Product
                                                                Description (Max 250 charactors) <div class="req">&nbsp;*</div></label>
                                                            <textarea value="${app.productDesc}" name="productDesc" class="form-control form-control-lg"
                                                                      id="productDesc"
                                                                      placeholder="Enter Product Description with brand,model/Type,size/s, quantity, Pkg.Type etc. here"
                                                                      data-error="Product Description is required!" maxlength="250" required rows="5" ></textarea>
                                                            <input  type="hidden" id="product" name="product" value="${app.productDesc}"/>
                                                            <div class="help-block with-errors"></div>
                                                        </div>
                                                    </div>
                                                    <div class="col-sm-4 col-md-4">
                                                        <div class="form-group">
                                                            <label for="purpose"
                                                                   class="col-sm-12 col-form-label col-form-label-lg">Purpose <div class="req">&nbsp;*</div></label>
                                                            <select class="form-control" id="purpose" name="purpose"
                                                                    data-error="Purpose is required!" required>
                                                                <option>Commercial</option>
                                                                <option>Personal</option>
                                                                <option>Project</option>
                                                                <option>Charity</option>
                                                                <option>Further Processing</option>
                                                            </select>
                                                            <div class="help-block with-errors"></div>
                                                        </div>
                                                    </div>
                                                </div>
                                                <br/>
                                                <div class="row">
                                                    <div class="col-md-3">
                                                        <div class="form-group">
                                                            <label for="hsCode" class="col-sm-12 col-form-label col-form-label-lg">HS
                                                                Code <div class="req">&nbsp;*</div></label>
                                                            <input class="form-control" type="text" id="hsCode" name="hsCode"
                                                                   aria-describedby="hsCodHelp" placeholder=" Please enter HS Code here"
                                                                   data-error="HS Code is required!" required value="${app.hsCode}">
                                                            <div class="help-block with-errors"></div>
                                                        </div>
                                                    </div>
                                                    <div class="col-sm-5">
                                                        <div class="form-group">
                                                            <label for="issuerQltyCert" class="col-sm-12 col-form-label col-form-label-lg">Issuer
                                                                of Product/Quality Certificate <div class="req">&nbsp;*</div></label>
                                                            <input class="form-control" type="text" id="issuerQltyCert" name="issuerQltyCert"
                                                                   aria-describedby="issuerCertHelp"
                                                                   placeholder=" Enter the Organization Issued the Certificate"
                                                                   data-error="Organization is required!" required maxlength="254" value="${app.issuerQltyCert}">
                                                            <div class="help-block with-errors"></div>
                                                        </div>
                                                    </div>
                                                    <div class="col-sm-3">
                                                        <div class="form-group">
                                                            <label for="certRefNo" class="col-sm-12 col-form-label col-form-label-lg">Product
                                                                Certificate Ref.No <div class="req">&nbsp;*</div></label>
                                                            <input class="form-control" type="text" id="certRefNo" name="certRefNo"
                                                                   aria-describedby="certRefNoHelp"
                                                                   placeholder=" Please enter product certificate No."
                                                                   data-error="Product certificate No is required!" required value="${app.certRefNo}" >
                                                            <div class="help-block with-errors"></div>
                                                        </div>
                                                    </div>

                                                </div>
                                            </div>

                                            <div class="tab-pane" id="tab2">
                                                <div class="form-group row">
                                                    <label for="vessel" class="col-sm-3 col-md-2  col-xs-7 col-form-label col-form-label-lg">Vessel
                                                        Name <div class="req">&nbsp;*</div></label>
                                                    <div class="col-md-2">
                                                        <input class="form-control" type="text" name="vessel" id="vessel"
                                                               aria-describedby="vesselHelp" placeholder=" Vessel Name"
                                                               data-error="Vessel Name & Date is required!" required maxlength="254" value="${app.vessel}" >
                                                    </div>
                                                    <label for="blNo" class="col-sm-5 col-md-2 col-xs-6 col-lg-2 col-form-label col-form-label-lg">Bill Of Lading
                                                        No <div class="req">&nbsp;*</div></label>
                                                    <label for="blNo" class="col-sm-12 col-md-2  col-xs-12 col-form-label col-form-label-lg">Date of B/L <div class="req">&nbsp;*</div></label>
                                                    <div class="col-sm-1">
                                                        <input type="text" class="datep" format="YYYY-MM-dd" style="float:left;"
                                                               readonly='true' name="blDate" id="blDate">
                                                    </div>
                                                </div>
                                                            <input class="form-control" type="text" name="loadingPort" id="loadingPort"
                                                                   aria-describedby="loadPortHelp"
                                                                   placeholder=" Please enter Port of Loading here"
                                                                   data-error="Port of Loading is required!" required value="${app.loadingPort}">
                                                            <div class="help-block with-errors"></div>
                                                        </div>
                                                    </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group row">
                            <div class="col-sm-12">
                                <button type="submit" id="submit" class="btn btn-success pull-right">SAVE CHANGES</button>
                            </div>

                        </div>
                    </form:form>

如何让表单更新生效?

0 个答案:

没有答案
相关问题