Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jsp And Servlets Clash

 
ch praveen
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends,
For my multiclient chatserver program, I have created a login page in jsp (login.jsp) that stores the users details(as a hashtable) in a SevletContext by the name USERS_TABLE. If I tried to access that users list in a servlet (ChatServer.java) , null value is being returned and corresponding exception is thrown. But if the same thing is implemented in servlets itself (login.java), things are working fine. Can't we set ServletContext's attributes and Session Attritibute's in a JSP page and could retrieve in a SERVLET and viceversa. Eventhough jsp is a wrapper for a servlet, why this is not working. I greatly appreciate your valuable suggestions in advance.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65105
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please see this topic for a message concerning your display name.
If the servlet and JSP are in the same context they will both access the same servlet context.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic