视图页面未显示从控制器传递的数据

时间:2017-06-06 16:58:48

标签: java jsp

我无法获取从控制器发送的数据并在我的jsp页面上显示。

payments.jsp

rightRolePK embeddedId

mycontroller.java

<%@ include file="/WEB-INF/views/template/header.jsp"%>


<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            Dashboard
            <small>Control panel</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
            <li class="active">Payments</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content">
        <!-- Small boxes (Stat box) -->
        <!-- Main row -->
        <div class="row">
            <div class="col-md-4">
                <form action="<c:url value="/getCandidateDetails"/>" method="post">
                    <div class="form-group">
                        <label for="bank">Bank:</label><br/>
                        <input type="text" id="bank" path="bank" name="bank" 
                     class="form-control">
                    </div>
                    <div class="form-group">
                        <label for="bank">Account No.</label><br/>
                        <input type="text" id="accountNo" path="accountNo"          
                    </div>
                    <div class="form-group">
                        <label for="revenueHead">Revenue Head:</label><br/>
                        <input type="text" id="revenueHead" 
                 path="revenueHead" name="revenueHead" class="form-control">
                    </div>
                    <div class="form-group">
                        <label for="depositslipNo">Deposit Slip No.</label><br/>
                        <input type="text" id="depositslipNo" 
            path="depositslipNo" name="depositslipNo" class="form-control">
                    </div>
                    <div class="form-group">
                        <label for="fiscalYear">FiscalYear:</label><br/>
                        <select name="fiscalYear" class="form-control">
                            <option value="2016/17">2016/17</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="masterId">Master Id:</label><br/>
                        <input type="text" id="masterId" 
         path="studentmasterid" name="studentmasterid" class="form-control">
                    </div>

                    <button class="btn btn-primary" type="submit" 
                  id="search" onclick="showDiv()">Search</button>
                </form>
            </div>
            <div class="col-md-12" id="paymenttable" >
                <table class="table table-striped"  >
                    <thead>
                    <tr>
                        <th>Master Id:</th>
                        <th>Advertisement Code</th>
                        <th>Name</th>
                        <th>Actions</th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach var="payment" items="${details}">
                        <tr>
                            <td>${payment.studentmasterid}</td>
                            <td>${payment.advertisementCode}</td>
                            <td>${payment.candidatefirstname}</td>
                            <td>
                                <a href="<c:url 
          value="/paymentsDetails/allInfo/${payment.advertisementCode}"/> ">
                                    <span class="glyphicon glyphicon-info-sign"></span>
                                </a>
                                <span class="glyphicon glyphicon-remove-circle"></span>
                            </td>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </div>
        </div>
        <!-- /.row (main row) -->

    </section>
    <!-- /.content -->
</div>
<!-- /.content-wrapper -->

<script type="text/javascript" 
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js">

myrepository

   @RequestMapping(value = "/getCandidateDetails", 
method = RequestMethod.POST)
    public String getCandidateDetails(Model model,@RequestParam("studentmasterid") String studentmasterid){
        System.out.println(studentmasterid);
        List<CandidateDetailsInfo> candidates= `candidateappearagainstadvtcodeEntityRepository.findAllByStudentmasterid(studentmasterid);`
        model.addAttribute("details",candidates);;
        return "payments";
    }

我的存储库成功从数据库返回数据,因为我可以在控制台上打印它们。但每当我提交表单时,页面都会永远保存。 image

0 个答案:

没有答案