• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSPs and Servlets accessing shared classes

 
Wolfgang Stein
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, i have some questions:
1) Is it possible to put (and access directly) a JSP among servlets located beneath WEB-INF/classes ?
2) Is it possible to package (and access directly) a JSP along with other classes located beneath WEB-INF/classes ?
or
3) Is JSP access generally restricted to directories above WEB-INF ?

I build an admin JSP that generates some statistics about my servlets (concurrent requests, size of connection pool, log-level, duration of request handling ...)
To implement this, the JSP must access some static fields of a superclass all my servlets inherit from. It should also have access to some package level protected fields of some other classes packaged with that superclass.
I tried to
- let the JSP inherit from the same superclass all my servlets inherit from.
- package the JSP together with my servlets superclass.
No success.
Of course, i could write an admin SERVLET with package access, but a JSP seems to be a quick (and maybe dirty) alternative, if HTML formatting code dominates java servlet code.
Did i miss something elementary?
Many thanks in advance,
Wolfgang
[This message has been edited by Wolfgang Stein (edited March 26, 2001).]
[This message has been edited by Wolfgang Stein (edited March 26, 2001).]
[This message has been edited by Wolfgang Stein (edited March 26, 2001).]
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
as these values are static, can you not just access them by name in the JSP anyway:
<%= something.other.Whatever.value %>
I guess they would need to be public for this to work. Is that a problem?
 
Wolfgang Stein
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks,
does that mean a JSP (or the resulting servlet) can generally not be packaged to gain access to members with package level protection?
So i will modify these members as 'public' and try again.
Thanks for your prompt reply!
Wolfgang
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic