Use same Class object across multiple jsp pages

T

Terren

Is it possible to create an object in one jsp page and then use it in
another jsp page.

Basically

JSP 1
MyClass myObject = MyClass();
myObject.setsomevariable="XXXXXXXX";

JSP2
myObject.getsomevariable;

I want to use this object to keep information about a user that has log
in e.g. Username, rights etc

I am pretty new to jsp so I don't even know if this is the right thing
to do
 
M

Malte

Terren said:
Is it possible to create an object in one jsp page and then use it in
another jsp page.

Basically

JSP 1
MyClass myObject = MyClass();
myObject.setsomevariable="XXXXXXXX";

JSP2
myObject.getsomevariable;

I want to use this object to keep information about a user that has log
in e.g. Username, rights etc

I am pretty new to jsp so I don't even know if this is the right thing
to do

If you do not want to use a database, you could use session objects.
 
S

steinvommars

Or you can use
request.setAttribute("someString", objectName);
This will work If its from one page to another only.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top