Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multi user program

 
raj eevan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can any one help me out on this code below. my requirement is to store data entered in array and later use for updating database. my issue is accessing in different browser (multi user).

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
<%!
tester dd = new tester();
%>
<%! class tester {
ArrayList accLi = new ArrayList();
}%>
</head>
<body>
<form>
<%
dd.accLi.add(request.getParameter("accno"));
for (int i = 0; i < dd.accLi.size(); i++) {
out.println(dd.accLi.get(i));
}
%>
<input type="text" name="accno"/>
<input type="button" name="btadd" value="add" onclick="submit()"/>
</form>
</body>
</html>
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64700
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The use of scriptlets in JSPs has been obsolete for over 12 years. You should not be using them at all.

But in particular, your issue is the use of <%! %>. This limits your web app to a single user as the values are shared across all threads. Don't use these. Ever.

You need to refactor your web app to use the JSTL and EL, and to store user-specific values in the session.
 
raj eevan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you,
Any specific link for quick understading of JSTL
 
raj eevan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to store array of data in session without useing <%! %> .... iam sorry if iam asking stupid question
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic