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.
1 Answer
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.
2 Comments
user2966968
If I create an object of a class in one jsp page, how do I use that object in another jsp page?
Jozef Chocholacek
Depends on when the other page needs it - learn about request, session, and servlet context.