Bug 131756 - Drop lists currently have to be added as Session variables
Drop lists currently have to be added as Session variables
Status: CLOSED CURRENTRELEASE
Product: Red Hat Network
Classification: Red Hat
Component: RHN/R&D (Show other bugs)
RHN Devel
All Linux
medium Severity medium
: ---
: ---
Assigned To: Mike McCune
Red Hat Satellite QA List
:
: 137431 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-09-03 18:39 EDT by Mike McCune
Modified: 2007-04-18 13:11 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-12-06 02:15:12 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Mike McCune 2004-09-03 18:39:13 EDT
All our other UI widgets are added as request attributes.  But because
of struts we have to add them to the Session.
Comment 1 Mike McCune 2004-09-03 18:39:40 EDT
EMAIL Conversation about the issue:

Yeah, I wasn't pleased with this either, I didn't want to use a
session variable for a widget.  Not something that should go in the
session...

So, the reason its there is I did the following while getting
validation to work (this was a few weeks ago, so I could be getting
some of the details off):

1) Started out treating it like a standard request variable:

request.setAttribute("availableCountries",
    UserActionHelper.getCountries());

This works fine if your form is a:

org.apache.struts.action.DynaActionForm

2) Switched the form over to a:

org.apache.struts.validator.DynaValidatorForm

Then, upon hitting the page I got a nasty stacktrace:

javax.servlet.ServletException: Cannot find bean under name
availablePrefixes

I was like, WTF, what is broken in DynaValidatorForm that makes it no
longer able to recognize Objects within the request when using the:

          <html:options collection="availablePrefixes"
            property="value"
            labelProperty="label" />

tag.  I did lots of digging and messing around.  I tried the following:

a) Adding the collection on the form class as a <form-property> in the
struts-config.  This did nothing, lame.  Same error.

b) Adding the above collection in step a) and also did a <bean:define>
above the <html:options> tag so it would force it to be available to
the JSP.  This sort of worked but once you submitted the page, the
list would become empty.

c) Added it to the session.  This worked, but made me feel dirty.

After spending about a day on this annoying problem I felt it was time
to move onto other things.  This problem only seems to be related to
the usage of html:options.  All the other components on the pages
behaved the same once validation was turned on.  One way around it
would be to re-write our own html:options tag, but that seemed a bit
over the top.

It would be interesting to try this with Struts 1.2 and leaving it as
a request variable to see if it was any different.

If anyone else has thoughts on how to *not* use a session variable to
solve this problem, I'd definitely appreciate it.

Mike

Chip Turner wrote:

> EditAddressAction uses a setSession to set the list of available
> countries for a user; is this absolutely necessary?  It makes sense to
> put something like this at the -request- scope, but session scope
> means it'll last around foreverandever... is that what we really want?
>
> Likewise for prefixes on the CreateUserAction?
>
> There is a comment that says struts throws them away if validation
> fails, but when validation fails, shouldn't it be sending a failure to
> a page that has as its pre-render-action the code that sets these up
> at the request scope?  I'm not quite following the flow of what
> breaks.
>
> Chip
>
Comment 2 Mike McCune 2004-12-03 13:13:08 EST
*** Bug 137431 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.