jump to navigation

DynaActionForm Properties not set – BUG with indexed form properties March 7, 2008

Posted by Tomas in IBM Webspehere.
Tags:
1 comment so far

One of the most annoying “features” of the Websphere Portal that it uses butchered (aka modified) Struts 1.1 Framework. During this “modification” some things fell through the cracks and some interesting bugs got introduced. I spend 2 days blidly debugging this piece of shit portal to find a workaround.

Here is the problem: You have a DispactchAction and a DynaActionForm you add indexed properties on your jsp page and some of those indexed properties are not being set. If you debug it, you see the values in the request, but they never make it to the form. And some of the other form properties, not only indexed are not being set out of a sudden. If you remove the indexed properties from the form and jsp everything starts working.

The bug lies somewhere in the modified struts framework. Modified code does not recognize a setter method with signature setSomething( String value) as a valid setter method. This bug only surfaces if indexed properties exist in the form and jsp. To get around this bug you must change the signature to setSomethig( Object value ) and you get the values.

Here is the example:

Form:
<form-bean name=”roleForm” type=”org.apache.struts.action.DynaActionForm”>
<form-property name=”role”
<form-property name=”attribute” type=”com.something.model.Attribute[]” size=”100″ />
</form-bean>

Jsp:
<logic:iterate id=”attribute” name=”roleForm” property=”role.attributes” >
<tr>
<td>
<html:hidden indexed=”true” name=”attribute” property=”id” />
<html:hidden indexed=”true” name=”attribute” property=”version” />
<html:text indexed=”true” property=”key” name=”attribute” size=”20″ maxlength=”250″ />
</td>
<td><html:text indexed=”true” property=”value” name=”attribute” size=”20″ maxlength=”250″ /></td>
<td><input type=”submit” value=”Delete” /></td>
</tr>
</logic:iterate>

Which produces:
<tr>
<td>
<input type=”hidden” name=”attribute[0].id” value=”1″>
<input type=”hidden” name=”attribute[0].version” value=”1″>
<input type=”text” name=”attribute[0].key” maxlength=”250″ size=”20″ value=”TEST”>
</td>
<td><input type=”text” name=”attribute[0].value” maxlength=”250″ size=”20″ value=”TEST2″></td>
<td><input type=”submit” value=”Delete” /></td>
</tr>

So you must have:
public void setKey(String key) {
this._key = key;
}
public void setKey(Object key) {
this._key = key.toString();
}

For this to work.

Advertisements

Struts Portlet and JSP do not share the session in Websphere Portal February 27, 2008

Posted by Tomas in IBM Webspehere.
Tags:
add a comment

This is the most annoying thing I found about Websphere Portal: Struts Portlet and Servlet do not share the Session! How stupid is that? We are using Struts 1.1 based Portlets and coincidently Struts uses JSP pages which at runtime are compiled into…. you guessed it – Servlets. So now When user logs into portal we load a permission map and stick it into the session so every part of the webapp can validate what a given user can do inside the application. Almost every part, since Portlet and Servlet do not share the Session you can not get to the permission map in the Session.

After extensive testing it has been confirmed to work with generic Portlet and Servlet, but if you use Struts Portlet the things that put into the session in the portlet or your action classes you can not be found in the JSP pages.

Stay away from Websphere Portal if you can.

IBM Websphere Portal is Web 0.5 February 26, 2008

Posted by Tomas in IBM Webspehere.
Tags:
1 comment so far

One of the selling Websphere Portal features is the integrated MVC framework – Struts. Websphere Portal uses modified Struts 1.1 Framework. Not only modifications are buggy, but it is ancient! Struts 1.1 was released on 29th of June 2003. This is Web 0.5 technology, the rest of the world have moved on but Websphere portal stayed behind.

No to mention that Webshpere portal runs on modified (why would you do that?) 1.4 jdk. This complicates things a lot. No modern tools can be used for development or troubleshooting. We tried to profile the slowness using Netbeans and struggled. Old JDK version would not allow us to use native java debugging capabilities and modified JVM crashes because of class versioning.

So if you can use tomcat or something based on it and stay away form Websphere Portal.

Why there is no information on the net about the bad parts of Webshpere Portal? February 25, 2008

Posted by Tomas in IBM Webspehere.
Tags:
1 comment so far

If you search the net trying to decide if you (most likely the company you work for) want to use Websphere portal, but you can not find anything negative about it. Can it be that this piece of software has no flaws? Or just nobody in the world is using it? How can it be that there are no accounts of developer experience on the net about this product……

We about to change all this. I have been coding in this piece of crap product and its development environment for about 6 months now. And plainly put this is the biggest piece of crap I have ever used so far.