I want to import a class that is inside one jsp page to another jsp page. How must I write the import statement for it? For example I have a jsp page called Login.jsp which contains a class called User. I want to import this User class into another jsp page called Shop.jsp.
Asked
Active
Viewed 526 times
1 Answers
1
Short: Not possible.
Longer: I could imagine few very dirty hacks to achieve what you want, but the whole conception is wrong. If you have classes to be shared between different JSP pages, these classes should be externalized, compiled independently, and then referenced (imported) as such in such JSP pages.

Jozef Chocholacek
- 2,874
- 2
- 20
- 25
-
If I create an object of a class in one jsp page, how do I use that object in another jsp page? – user2966968 Jan 11 '17 at 16:32
-
Depends on when the other page needs it - learn about [request, session, and servlet context](http://stackoverflow.com/a/15433931/3511123). – Jozef Chocholacek Jan 12 '17 at 07:39