RE: form properties and html:options with collection

2003-10-13 Thread Robert Taylor
Make sure you aren't redirecting the request, but rather forwarding.
If you redirect (which I suspect your are doing) and the form is 
in the request scope, then you will lose all data set in the form.


robert


 -Original Message-
 From: Sonam Belbase [mailto:[EMAIL PROTECTED]
 Sent: Monday, October 13, 2003 12:49 PM
 To: Struts Users Mailing List
 Subject: form properties and html:options  with collection
 
 
 Hi,
 
 What is the best way of setting a Java Collection which holds Java
 Objects
 as a property of the form, and retrieving the Object and it's properties
 
 on a JSP?
 
 I've tried it as such but have not been successful:
 
 In my action, I have created a list called myList which holds objects
 of type myClass.
 myClass has an attribute name and a getter method getName. In the
 action I set the list
 as a property of a DynaValidatorForm:
 
 form.set(availableNamesList, myList );
 
 In struts-config:
  form-bean name=newNameForm
 type=org.apache.struts.validator.DynaValidatorForm
   form-property name=selectedName type=java.lang.String/
   form-property name=availableNamesList type=java.util.List/
 /form-bean
 
 In the JSP:
  html:form  action=/addNewName 
 html:select property=selectedName size=5  multiple=false
 
   html:options  collection=availableNamesList
 property=name  /
  /html:select
 /html:form
 
 This results in the error: [ServletException in:/jsp/newName.jsp] Cannot
 find bean under name availableNamesList'
 
 If I put the list in session scope in my action with:
 request_.getSession().setAttribute(availableNamesList,  myList);
 this works fine.
 
 I'd like to avoid having to put the list in session scope and I don't
 understand why just setting the list
 as a property of the form doesn't work.
 
 Any help/guidance would be appreciated.
 
 Thanks,
 SB
 
 
 
 --
 NOTICE: If received in error, please destroy and notify sender.  Sender
 does not waive confidentiality or privilege, and use is prohibited.
 
 
 
 -
 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]



Re: form properties and html:options with collection

2003-10-13 Thread Sonam Belbase

Robert,

In my action, on success I forward the request to a tiles definition called
content.addNewName, which in return calls another definition. Could the
data be lost because of this?

action   path=/journalSetType
type=com.msdw.libra.ae.actions.selectNewName
   name=newNameForm
   scope=request
   forward name=success  path=content.addNewName/
/action


-SB

Robert Taylor wrote:

 Make sure you aren't redirecting the request, but rather forwarding.
 If you redirect (which I suspect your are doing) and the form is
 in the request scope, then you will lose all data set in the form.

 robert

  -Original Message-
  From: Sonam Belbase [mailto:[EMAIL PROTECTED]
  Sent: Monday, October 13, 2003 12:49 PM
  To: Struts Users Mailing List
  Subject: form properties and html:options  with collection
 
 
  Hi,
 
  What is the best way of setting a Java Collection which holds Java
  Objects
  as a property of the form, and retrieving the Object and it's properties
 
  on a JSP?
 
  I've tried it as such but have not been successful:
 
  In my action, I have created a list called myList which holds objects
  of type myClass.
  myClass has an attribute name and a getter method getName. In the
  action I set the list
  as a property of a DynaValidatorForm:
 
  form.set(availableNamesList, myList );
 
  In struts-config:
   form-bean name=newNameForm
  type=org.apache.struts.validator.DynaValidatorForm
form-property name=selectedName type=java.lang.String/
form-property name=availableNamesList type=java.util.List/
  /form-bean
 
  In the JSP:
   html:form  action=/addNewName 
  html:select property=selectedName size=5  multiple=false
 
html:options  collection=availableNamesList
  property=name  /
   /html:select
  /html:form
 
  This results in the error: [ServletException in:/jsp/newName.jsp] Cannot
  find bean under name availableNamesList'
 
  If I put the list in session scope in my action with:
  request_.getSession().setAttribute(availableNamesList,  myList);
  this works fine.
 
  I'd like to avoid having to put the list in session scope and I don't
  understand why just setting the list
  as a property of the form doesn't work.
 
  Any help/guidance would be appreciated.
 
  Thanks,
  SB
 
 
 
  --
  NOTICE: If received in error, please destroy and notify sender.  Sender
  does not waive confidentiality or privilege, and use is prohibited.
 
 
 
  -
  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]

--
NOTICE: If received in error, please destroy and notify sender.  Sender does
not waive confidentiality or privilege, and use is prohibited.



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



RE: form properties and html:options with collection

2003-10-13 Thread Robert Taylor
If you continue to forward, it shouldn't. But if you redirect anywhere
in the chain, then that data is gone.

