(Urgent)Adding int variable in jsp session

Hi,

Can anyone tell me how to make integer variables as session variables?I can pass a string in session.setAttribute("string name", string object ).But I cannot pass an integer value to it.How can I make an integer accessable throughout the JSP pages?Plz help.If u need the details,I can send it.Right now,I cannot confuse u people with all the details.I have tried Integer.parseInt(String).But it returns a null value outside the page.I shall be very thankful to u people.

[487 byte] By [ali_mohammeda] at [2007-11-27 2:55:14]
# 1
put it in a container object or make it a string
radicjesa at 2007-7-12 3:31:47 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
I have tried making it a string.Within the same page,it is accessible.But when I move to another page,it shows null value.Ho can I make it a container?
ali_mohammeda at 2007-7-12 3:31:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

You can't pass an int, because an int is a primitive variable, not an object.

You could put a java.lang.Integer as a session attribute (ie use the wrapper)

// java1.5

session.setAttribute("myNumber", Integer.valueof(42));

// or using auto boxing in 1.5

session.setAttribute("myNumber", 42);

// java 1.4

session.setAttribute("myNumber", new Integer(42));

// retrieving it:

(Integer)session.getAttribute("myNumber");

evnafetsa at 2007-7-12 3:31:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...