jsp页面常用代码

一、在jsp页面中,性别的回显()

  

1     <tr>
2         <td>性别:</td>
3         <td>
4          <input name="sex" type="radio" size="25" value="0" <c:if test='${modlCust.sex=="0"}'>checked="checked"</c:if> />5          <input name="sex" type="radio" size="25" value="1" <c:if test='${modlCust.sex=="1"}'>checked="checked"</c:if> />6         </td>
7     <tr>            

二、异步提交,上传图片并显示

1 <td width="" colspan="2" rowspan="5">
2                     
3 <!--                         用来页面回显图片 -->
4                         <img src="${program}/images/idCard.jpg" width="160px" height="200px" id="allUrl"/>
5 <!--                         form表单提交时传的值 -->
6                         <input type="hidden" name="customer.cardphoto" id="imgUrl" />
7 <!--                         文件上传选项 -->
8                         <br/><input type="file" name="file" onchange="uploadPic()" />
9                     </td>
 1 function uploadPic(){
 2     //alert(111);
 3     var options={
 4             url:program +'/UploadController/uploadImg.do',
 5             type:"post",
 6             dataType:"json",
 7             success:function(data){
 8                 
 9                 $("#allUrl").attr("src",program+"/upload/"+data.path);
10                 $("#imgUrl").val(data.path);
11             }
12     };
13     $("#rentForm").ajaxSubmit(options);
14     
15 }

三、在进入登录页面的时候,使鼠标指针默认放到输入用户名的地方

原文地址:https://www.cnblogs.com/my0901/p/6876248.html