You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Terence Jacyno <tj...@galasoft.net> on 2001/08/12 02:00:27 UTC

Struts and WebSphere

Hi.

I am now taking the WebSphere journey and have decided to take Struts
along for the ride.  It promises to be a bumpy one at that ;-).  Anyway,
I have noticed that WebSphere seems to choke on the form tags.
Fortunately, there is a rather easy way to fix this.

Currently, within the org.apache.struts.taglib.html.FormTag class,
starting at line number 591 (the doEndTag() method), the following code
appears:

    pageContext.removeAttribute(Constants.BEAN_KEY,
                                    PageContext.REQUEST_SCOPE);
    pageContext.removeAttribute(Constants.FORM_KEY,
                                    PageContext.REQUEST_SCOPE);

In order for this to work within WebSphere, the following should appear
instead:

    try {
        pageContext.removeAttribute(Constants.BEAN_KEY,
                                        PageContext.REQUEST_SCOPE);
    } catch (IllegalArgumentException iaex) {}
    try {
        pageContext.removeAttribute(Constants.FORM_KEY,
                                        PageContext.REQUEST_SCOPE);
    } catch (IllegalArgumentException iaex) {}

I have double checked with the code in CVS to make sure that this change
has not already been done.

For now, everything else seems to be going OK.

Terence


Re: Struts and WebSphere

Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Sat, 11 Aug 2001, Terence Jacyno wrote:

> Hi.
> 
> I am now taking the WebSphere journey and have decided to take Struts
> along for the ride.  It promises to be a bumpy one at that ;-).  Anyway,
> I have noticed that WebSphere seems to choke on the form tags.
> Fortunately, there is a rather easy way to fix this.
> 
> Currently, within the org.apache.struts.taglib.html.FormTag class,
> starting at line number 591 (the doEndTag() method), the following code
> appears:
> 
>     pageContext.removeAttribute(Constants.BEAN_KEY,
>                                     PageContext.REQUEST_SCOPE);
>     pageContext.removeAttribute(Constants.FORM_KEY,
>                                     PageContext.REQUEST_SCOPE);
> 
> In order for this to work within WebSphere, the following should appear
> instead:
> 
>     try {
>         pageContext.removeAttribute(Constants.BEAN_KEY,
>                                         PageContext.REQUEST_SCOPE);
>     } catch (IllegalArgumentException iaex) {}
>     try {
>         pageContext.removeAttribute(Constants.FORM_KEY,
>                                         PageContext.REQUEST_SCOPE);
>     } catch (IllegalArgumentException iaex) {}
> 
> I have double checked with the code in CVS to make sure that this change
> has not already been done.
> 
> For now, everything else seems to be going OK.
> 
> Terence
> 
> 

It will *never* be done in CVS.

WebSphere relies on a very old implementation of Jasper (from Tomcat 3.1)
that does not correctly implement the pageContext.removeAttribute()
method.  That needs to be fixed.

In the mean time, there are unofficial releases of struts.jar that deals
with this temporary problem, but the official release is not going to
accomodate this spec violation.

Craig