Posts

Showing posts with the label HTML

How to get context path in JQuery?

Suppose you want to get your context path in JS/JQuery on clicking an Button like, In JSP/HTML:- <input type="button" id="myButton"> In JQuery :- $('# myButton ').click(function() { console.log( myC ontextPath ); }); Then you can pass values to JS/JQuery as, <input type="button" id="myButton" myContextPath="${pageContext.request.contextPath}"> Then in JS/JQuery you can write as, $('# myButton ').click(function() {         var  myC ontextPath  = $(this).attr(' myC ontextPath '); console.log( myC ontextPath ); });

How to clear cache programmatically in JSP?

By adding below lines in JSP page we can achive this: <%              response.setHeader("Cache-Control","no-cache"); //HTTP 1.1              response.setHeader("Pragma","no-cache"); //HTTP 1.0              response.setDateHeader ("Expires", 0); //prevents caching at the proxy server   %> Other solution is by adding below lines in <head></head> of your JSP page: <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Cache-Control" content="no-cache"> <meta http-equiv="Expires" content="Sat, 01 Dec 2001 00:00:00 GMT">

Simple pagination example using JQuery, CSS, HTML.

HTML: <ul class="records">     <li><div>record 1</div></li>     <li><div>record 2</div></li>     <li><div>record 3</div></li>     <li><div>record 4</div></li>     <li><div>record 9</div></li>     <li><div>record 10</div></li>     <li><div>record 11</div></li>     <li><div>record 12</div></li>     <li><div>record 13</div></li> </ul> <ul class="pagination">     <li><a class="prev" href="#">prev</a></li>     <li><a class="pagenum" href="#">1</a></li>     <li><a class="pagenum" href="#">2</a></li>     <li><a class="pagenum" href="#">3...