• Post Reply Bookmark Topic Watch Topic
  • New Topic

User data overlapping in JSP pages  RSS feed

 
Karthikean Konangi
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I had written methods in JSP page using scriptlets ,for displaying user data. While accessing this page by multiple concurrent users , the data was overlapping form one user to another user. How can i restrict this data overlapping?
 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should write method in declation section i.e. <%! %>.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should never declare variables in a <%! %> block. In fact, you shouldn't even be using scriptlets at all at this point.
 
Karthikean Konangi
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Hi-jack removed]
[ March 05, 2008: Message edited by: Ben Souther ]
 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are diverting from the original post. Create a new thread for your new issue.
 
Karthikean Konangi
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes Bear,,you are correct ,, i have declared variables using <%! %>
Because, i have to use these variables in multiple methods to display data to user. How can i declare varaibles, which can be accssible in other methods too??
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSP is not well suited to such tasks. This is one of the reasons that modern JSP discourages the use of scriptlets. You should factor the Java code out into servlet controllers.
 
Karthikean Konangi
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Bear,, I got the solution for this by doing the same in servlet.

 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using instance variables in your servlet too?
If so, you're going to have the same problem.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!