在js中想得到某个标签的某个属性,直接 用id点下去。
radio是否选中 则为 .checked
例:
在html中想通过thymeleaf得到select的下拉值:
<select th:field="*{testList}">
<option th:each="test : ${testList}" th:value="test" th:text="${test}">
</option>
</select>
html页面中单选的select得到值
页面:
<select th:field="*{schoolAcademyList}" id="schoolAcademy" name="schoolAcademy">
<option th:each="schoolAcademy : ${schoolAcademyList}" th:value="schoolAcademy" th:text="${schoolAcademy}">
</option>
</select>
js内
var schoolAcademy1=$('#schoolAcademy option:selected').text();
分页:
public List<Object[]> findAllConfigMachineBillingsByConfigUid(int currpage, int pageSize, HttpServletRequest request, String configUid){
// 建立查询
StringBuffer queryHQL = new StringBuffer("select * from view_config_machine_billing c where 1=1 ");
queryHQL.append(" AND c.config_uid like '%" + configUid + "%'");
// 执行查询
Query queryList = entityManager.createNativeQuery(queryHQL.toString());
// 以下两行是分页设置
queryList.setMaxResults(pageSize);
queryList.setFirstResult((currpage-1)*pageSize);
// 返回结果
List<Object[]> queryHQLs = new ArrayList<Object[]>(queryList.getResultList());
return queryHQLs;
}
placeholder的作用
得到span的值(在thymeleaf中)
select中不仅需要each也需要默认值