You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Arne Brutschy <ab...@xylon.de> on 2007/09/17 17:27:16 UTC

Strange problem after upgrading from struts 1.1 to 1.3.8

Hello,

I'm experiencing a strange problem after upgrading from struts 1.1 to
1.3.8. Perhaps the problem is known or expected, I haven't found a
solution yet.

Basic structure:

  setupUser.do    fills in the form for a user profile
  user.jsp        displays the user profile form
  editUser.do     dispatches to UserDispatchAction

Most of the stuff is quite forward, except that I'm using custom tags
to display the form. The tags check the current users group
memberships and display or do not display the appropriate input
element. Example: there are checkboxes for users access rights. If the
current user is in the "admin" group, the boxes get displayed. If the
user is not (ie. the user is editing his own profile to change the
password) these input elements aren't displayed.

After the user hits the "update" button, the data get's forwarded to
UserDispatchAction.update(), where I copy it to the model and update
the backend. My problem is now: before the upgrade, _every_
attribute/value paris were included in the request, even the ones the
user couldn't edit. Now, after the upgrate, only the editable
attributes (the ones which had input elements in the form) are
transported. The result is, that I'm ending up with a corrupted model
because half of the attributes are missing.

Everything works fine, if an administrator submits the form (because
every attribute has an input element displayed). When a normal user is
submitting the form, all elements are listed in the DynaForm object,
but are set to null.

I'm not sure if the reason for this is some change in the tags (my
tags are simply wrappers around the standard struts tags, ie.
XylonTextTag extends TextTag) or the changes in the request wrapper
system. I tried to set
<controller processorClass="org.apache.struts.action.RequestProcessor" />
in the struts config as well, but no change.

BTW, I followed every step from http://wiki.apache.org/struts/StrutsUpgrade
for the upgrade. And I'm using tomcat 5.0.28...

Regards,
Arne



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re[5]: Strange problem after upgrading from struts 1.1 to 1.3.8 (RequestWrappers not working anymore?)

Posted by Arne Brutschy <ab...@xylon.de>.
Hi,

I used to filter the request parameters of certain actions. It works
like this: the original bean is stored in the session. When the user
hits update, the filter replaces the paramters submitted by the user
with the original ones. Then, it replaces or deletes the values the
user has changed and has access to. In that way I always end up with a
valid bean...

I'm using a requestwrapper, as the parameter map of the original request
isn't writable. My problem is now that as soon as the wrapper is used
to encapsulate the request, the action mapping isn't working anymore.
So after the user hits update, he returns to the start page (but he
should be redirected to the UserDispatchAction).

I thought about reimplementing my filters as chain commands, but that
would be alot of trouble... And it doesn't help with the non-writeable
parameter map.

Any ideas why the request wrappers aren't working anymore?

Arne


Struts Users Mailing List wrote:
D>> Something in your application is pre-loading the
D>> dynaform with reasonable values, no? I don't really
D>> remember S1.1 at this point; do you have a filter,
D>> request processor, action controller, etc. other than
D>> the default?
A> Yes, as it turns out, I'm using a request filter defined in the
A> web.xml for the actions. It looks up the actions, fetches the original
A> bean of the form, and checks for every submitted request parameter if
A> the user has access. If yes, it replaces the attribute with the new
A> values, if not, the change will be discarded.

A> I'm currently trying to find out why the request filter doesn't work
A> anymore. I thought this is not connected to the new request processor,
A> as it's defined in the web.xml outside of struts. And I'm using the
A> old request processor in the struts-config.xml:

A> <controller
A> processorClass="org.apache.struts.action.RequestProcessor" />

A> The only change I made to the filter was replacing
A>     public HttpServletRequest getRequest()
A> by
A>     public ServletRequest getRequest()



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re[4]: Strange problem after upgrading from struts 1.1 to 1.3.8

Posted by Arne Brutschy <ab...@xylon.de>.
Hi,

D> With what?
Well, that was what I was asking myself. :) Problem is, the app hasn't
been touched since 4 years. So I kind of re-engineering here.

D> Something in your application is pre-loading the
D> dynaform with reasonable values, no? I don't really
D> remember S1.1 at this point; do you have a filter,
D> request processor, action controller, etc. other than
D> the default?
Yes, as it turns out, I'm using a request filter defined in the
web.xml for the actions. It looks up the actions, fetches the original
bean of the form, and checks for every submitted request parameter if
the user has access. If yes, it replaces the attribute with the new
values, if not, the change will be discarded.

I'm currently trying to find out why the request filter doesn't work
anymore. I thought this is not connected to the new request processor,
as it's defined in the web.xml outside of struts. And I'm using the
old request processor in the struts-config.xml:

<controller processorClass="org.apache.struts.action.RequestProcessor" />

The only change I made to the filter was replacing
    public HttpServletRequest getRequest()
by
    public ServletRequest getRequest()

Arne


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re[3]: Strange problem after upgrading from struts 1.1 to 1.3.8

Posted by Arne Brutschy <ab...@xylon.de>.
Hi,

I'm just thinking aloud, so perhaps someone can drop-in and shed some
light here... :)

Post data send by browser is identical on both versions (old: struts
1.1 and new: struts 1.3.8). It contains only the displayed parameters,
nothing else. So in the old version, when the request arrives at
ActionServlet.process(), _all_ parameters and values of the
DynaActionform are in the HttpServletRequest included. In the new
version, there's a CoyoteRequest object, which hold only the submitted
parameters. I wonder what happens before the process() method? I
through the servlet container calls this directly? What method sets
the other parameter/value pairs in the request?

confused,
Arne

A> I just found out that the postdata didn't contain the attributes as
A> well when using struts 1.1. So nothing changed here. But when I get at
A> the beginning of the UserDispatchAction.update(), the dynaform has all
A> values filled in. So I'm wondering where struts fills in the data, and
A> why it doesn't do it anymore in 1.3.8

A> Arne

A> Paul Benedict wrote:
P>> It is part of the HTML spec that disabled fields are not submitted in the
P>> request. This is not a Struts thing but HTML. You should make sure the HTML
P>> is being rendered the same, because that's probably what is causing your
P>> problem.

P>> Paul

P>> On 9/17/07, Arne Brutschy <ab...@xylon.de> wrote:
>>>
>>> Hi,
>>>
>>> A> I'm not sure if the reason for this is some change in the tags (my
>>> A> tags are simply wrappers around the standard struts tags, ie.
>>> A> XylonTextTag extends TextTag) or the changes in the request wrapper
>>> A> system. I tried to set
>>> A> <controller
>>> A> processorClass="org.apache.struts.action.RequestProcessor" />
>>> A> in the struts config as well, but no change.
>>> After debugging hours through tomcat code, I'm sure the Request
>>> processor is not the problem. At least, as soon as the request hits
>>> the action servlet, the postdata contains only the described
>>> parameters and not the ones the user couldn't write to.
>>>
>>> So I guess it's been some change in the tags or something else.. I
>>> will continue tomorrow...
>>>
>>> Arne
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>




-- 
Arne Brutschy                    M ++49-170-7568918
Kantstr. 35                      @ abrutschy@xylon.de
04275 Leipzig                    


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Re[2]: Strange problem after upgrading from struts 1.1 to 1.3.8

Posted by Dave Newton <ne...@yahoo.com>.
--- Arne Brutschy <ab...@xylon.de> wrote:
> But when I get at the beginning of the 
> UserDispatchAction.update(), the dynaform 
> has all values filled in.

With what?

Something in your application is pre-loading the
dynaform with reasonable values, no? I don't really
remember S1.1 at this point; do you have a filter,
request processor, action controller, etc. other than
the default?

d.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Re[2]: Strange problem after upgrading from struts 1.1 to 1.3.8

Posted by Dave Newton <ne...@yahoo.com>.
--- Arne Brutschy <ab...@xylon.de> wrote:
> But when I get at the beginning of the 
> UserDispatchAction.update(), the dynaform 
> has all values filled in.

With what?

Something in your application is pre-loading the
dynaform with reasonable values, no? I don't really
remember S1.1 at this point; do you have a filter,
request processor, action controller, etc. other than
the default?

d.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re[2]: Strange problem after upgrading from struts 1.1 to 1.3.8

Posted by Arne Brutschy <ab...@xylon.de>.
Hi,

I just found out that the postdata didn't contain the attributes as
well when using struts 1.1. So nothing changed here. But when I get at
the beginning of the UserDispatchAction.update(), the dynaform has all
values filled in. So I'm wondering where struts fills in the data, and
why it doesn't do it anymore in 1.3.8

Arne

Paul Benedict wrote:
P> It is part of the HTML spec that disabled fields are not submitted in the
P> request. This is not a Struts thing but HTML. You should make sure the HTML
P> is being rendered the same, because that's probably what is causing your
P> problem.

P> Paul

P> On 9/17/07, Arne Brutschy <ab...@xylon.de> wrote:
>>
>> Hi,
>>
>> A> I'm not sure if the reason for this is some change in the tags (my
>> A> tags are simply wrappers around the standard struts tags, ie.
>> A> XylonTextTag extends TextTag) or the changes in the request wrapper
>> A> system. I tried to set
>> A> <controller
>> A> processorClass="org.apache.struts.action.RequestProcessor" />
>> A> in the struts config as well, but no change.
>> After debugging hours through tomcat code, I'm sure the Request
>> processor is not the problem. At least, as soon as the request hits
>> the action servlet, the postdata contains only the described
>> parameters and not the ones the user couldn't write to.
>>
>> So I guess it's been some change in the tags or something else.. I
>> will continue tomorrow...
>>
>> Arne
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>


-- 
Arne Brutschy                    M ++49-170-7568918
Kantstr. 35                      @ abrutschy@xylon.de
04275 Leipzig                    


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re[2]: Strange problem after upgrading from struts 1.1 to 1.3.8

Posted by Arne Brutschy <ab...@xylon.de>.
Hello,

P> It is part of the HTML spec that disabled fields are not submitted in the
P> request. This is not a Struts thing but HTML. You should make sure the HTML
P> is being rendered the same, because that's probably what is causing your
P> problem.
Hmm, I thought it might be like this. I'm just wondering why struts
1.1 is submitting the data. I don't know why my application is relying
on that, but it does (it's a bit old). Hmm, now I need to find a
work-around..

Is there a way to pass model attributes through the form without the
user seeing it (or having the possibility to alter them like the
hidden form fields)?

Thanks!
Arne

P> On 9/17/07, Arne Brutschy <ab...@xylon.de> wrote:
>>
>> Hi,
>>
>> A> I'm not sure if the reason for this is some change in the tags (my
>> A> tags are simply wrappers around the standard struts tags, ie.
>> A> XylonTextTag extends TextTag) or the changes in the request wrapper
>> A> system. I tried to set
>> A> <controller
>> A> processorClass="org.apache.struts.action.RequestProcessor" />
>> A> in the struts config as well, but no change.
>> After debugging hours through tomcat code, I'm sure the Request
>> processor is not the problem. At least, as soon as the request hits
>> the action servlet, the postdata contains only the described
>> parameters and not the ones the user couldn't write to.
>>
>> So I guess it's been some change in the tags or something else.. I
>> will continue tomorrow...
>>
>> Arne
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>


-- 
Arne Brutschy                    M ++49-170-7568918
Kantstr. 35                      @ abrutschy@xylon.de
04275 Leipzig                    


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Strange problem after upgrading from struts 1.1 to 1.3.8

Posted by Paul Benedict <pb...@apache.org>.
It is part of the HTML spec that disabled fields are not submitted in the
request. This is not a Struts thing but HTML. You should make sure the HTML
is being rendered the same, because that's probably what is causing your
problem.

Paul

On 9/17/07, Arne Brutschy <ab...@xylon.de> wrote:
>
> Hi,
>
> A> I'm not sure if the reason for this is some change in the tags (my
> A> tags are simply wrappers around the standard struts tags, ie.
> A> XylonTextTag extends TextTag) or the changes in the request wrapper
> A> system. I tried to set
> A> <controller
> A> processorClass="org.apache.struts.action.RequestProcessor" />
> A> in the struts config as well, but no change.
> After debugging hours through tomcat code, I'm sure the Request
> processor is not the problem. At least, as soon as the request hits
> the action servlet, the postdata contains only the described
> parameters and not the ones the user couldn't write to.
>
> So I guess it's been some change in the tags or something else.. I
> will continue tomorrow...
>
> Arne
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Strange problem after upgrading from struts 1.1 to 1.3.8

Posted by Arne Brutschy <ab...@xylon.de>.
Hi,

A> I'm not sure if the reason for this is some change in the tags (my
A> tags are simply wrappers around the standard struts tags, ie.
A> XylonTextTag extends TextTag) or the changes in the request wrapper
A> system. I tried to set
A> <controller
A> processorClass="org.apache.struts.action.RequestProcessor" />
A> in the struts config as well, but no change.
After debugging hours through tomcat code, I'm sure the Request
processor is not the problem. At least, as soon as the request hits
the action servlet, the postdata contains only the described
parameters and not the ones the user couldn't write to.

So I guess it's been some change in the tags or something else.. I
will continue tomorrow...

Arne


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org