This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

java servlets extending jpanel  RSS feed

 
Shobana Sukumar
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it possible to extend jpanel in a servlet.if so kindly illustrate with an example.....
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. JPanel is a Swing concept, not an HTML concept.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Although I can just about imagine an application with a Swing UI that also serves HTTP requests, it does not really make sense to do both these functions in a single class.

Apart from anything else, the great majority of Servlets extend from GenericServlet or HttpServlet, and thus cannot also extend from JPanel. While you could get round this by implementing the basic javax.servlet.Servlet interface in your JPanel class, it would be very weird indeed to have a JPanel created and managed by a web server.

Can you explain a bit more about what you are trying to achieve by doing this?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!