RE: Design Question: Forms-and-Validation, which scope to use for dynamic beans?

2003-08-14 Thread Steve Raeburn
In your action configuration set the 'input' URL to point to an action
instead of your JSP and then build your lists in the action.

Steve

 -Original Message-
 From: Gino LV. Ledesma [mailto:[EMAIL PROTECTED]
 Sent: August 10, 2003 10:28 PM
 To: Struts Users Mailing List
 Subject: Design Question: Forms-and-Validation, which scope to use for
 dynamic beans?


 Hello,

 I've been using the Struts framework for a couple of months
 now and have really fancied it. I try as much as possible
 to adhere to the MVC guidelines, but have run into a couple
 of problems I've not been able to solve.

 I have a form which is validated by Struts-validator. One
 of the form's properties is a pull-down menu which contains
 list of selectable items. These list of selectable items
 are generated dynamically (by being called from an EJB).
 The problem I have is when an error in the form occurs
 Struts brings back the form page, but the servlet container
 (Tomcat) then reports a no such bean error -- this bean
 containing the list of items that populate the pull-down
 menu.

 The bean is stored in a request-level scope by the
 controller servlet. Now when the form is submitted (new
 request), and an error is found, the form is displayed
 again. But because the bean was stored in a request-level
 scope, the bean is no longer found.

 What is the propery way of fixing this? Currently, I've
 implemented a tag which generates this list (it basically
 calls the EJB) and stores it in a page-level scope, so the
 servlet no longer bothers storing this in any scope. But
 doesn't doing this break the separate logic from the
 view rule? I don't want to store it in the session-level
 scope as well as the list _can_ be updated frequently.
 Granted, the session-scope seems to be the ideal solution,
 though.

 What are your thoughts on this? I'd appreciate help on the
 matter, as I'm weeding out non-conforming implementations
 in my code. :)

 Thanks for your help in advance.

 =


 __
 Do you Yahoo!?
 Yahoo! SiteBuilder - Free, easy-to-use web site design software
 http://sitebuilder.yahoo.com

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Design Question: Forms-and-Validation, which scope to use for dynamic beans?

2003-08-14 Thread Gino LV. Ledesma
Hello,

I've been using the Struts framework for a couple of months
now and have really fancied it. I try as much as possible
to adhere to the MVC guidelines, but have run into a couple
of problems I've not been able to solve.

I have a form which is validated by Struts-validator. One
of the form's properties is a pull-down menu which contains
list of selectable items. These list of selectable items
are generated dynamically (by being called from an EJB).
The problem I have is when an error in the form occurs
Struts brings back the form page, but the servlet container
(Tomcat) then reports a no such bean error -- this bean
containing the list of items that populate the pull-down
menu.

The bean is stored in a request-level scope by the
controller servlet. Now when the form is submitted (new
request), and an error is found, the form is displayed
again. But because the bean was stored in a request-level
scope, the bean is no longer found.

What is the propery way of fixing this? Currently, I've
implemented a tag which generates this list (it basically
calls the EJB) and stores it in a page-level scope, so the
servlet no longer bothers storing this in any scope. But
doesn't doing this break the separate logic from the
view rule? I don't want to store it in the session-level
scope as well as the list _can_ be updated frequently.
Granted, the session-scope seems to be the ideal solution,
though.

What are your thoughts on this? I'd appreciate help on the
matter, as I'm weeding out non-conforming implementations
in my code. :)

Thanks for your help in advance.

=


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Design Question: Forms-and-Validation, which scope to use for dynamic beans?

2003-08-14 Thread Gino LV. Ledesma
Thanks for the quick reply. Does this work if the action
requires additional request parameters, however? Not that
my particular servlet will require it, but some of them do.

For example, say I have something like:
/createObjectB.do?parentID=1

Where ObjectB has ObjectA for its parent (and is necessary
for the creation to filter its attributes).

Gino LV. Ledesma
Ateneo de Manila University

// Programmer's Excuse #4: It was working yesterday.

--- Steve Raeburn [EMAIL PROTECTED] wrote:
 In your action configuration set the 'input' URL to point
 to an action
 instead of your JSP and then build your lists in the
 action.
 
 Steve
 
  -Original Message-
  From: Gino LV. Ledesma [mailto:[EMAIL PROTECTED]
  Sent: August 10, 2003 10:28 PM
  To: Struts Users Mailing List
  Subject: Design Question: Forms-and-Validation, which
 scope to use for
  dynamic beans?
 
 
  Hello,
 
  I've been using the Struts framework for a couple of
 months
  now and have really fancied it. I try as much as
 possible
  to adhere to the MVC guidelines, but have run into a
 couple
  of problems I've not been able to solve.
 
  I have a form which is validated by Struts-validator.
 One
  of the form's properties is a pull-down menu which
 contains
  list of selectable items. These list of selectable
 items
  are generated dynamically (by being called from an
 EJB).
  The problem I have is when an error in the form occurs
  Struts brings back the form page, but the servlet
 container
  (Tomcat) then reports a no such bean error -- this
 bean
  containing the list of items that populate the
 pull-down
  menu.
 
  The bean is stored in a request-level scope by the
  controller servlet. Now when the form is submitted (new
  request), and an error is found, the form is displayed
  again. But because the bean was stored in a
 request-level
  scope, the bean is no longer found.
 
  What is the propery way of fixing this? Currently,
 I've
  implemented a tag which generates this list (it
 basically
  calls the EJB) and stores it in a page-level scope, so
 the
  servlet no longer bothers storing this in any scope.
 But
  doesn't doing this break the separate logic from the
  view rule? I don't want to store it in the
 session-level
  scope as well as the list _can_ be updated frequently.
  Granted, the session-scope seems to be the ideal
 solution,
  though.
 
  What are your thoughts on this? I'd appreciate help on
 the
  matter, as I'm weeding out non-conforming
 implementations
  in my code. :)
 
  Thanks for your help in advance.
 
  =
 
 
  __
  Do you Yahoo!?
  Yahoo! SiteBuilder - Free, easy-to-use web site design
 software
  http://sitebuilder.yahoo.com
 
 

-
  To unsubscribe, e-mail:
 [EMAIL PROTECTED]
  For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 
 
 
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


=


__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]