小知识点集锦

1:建立数据库表的时候,
注解标签:
@Entity
@Table(name=”表名”)
//生成的ID为随机数
@Id
@GeneratedValue(generator = “system-uuid”)
@GenericGenerator(name = “system-uuid”, strategy = “uuid”)
@Column(length = 32)

2.查询数据库语句:
string hql=“from 表的model where 列名=?”

3.js获取选中单选框按钮的value
var check=$(“input[name=”单选框的name值”]:checked”).val();

4.map

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<h1 align="center">问卷调查</h1>    
<script type="text/javascript">
    var j=0;
</script>
<form readonly="true">
<c:if test="${!empty investigateAnswerList }">
        <c:forEach items="${investigateAnswerList }" varStatus="status" var="investigateAnswer">
        <input type="hidden" id="iqqid_${status.index+1}" value=${investigateAnswer.answer }> 
                <div>问题:${investigateAnswer.question.question }
                    <br> 
                    <input name="iqqname_${status.index+1}" type="radio" value="optionA" readonly="true" disabled/>A:${investigateAnswer.question.optionA} 
                    <input name="iqqname_${status.index+1}" type="radio" value="optionB" readonly="true" disabled/>B:${investigateAnswer.question.optionB} 
                    <br>
                    <input name="iqqname_${status.index+1}" type="radio" value="optionC" readonly="true" disabled/>C:${investigateAnswer.question.optionC} 
                    <input name="iqqname_${status.index+1}" type="radio" value="optionD" readonly="true" disabled/>D:${investigateAnswer.question.optionD} 
                </div>
                <script language="javascript">
                $(function(){
                    j++;
                    var returnstr =$("#iqqid_"+j).attr("value");//获取单选框的value值
                    var name="iqqname_"+${status.index+1};             
                    var radios = document.getElementsByName(name);//获取单选框
                    for(i=0;i<radios.length;i++){          //循环单选框
                    if(radios[i].value == returnstr)   //判断是否等于单选框的值
                    radios[i].checked = true;          //选中单选框
                    } 
                });
                </script>
        </c:forEach>
    </c:if>

</form>

6.spilt(“字符串”)根据字符串截取值;

7,request.setAttribute(“字符串名”,取得的对象),将对象传到字符串,送到前台。

8.@ResponseBody注解标签,将数据转化为JSon。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值