Double check your attribute name spelling in your code and config file.
That's tripped me up before.

robert

 -Original Message-
 From: Sonam Belbase [mailto:[EMAIL PROTECTED]
 Sent: Monday, October 13, 2003 1:46 PM
 To: Struts Users Mailing List
 Subject: Re: form properties and html:options  with collection



 Robert,

 In my action, on success I forward the request to a tiles
 definition called
 content.addNewName, which in return calls another definition. Could the
 data be lost because of this?

 action   path=/journalSetType
 type=com.msdw.libra.ae.actions.selectNewName
name=newNameForm
scope=request
forward name=success  path=content.addNewName/
 /action


 -SB

 Robert Taylor wrote:

  Make sure you aren't redirecting the request, but rather forwarding.
  If you redirect (which I suspect your are doing) and the form is
  in the request scope, then you will lose all data set in the form.
 
  robert
 
   -Original Message-
   From: Sonam Belbase [mailto:[EMAIL PROTECTED]
   Sent: Monday, October 13, 2003 12:49 PM
   To: Struts Users Mailing List
   Subject: form properties and html:options  with collection
  
  
   Hi,
  
   What is the best way of setting a Java Collection which holds Java
   Objects
   as a property of the form, and retrieving the Object and it's
 properties
  
   on a JSP?
  
   I've tried it as such but have not been successful:
  
   In my action, I have created a list called myList which
 holds objects
   of type myClass.
   myClass has an attribute name and a getter method
 getName. In the
   action I set the list
   as a property of a DynaValidatorForm:
  
   form.set(availableNamesList, myList );
  
   In struts-config:
form-bean name=newNameForm
   type=org.apache.struts.validator.DynaValidatorForm
 form-property name=selectedName type=java.lang.String/
 form-property name=availableNamesList type=java.util.List/
   /form-bean
  
   In the JSP:
html:form  action=/addNewName 
   html:select property=selectedName size=5
 multiple=false
  
 html:options  collection=availableNamesList
   property=name  /
/html:select
   /html:form
  
   This results in the error: [ServletException
 in:/jsp/newName.jsp] Cannot
   find bean under name availableNamesList'
  
   If I put the list in session scope in my action with:
   request_.getSession().setAttribute(availableNamesList,  myList);
   this works fine.
  
   I'd like to avoid having to put the list in session scope and I don't
   understand why just setting the list
   as a property of the form doesn't work.
  
   Any help/guidance would be appreciated.
  
   Thanks,
   SB
  
  
  
   --
   NOTICE: If received in error, please destroy and notify
 sender.  Sender
   does not waive confidentiality or privilege, and use is prohibited.
  
  
  
   -
   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]

 --
 NOTICE: If received in error, please destroy and notify sender.
 Sender does
 not waive confidentiality or privilege, and use is prohibited.



 -
 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]



Re: form properties and html:options with collection

2003-10-13 Thread Sonam Belbase
It's working now.

I added a bean:define to define the bean which represents my collection of
objects. I believe this is required in order to find the bean specified by the
value
of the collection attribute in the html:options collection tag.

Thanks for your help Robert.

SB

Robert Taylor wrote:

 If you continue to forward, it shouldn't. But if you redirect anywhere
 in the chain, then that data is gone.

 Double check your attribute name spelling in your code and config file.
 That's tripped me up before.

 robert

  -Original Message-
  From: Sonam Belbase [mailto:[EMAIL PROTECTED]
  Sent: Monday, October 13, 2003 1:46 PM
  To: Struts Users Mailing List
  Subject: Re: form properties and html:options  with collection
 
 
 
  Robert,
 
  In my action, on success I forward the request to a tiles
  definition called
  content.addNewName, which in return calls another definition. Could the
  data be lost because of this?
 
  action   path=/journalSetType
  type=com.msdw.libra.ae.actions.selectNewName
 name=newNameForm
 scope=request
 forward name=success  path=content.addNewName/
  /action
 
 
  -SB
 
  Robert Taylor wrote:
 
   Make sure you aren't redirecting the request, but rather forwarding.
   If you redirect (which I suspect your are doing) and the form is
   in the request scope, then you will lose all data set in the form.
  
   robert
  
-Original Message-
From: Sonam Belbase [mailto:[EMAIL PROTECTED]
Sent: Monday, October 13, 2003 12:49 PM
To: Struts Users Mailing List
Subject: form properties and html:options  with collection
   
   
Hi,
   
What is the best way of setting a Java Collection which holds Java
Objects
as a property of the form, and retrieving the Object and it's
  properties
   
on a JSP?
   
I've tried it as such but have not been successful:
   
In my action, I have created a list called myList which
  holds objects
of type myClass.
myClass has an attribute name and a getter method
  getName. In the
action I set the list
as a property of a DynaValidatorForm:
   
form.set(availableNamesList, myList );
   
In struts-config:
 form-bean name=newNameForm
type=org.apache.struts.validator.DynaValidatorForm
  form-property name=selectedName type=java.lang.String/
  form-property name=availableNamesList type=java.util.List/
/form-bean
   
In the JSP:
 html:form  action=/addNewName 
html:select property=selectedName size=5
  multiple=false
   
  html:options  collection=availableNamesList
property=name  /
 /html:select
/html:form
   
This results in the error: [ServletException
  in:/jsp/newName.jsp] Cannot
find bean under name availableNamesList'
   
If I put the list in session scope in my action with:
request_.getSession().setAttribute(availableNamesList,  myList);
this works fine.
   
I'd like to avoid having to put the list in session scope and I don't
understand why just setting the list
as a property of the form doesn't work.
   
Any help/guidance would be appreciated.
   
Thanks,
SB
   
   
   
--
NOTICE: If received in error, please destroy and notify
  sender.  Sender
does not waive confidentiality or privilege, and use is prohibited.
   
   
   
-
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]
 
  --
  NOTICE: If received in error, please destroy and notify sender.
  Sender does
  not waive confidentiality or privilege, and use is prohibited.
 
 
 
  -
  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]

