How are you doing the database interactions with your MS SQL Server? JDBC
with some ODBC connectivity kit or some other way?

Regards,
David

-----Original Message-----
From: calandraca [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 08, 2004 1:04 PM
To: Struts Users Mailing List
Subject: strange random problem


Since I have rewrited an important part of my application using struts
I've had this problem several times. It didn't happen in development
environment, with only one or two users using the application at the
same time. It happends in production with 20 or 30 users.

* Development environment: Debian GNU/Linux, Jonas 4.1.2 application
server with Tomcat 5.0.25, J2SE 1.4.2, Struts 1.1, MS SQL Server (on
different Win2000 machine)

* Production environment: Win2000 SP4, Jonas 4.1.2 application server
with Tomcat 5.0.25, J2SE 1.4.2, Struts 1.1, MS SQL Server.

 All forms are request scoped (I think I don't need session, probably
I'm saving memory). Every of them have implemented the reset method
setting variables to their initial values, this is made in
constructors too.

* This is a bit more complex so I'll try to simplify the explanation
with a generic example:

 1. I have one object wich instances can be edited and updated by
users, saving its instance values to a database. I have two actions:
EditObjectAction and UpdateObjectAction, each of them with their forms
(EditObjectForm and UpdateObjectForm).

2. EditObjectForm has only one String attribute that contains the
primary key (id) of the object we want to edit, submitted from a jsp
page.

3. EditObjectAction gets the primary key from the form, instances the
object and call the necesary methods on it in order to load the rest
of object data from database. Then the action put the object in the
request using request.setAttribute("objectName", object) method and
makes a forward (using mapping.findForward(...)) to the page data.jsp.

4. Into the data.jsp page I render the view using struts-html,
struts-html-el and c (JSTL) taglibs, extracting the necessary
information from the request object using JSTL expressions like:
<c:out value="${objectName.attribute}"/>. The <html:form/> tag has
this content:

      a) Primary key: <html-el:hidden property="id" value="${objectName.id}"
/>
      b) Rest of object data using <html_el:text/> and other useful
tags like loops etc.

5. When the user change and submits the data, UpdateObjectForm is
created and filled by struts, content validated, and passed to
UpdateObjectAction. The action takes the id from the form and
instances the object again from database, it updates object values
from the form in memory and database, puts the object into request and
forward to data.jsp again.

6. Data.jsp is rendered from the request object again with the new
submitted data.

Note that the object is NEVER stored into the session. Forms are
request scoped. The only information I keep into session is the logged
user. I don't use application scope.

The problem is that sometimes (about 10% more or less), once the
object is updated, the next view shows data from another different
object instance that is currently being managed by other user. The
forward or the render fails. I thought about a possible coding or
design error, but is it not impossible to access data from other
session? moreover the object is stored into request. Am I using struts
in a correct way? Could it be a taglibs or struts bug or configuration
error? What do you think about trying struts 1.2.2 or using linux in
production? I think probably is much more easy but I don't see it.

Thank you in advance

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to