Struggling with Struts

Today I was looking at session size of one webapp: it was increasing while using application functions…. 50k, 60k, 70k, 80k… wtf? I know programmers were warned about inserting data into the session, cleaning the stuff after using it, so what? Well, the reason is that if you don’t decide else Struts 1 will put all your forms inside your session! I couldn’t believe it!

Let’s go reading the official documentation… Struts guys gently suggest: “…as a general rule, allocating scarce resources and keeping them across requests from the same user (in the user’s session) can cause scalability problems…”
Well, good rule of thumb! We do know about this!

But, some paragraph after, the deadly note: “…an ActionForm represents an HTML form that the user interacts… ActionForms can be stored in either the session (default) or request scope…”

WHAT? You guys really said that forms are stored in the session by default???

I don’t know what to say… sadly in the next days a development group will be analyzing one by one our 640 usecases and 1465 form, just to ensure that moving them to request scope (oh, yeah, you also have to modify line by line your xml config) will keep the field clear.

I know, ignorance is not an excuse, but now I understand why struts 1.x is over, and why struts 2.x ISA webwork 🙂

Domenico, a friend of mine and expert programmer, pointed me out this bad trick… thanks! I’ll use it as last resource.


One thought on “Struggling with Struts

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s