传过去一直是NULL,输出表单内容看的话能看见传的值,F12里的network参数也是对的,
mybatis是持久层的框架,建议你贴点代码出来看看.
价格是Double类型,借阅数是Integer类型,现在发现Integer在后台也获取不到,都是NULL
下面是mybatis的xml
<sql id="selectBookListWhere">
<where>
<if test="book_name != '' and book_name != null">
and book_name like "%"#{book_name}"%"
</if>
<if test="book_price != '' and book_price != null">
and book_price = #{book_price}
</if>
<if test="book_type != '' and book_type != null">
and book_type like "%"#{book_type}"%"
</if>
<if test="book_publisher != '' and book_publisher != null">
and book_publisher like "%"#{book_publisher}"%"
</if>
<if test="book_borrowCount != null">
and book_borrowCount = #{book_borrowCount}
</if>
<if test="book_borrowNow != null">
and book_borrowNow = #{book_borrowNow}
</if>
</where>
</sql>
book_price,book_borrowCount ,book_borrowNow获取都是NULL
<form class="form-inline" id = "search_book" method="post" action="${pageContext.request.contextPath}/book/list.action">
<div class="form-group">
<label for="bookName">书名 </label>
<input type="text" class="form-control" id="bookName" name="book_name" maxlength="20"/>
</div>
<div class="form-group">
<label for="bookPrice">价格 </label>
<input type="text" class="form-control" id="bookPrice" name="book_price" maxlength="5"/>
</div>
<div class="form-group">
<label for="bookType">类别 </label>
<input type="text" class="form-control" id="bookType" name="book_type" maxlength="10"/>
</div>
<div class="form-group">
<label for="bookPublisher">出版商 </label>
<input type="text" class="form-control" id="bookPublisher" name="book_publisher" maxlength="10"/>
</div>
<div class="form-group">
<label for="bookBorrowCount">总借阅数 </label>
<input type="text" class="form-control" id="bookBorrowCount" name="book_borrowCount" maxlength="5"/>
</div>
<div class="form-group">
<label for="bookborrowNow">当前借阅数 </label>
<input type="text" class="form-control" id="bookborrowNow" name="book_borrowNow" maxlength="5"/>
</div>
<button type="submit" class="btn btn-primary">查询</button>
</form>
你模糊查询的方法不对,建议更改
like concat('%',#{keyword},'%')更换这种写法,mybatis不能对数据库百分号那种很好识别
你这跟mybatis没啥关系吧,你是后台就是null了,证明你表单提交,后台就没接受好,就后面就不用说了,建议从表单提交,后台debug能看到值之后再向后看