ssttttrrrr
View Answers
October 20, 2008 at 2:47 PM
October 20, 2008 at 4:57 PM
one.jsp
=======
TOT = TOT + rs.getInt("NUMOFCONLABENG");
<input type="hidden" name="Total" value= <%= TOT %>
two.jsp
--------
String CLSEC1 = request.getParameter("Total");
Here the value available , Now if u want it as integer then use type cast.
Thanks
Rajanikant
October 20, 2008 at 5:06 PM
Hi,
In session we can save objects only, but not the primitive data types.
session.setAttribute("CLSEC1", TOT);
TOT is a primitive data type so it cannot be saved.
check the alternate ways to save:
Way 1:
Save TOT as a String
session.setAttribute("CLSEC1", TOT+"");
and convert into int while accessing.
if(session.getAttribute("CLSEC1") != null){
Integer.parseInt(session.getAttribute("CLSEC1"));
}
Way 2:
Save TOT as an Integer Object
session.setAttribute("CLSEC1", new Integer(TOT));
and convert into int while accessing.
if(session.getAttribute("CLSEC1") != null){
((Integer)session.getAttribute("CLSEC1")).getInt();
}
Regards,
Sreekar
Related Tutorials/Questions & Answers: