• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Multi user program

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to store array of data in session without useing <%! %> .... iam sorry if iam asking stupid question
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic