File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Multi user program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Multi user program" Watch "Multi user program" New topic
Author

Multi user program

raj eevan
Greenhorn

Joined: Apr 26, 2013
Posts: 3
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

Joined: Jan 10, 2002
Posts: 60782
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
raj eevan
Greenhorn

Joined: Apr 26, 2013
Posts: 3
Thank you,
Any specific link for quick understading of JSTL
raj eevan
Greenhorn

Joined: Apr 26, 2013
Posts: 3
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.
 
subject: Multi user program
 
Similar Threads
Text Box Validation
jsp form with two submit button
ArrayIndexOutOfBoundsException
EL cookie Problem
Stack Overflow Error