--
NOTICE: If received in error, please destroy and notify sender.  Sender does not
waive confidentiality or privilege, and use is prohibited.



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



RE: form properties and html:options with collection

2003-10-13 Thread Robert Taylor
Good. I'm glad you got it working.

I tend to use the html:optionsCollection .../ and populate my collection
with LabelValue beans. It keeps things uncomplicated and simple.

I end up with code like this in my .jsp:

html:select property=myProperty
html:optionsCollection name=myOptions label=label value=value/
/html:select

robert

 -Original Message-
 From: Sonam Belbase [mailto:[EMAIL PROTECTED]
 Sent: Monday, October 13, 2003 2:38 PM
 To: Struts Users Mailing List
 Subject: Re: form properties and html:options  with collection


 It's working now.

 I added a bean:define to define the bean which represents my
 collection of
 objects. I believe this is required in order to find the bean
 specified by the
 value
 of the collection attribute in the html:options collection tag.

 Thanks for your help Robert.

 SB

 Robert Taylor wrote:

  If you continue to forward, it shouldn't. But if you redirect anywhere
  in the chain, then that data is gone.
 
  Double check your attribute name spelling in your code and config file.
  That's tripped me up before.
 
  robert
 
   -Original Message-
   From: Sonam Belbase [mailto:[EMAIL PROTECTED]
   Sent: Monday, October 13, 2003 1:46 PM
   To: Struts Users Mailing List
   Subject: Re: form properties and html:options  with collection
  
  
  
   Robert,
  
   In my action, on success I forward the request to a tiles
   definition called
   content.addNewName, which in return calls another definition.
 Could the
   data be lost because of this?
  
   action   path=/journalSetType
   type=com.msdw.libra.ae.actions.selectNewName
  name=newNameForm
  scope=request
  forward name=success  path=content.addNewName/
   /action
  
  
   -SB
  
   Robert Taylor wrote:
  
Make sure you aren't redirecting the request, but rather forwarding.
If you redirect (which I suspect your are doing) and the form is
in the request scope, then you will lose all data set in the form.
   
robert
   
 -Original Message-
 From: Sonam Belbase [mailto:[EMAIL PROTECTED]
 Sent: Monday, October 13, 2003 12:49 PM
 To: Struts Users Mailing List
 Subject: form properties and html:options  with collection


 Hi,

 What is the best way of setting a Java Collection which holds Java
 Objects
 as a property of the form, and retrieving the Object and it's
   properties

 on a JSP?

 I've tried it as such but have not been successful:

 In my action, I have created a list called myList which
   holds objects
 of type myClass.
 myClass has an attribute name and a getter method
   getName. In the
 action I set the list
 as a property of a DynaValidatorForm:

 form.set(availableNamesList, myList );

 In struts-config:
  form-bean name=newNameForm
 type=org.apache.struts.validator.DynaValidatorForm
   form-property name=selectedName type=java.lang.String/
   form-property name=availableNamesList
 type=java.util.List/
 /form-bean

 In the JSP:
  html:form  action=/addNewName 
 html:select property=selectedName size=5
   multiple=false

   html:options  collection=availableNamesList
 property=name  /
  /html:select
 /html:form

 This results in the error: [ServletException
   in:/jsp/newName.jsp] Cannot
 find bean under name availableNamesList'

 If I put the list in session scope in my action with:
 request_.getSession().setAttribute(availableNamesList,  myList);
 this works fine.

 I'd like to avoid having to put the list in session scope
 and I don't
 understand why just setting the list
 as a property of the form doesn't work.

 Any help/guidance would be appreciated.

 Thanks,
 SB



 --
 NOTICE: If received in error, please destroy and notify
   sender.  Sender
 does not waive confidentiality or privilege, and use is
 prohibited.




 -
 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]
  
   --
   NOTICE: If received in error, please destroy and notify sender.
   Sender does
   not waive confidentiality or privilege, and use is prohibited.
  
  
  
   -
   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]

 --
 NOTICE: If received in error, please destroy and notify

RE: form properties and html:options with collection

2003-10-13 Thread Kris Schneider
IIRC, html:optionsCollection plays even nicer with LabelValue because of the
defaults for the label and value attributes. In other words, I think
Robert's example is equivalent to:

html:select property=myProperty
  html:optionsCollection name=myOptions/
/html:select

Quoting Robert Taylor [EMAIL PROTECTED]:

 Good. I'm glad you got it working.
 
 I tend to use the html:optionsCollection .../ and populate my collection
 with LabelValue beans. It keeps things uncomplicated and simple.
 
 I end up with code like this in my .jsp:
 
 html:select property=myProperty
 html:optionsCollection name=myOptions label=label value=value/
 /html:select
 
 robert
 
  -Original Message-
  From: Sonam Belbase [mailto:[EMAIL PROTECTED]
  Sent: Monday, October 13, 2003 2:38 PM
  To: Struts Users Mailing List
  Subject: Re: form properties and html:options  with collection
 
 
  It's working now.
 
  I added a bean:define to define the bean which represents my
  collection of
  objects. I believe this is required in order to find the bean
  specified by the
  value
  of the collection attribute in the html:options collection tag.
 
  Thanks for your help Robert.
 
  SB
 
  Robert Taylor wrote:
 
   If you continue to forward, it shouldn't. But if you redirect anywhere
   in the chain, then that data is gone.
  
   Double check your attribute name spelling in your code and config file.
   That's tripped me up before.
  
   robert
  
-Original Message-
From: Sonam Belbase [mailto:[EMAIL PROTECTED]
Sent: Monday, October 13, 2003 1:46 PM
To: Struts Users Mailing List
Subject: Re: form properties and html:options  with collection
   
   
   
Robert,
   
In my action, on success I forward the request to a tiles
definition called
content.addNewName, which in return calls another definition.
  Could the
data be lost because of this?
   
action   path=/journalSetType
type=com.msdw.libra.ae.actions.selectNewName
   name=newNameForm
   scope=request
   forward name=success  path=content.addNewName/
/action
   
   
-SB
   
Robert Taylor wrote:
   
 Make sure you aren't redirecting the request, but rather
 forwarding.
 If you redirect (which I suspect your are doing) and the form is
 in the request scope, then you will lose all data set in the form.

 robert

  -Original Message-
  From: Sonam Belbase [mailto:[EMAIL PROTECTED]
  Sent: Monday, October 13, 2003 12:49 PM
  To: Struts Users Mailing List
  Subject: form properties and html:options  with collection
 
 
  Hi,
 
  What is the best way of setting a Java Collection which holds
 Java
  Objects
  as a property of the form, and retrieving the Object and it's
properties
 
  on a JSP?
 
  I've tried it as such but have not been successful:
 
  In my action, I have created a list called myList which
holds objects
  of type myClass.
  myClass has an attribute name and a getter method
getName. In the
  action I set the list
  as a property of a DynaValidatorForm:
 
  form.set(availableNamesList, myList );
 
  In struts-config:
   form-bean name=newNameForm
  type=org.apache.struts.validator.DynaValidatorForm
form-property name=selectedName
 type=java.lang.String/
form-property name=availableNamesList
  type=java.util.List/
  /form-bean
 
  In the JSP:
   html:form  action=/addNewName 
  html:select property=selectedName size=5
multiple=false
 
html:options  collection=availableNamesList
  property=name  /
   /html:select
  /html:form
 
  This results in the error: [ServletException
in:/jsp/newName.jsp] Cannot
  find bean under name availableNamesList'
 
  If I put the list in session scope in my action with:
  request_.getSession().setAttribute(availableNamesList, 
 myList);
  this works fine.
 
  I'd like to avoid having to put the list in session scope
  and I don't
  understand why just setting the list
  as a property of the form doesn't work.
 
  Any help/guidance would be appreciated.
 
  Thanks,
  SB

-- 
Kris Schneider mailto:[EMAIL PROTECTED]
D.O.Tech   http://www.dotech.com/

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