web小技巧

sendRedirect只能重定向到WEB-ROOT下的页面,不能到WEB-INF下,且只能是页面:

response.sendRedirect("/school2/index.jsp");

 

error值在jsp页面获取方式:

response.sendRedirect("/school2/index.jsp?error=-1");
${error}

 

页面不需要调用方法自动调用该方法:

<script type="text/javascript">

      (function(){
            alert("10");
      })();
//========或者=========
$("").ready(function(){...});
//=======或============
$(function(){...})
</script>
(function(){                //------以后标准这样写------
        $("").ready(function() {

            ....

        });
    })();

 

 

span的内容通过$("")获取

span的内容赋值通过.html(value)

<span id="second"></span>
$("#second").html(second--)

 

男女用Integer 1和2表示,页面中显示:

${student.sex==1?"":"" }

 

varStatus----->通过*.count 实现序号从1自动增长

<c:forEach items="${students}" var="student" begin="0" end="10" varStatus="varS">
           ${varS.count}
...
</c:forEach>

 隐藏域

<input type="hidden" name="pageNum"  value="1">    //通过request隐藏发送pageNum的value

${requestScope.pageNum}                            //通过requestScope获取psgeNum的value

 

提交表单时confirm:

<form action="/school2/student/studentAction_getInfo" method="post" onsubmit="return window.confirm('确认删除?')">

 

垂直对齐需要在特定显示样式中才有效, 比如table-cell

 display:table-cell; 
 vertical-align:middle;

 

border-spacing

.image-list {
  display: table;
  border-collapse:separate;
  border-spacing: 5px;
}

posted @ 2016-07-08 22:30  乱世_独自美  阅读(200)  评论(0)    收藏  举报