I have a jsp page , on a button click I want to fetch values from bean and do some action on the basis of that data.
(This button is not posting or getting anything but only makes some UI level changes.)
Conditions: Page must not be refreshed, only a certain part of page is refreshed and that too only when that button is pressed.
I have
<wcbase:useBean id="beanUtil" classname="UtilBean">
<c:set property="studentId" value="${WCParam.studentId}" target="${beanUtil}" />
</wcbase:useBean>
<c:set property="classId" value="${class.uniqueID}" target="${beanUtil}" />
<c:set var="listOfStudents" value="${beanUtil.StudentIdsforTransfer}" />
<c:if test="${not empty listOfStudents}">
<script>var listOfStudents= true; </script>
</c:if>
<c:if test="${empty listOfStudents}">
<script>var listOfStudents = false;</script>
</c:if>
I need to call this whole section on a button click
how to do it?
All the help would really be appreciated.
Note: I have tried to put this code in div and then tried to refresh that div on button click but it didnt work.
something like :
Put in js
$('#studentDiv').load(document.URL + '#studentDiv');
Put in jsp.
<div id="studentDiv">
<wcbase:useBean id="beanUtil" classname="UtilBean">
<c:set property="studentId" value="${WCParam.studentId}" target="${beanUtil}" />
</wcbase:useBean>
<c:set property="classId" value="${class.uniqueID}" target="${beanUtil}" />
<c:set var="listOfStudents" value="${beanUtil.StudentIdsforTransfer}" />
<c:if test="${not empty listOfStudents}">
<script>var listOfStudents= true; </script>
</c:if>
<c:if test="${empty listOfStudents}">
<script>var listOfStudents = false;</script>
</c:if>
</div>
This code refreshed the page but inserted the whole page again with in the main page and stayed in process.