Re: JSTL- el - nested beans from a map used in a form?

2003-07-03 Thread Sandeep Takhar
I don't think you have defined your taglib at the top
of the jsp.  Your html-el should have changed when you
look at the source..

sandeep
--- Rick Reumann [EMAIL PROTECTED] wrote:
 On Sat, 2003-06-28 at 13:51, Dan Tran wrote:
  see this link
 

http://www.strutskickstart.com/IndexedPropertiesandValidation.ppt
 
 Thanks Dan. I looked at the presentation above, but
 it's not helping me
 much. I probably do still need the indexed=true to
 make the properties
 indexed, but I still don't see how this is going to
 get them populated
 in the correct bean and loaded back into the map?
 Adding indexed=true
 doesn't seem to help.
 
  
  -Dan
  - Original Message - 
  From: Rick Reumann [EMAIL PROTECTED]
  To: Struts Users Mailing List
 [EMAIL PROTECTED]
  Sent: Saturday, June 28, 2003 9:35 AM
  Subject: JSTL- el - nested beans from a map used
 in a form?
  
  
   Ok this has me stumped...
   
   the down and dirty:
   
   formBean has HashMap called fooMap
   
   fooMap has keys that bring back beans of type
 BarBean
   
   BarBean has properties someCode , someDescrip 
   
   Now I want to iterate over this map and create
 the properties based on
   the properties in BarBean and be able to update
 this form which will
   then update the underlying BarBeans in the map.
   
   (Ignore the part that I know that's a hassle
 about the reset method and
   making sure Map exist there).
   
   
   c:forEach var=beanInMap
 items=${formBean.fooMap}
   
   someCode: html-el:text
 property=/br
   someDescrip:  html-el:text
 property=/br
   br
 
   /c:forEach
   
   
   the text will display fine in the form with:
   
   someCode: html-el:text name=beanInMap
 property=beanInMap.deptCode /
   
   but when the form submits all the bean property
 values are null ( in the
   reset if it matters for testing i'm just
 creating a few maps with empty
   BarBeans in the map).
   
   I'm stumped.. any help much appreciated.
   
   -- 
   Rick

   
   
  

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

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


__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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



JSTL- el - nested beans from a map used in a form?

2003-06-28 Thread Rick Reumann
Ok this has me stumped...

the down and dirty:

formBean has HashMap called fooMap

fooMap has keys that bring back beans of type BarBean

BarBean has properties someCode , someDescrip 

Now I want to iterate over this map and create the properties based on
the properties in BarBean and be able to update this form which will
then update the underlying BarBeans in the map.

(Ignore the part that I know that's a hassle about the reset method and
making sure Map exist there).


c:forEach var=beanInMap items=${formBean.fooMap}

someCode: html-el:text property=/br
someDescrip:  html-el:text property=/br
br
  
/c:forEach


the text will display fine in the form with:

someCode: html-el:text name=beanInMap property=beanInMap.deptCode /

but when the form submits all the bean property values are null ( in the
reset if it matters for testing i'm just creating a few maps with empty
BarBeans in the map).

I'm stumped.. any help much appreciated.

-- 
Rick
 


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



Re: JSTL- el - nested beans from a map used in a form?

2003-06-28 Thread Dan Tran
see this link
http://www.strutskickstart.com/IndexedPropertiesandValidation.ppt

-Dan
- Original Message - 
From: Rick Reumann [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Saturday, June 28, 2003 9:35 AM
Subject: JSTL- el - nested beans from a map used in a form?


 Ok this has me stumped...
 
 the down and dirty:
 
 formBean has HashMap called fooMap
 
 fooMap has keys that bring back beans of type BarBean
 
 BarBean has properties someCode , someDescrip 
 
 Now I want to iterate over this map and create the properties based on
 the properties in BarBean and be able to update this form which will
 then update the underlying BarBeans in the map.
 
 (Ignore the part that I know that's a hassle about the reset method and
 making sure Map exist there).
 
 
 c:forEach var=beanInMap items=${formBean.fooMap}
 
 someCode: html-el:text property=/br
 someDescrip:  html-el:text property=/br
 br
   
 /c:forEach
 
 
 the text will display fine in the form with:
 
 someCode: html-el:text name=beanInMap property=beanInMap.deptCode /
 
 but when the form submits all the bean property values are null ( in the
 reset if it matters for testing i'm just creating a few maps with empty
 BarBeans in the map).
 
 I'm stumped.. any help much appreciated.
 
 -- 
 Rick
  
 
 
 -
 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: JSTL- el - nested beans from a map used in a form?

2003-06-28 Thread Rick Reumann
On Sat, 2003-06-28 at 13:51, Dan Tran wrote:
 see this link
 http://www.strutskickstart.com/IndexedPropertiesandValidation.ppt

Thanks Dan. I looked at the presentation above, but it's not helping me
much. I probably do still need the indexed=true to make the properties
indexed, but I still don't see how this is going to get them populated
in the correct bean and loaded back into the map? Adding indexed=true
doesn't seem to help.

 
 -Dan
 - Original Message - 
 From: Rick Reumann [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Sent: Saturday, June 28, 2003 9:35 AM
 Subject: JSTL- el - nested beans from a map used in a form?
 
 
  Ok this has me stumped...
  
  the down and dirty:
  
  formBean has HashMap called fooMap
  
  fooMap has keys that bring back beans of type BarBean
  
  BarBean has properties someCode , someDescrip 
  
  Now I want to iterate over this map and create the properties based on
  the properties in BarBean and be able to update this form which will
  then update the underlying BarBeans in the map.
  
  (Ignore the part that I know that's a hassle about the reset method and
  making sure Map exist there).
  
  
  c:forEach var=beanInMap items=${formBean.fooMap}
  
  someCode: html-el:text property=/br
  someDescrip:  html-el:text property=/br
  br

  /c:forEach
  
  
  the text will display fine in the form with:
  
  someCode: html-el:text name=beanInMap property=beanInMap.deptCode /
  
  but when the form submits all the bean property values are null ( in the
  reset if it matters for testing i'm just creating a few maps with empty
  BarBeans in the map).
  
  I'm stumped.. any help much appreciated.
  
  -- 
  Rick
   
  
  
  -
  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]
 
 
 


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



Re: JSTL- el - nested beans from a map used in a form?

2003-06-28 Thread Jason Lea
Hi Rick,

Here are some ideas, I haven't tested them so they could be horribly 
wrong :)

The html-el:text tag are just like the html:text tag, but I can evaluate 
EL expressions.

What you want to generate is something like this:

someCode:  input type=text name=fooMap['aCode'].someCode 
value=aCodebr

because when this is submitted Struts will do something like:
formBean.getFooMap().get(aCode).setSomeCode(a new value)
So then looking at the html:text tag documentation we see for 'property':

Name of this input field, and the name of the corresponding bean 
property if value is not specified. The corresponding bean property (if 
any) must be of type String.

This means the value of 'property' will be the name of the text input 
field - this is the bit we want to become name=fooMap['aCode'].someCode.

The other importent part is the 'indexed' property:

Valid only inside of logic:iterate tag. If true then name of the html 
tag will be rendered as id[34].propertyName. Number in brackets will 
be generated for every iteration and taken from ancestor logic:iterate tag.

You are using JSTL and have not created a logic:iterate tag so the index 
isn't going to be generated for you.  You could switch to using 
logic:iterate and I think the tags figure out what to call themselves eg

html:form action=
logic:iterate id=beanInMap name=fooMap
someCode: html-el:text name=beanInMap 
property=deptCode indexed=true/br
/logic:iterate
/html:form

or use the nested:* tags, which would be something like:

nested:form action=
nested:iterate name=fooMap
someCode: nested:text property=deptCode /br
/nested:iterate
/html-el:form
If you want to use JSTL, you probably have to generate the property name 
yourself:

html:form action=
c:forEach var=beanInMap items=${formBean.fooMap}
someCode: html-el:text 
property=fooMap['${beanInMap.someCode}'].someCode /br
someDescrip:  html-el:text 
property=fooMap['${beanInMap.someDescrip}'].someDescrip /br
br
/c:forEach
/html:form



Rick Reumann wrote:
Ok this has me stumped...

the down and dirty:

formBean has HashMap called fooMap

fooMap has keys that bring back beans of type BarBean

BarBean has properties someCode , someDescrip 

Now I want to iterate over this map and create the properties based on
the properties in BarBean and be able to update this form which will
then update the underlying BarBeans in the map.
(Ignore the part that I know that's a hassle about the reset method and
making sure Map exist there).
c:forEach var=beanInMap items=${formBean.fooMap}

someCode: html-el:text property=/br
someDescrip:  html-el:text property=/br
br
  
/c:forEach

the text will display fine in the form with:

someCode: html-el:text name=beanInMap property=beanInMap.deptCode /

but when the form submits all the bean property values are null ( in the
reset if it matters for testing i'm just creating a few maps with empty
BarBeans in the map).
I'm stumped.. any help much appreciated.





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


Re: JSTL- el - nested beans from a map used in a form?

2003-06-28 Thread Rick Reumann
On Sat, 2003-06-28 at 19:00, Jason Lea wrote:
 
 Here are some ideas, I haven't tested them so they could be horribly 
 wrong :)
 
 The html-el:text tag are just like the html:text tag, but I can evaluate 
 EL expressions.
 
 What you want to generate is something like this:
 
 someCode:  input type=text name=fooMap['aCode'].someCode 
 value=aCodebr
 
 because when this is submitted Struts will do something like:
 formBean.getFooMap().get(aCode).setSomeCode(a new value)

Thanks Jason. I'll have to try some of this. The problem with the above
though is what do i substitute in for aCode that represents key. The
keys can be different obviously as the iterations take place.  

 
 So then looking at the html:text tag documentation we see for 'property':
 
 Name of this input field, and the name of the corresponding bean 
 property if value is not specified. The corresponding bean property (if 
 any) must be of type String.
 
 This means the value of 'property' will be the name of the text input 
 field - this is the bit we want to become name=fooMap['aCode'].someCode.
 
 The other importent part is the 'indexed' property:
 
 Valid only inside of logic:iterate tag.  

Actually this seemed to also work within the JSTL foreach loop.

 If true then name of the html 
 tag will be rendered as id[34].propertyName. Number in brackets will 
 be generated for every iteration and taken from ancestor logic:iterate tag.
 
 You are using JSTL and have not created a logic:iterate tag so the index 
 isn't going to be generated for you.  You could switch to using 
 logic:iterate and I think the tags figure out what to call themselves eg
 
 html:form action=
  logic:iterate id=beanInMap name=fooMap
  someCode: html-el:text name=beanInMap 
 property=deptCode indexed=true/br
  /logic:iterate
 /html:form

I tried the above but it complained that it couldn't find my map (fooMap
in the above example).

 
 or use the nested:* tags, which would be something like:
 
 nested:form action=
  nested:iterate name=fooMap
  someCode: nested:text property=deptCode /br
  /nested:iterate
 /html-el:form
 
 If you want to use JSTL, you probably have to generate the property name 
 yourself:
 
 html:form action=
  c:forEach var=beanInMap items=${formBean.fooMap}
  someCode: html-el:text 
 property=fooMap['${beanInMap.someCode}'].someCode /br
  someDescrip:  html-el:text 
 property=fooMap['${beanInMap.someDescrip}'].someDescrip /br
  br
  /c:forEach
 /html:form

With the above I end up with the error:

org.apache.jasper.JasperException: An error occurred while evaluating
custom action attribute property with value
departments['${beanInMap.deptCode}'].deptCode: Unable to find a value
for deptCode in object of class java.util.HashMap$Entry using
operator . (null)

the syntax looks like:

c:forEach var=beanInMap items=${employeeForm.departments}
  Code: 
html:text  property=departments['${beanInMap.deptCode}'].deptCode /
br
  Name:  
html:text  property=departments['${beanInMap.deptName}'].deptName /
br
br
/c:forEach 

I've tried all kinds of other combos also and still stumped.

Thanks for the help so far.

 
 Rick Reumann wrote:
  Ok this has me stumped...
  
  the down and dirty:
  
  formBean has HashMap called fooMap
  
  fooMap has keys that bring back beans of type BarBean
  
  BarBean has properties someCode , someDescrip 
  
  Now I want to iterate over this map and create the properties based on
  the properties in BarBean and be able to update this form which will
  then update the underlying BarBeans in the map.
  
  (Ignore the part that I know that's a hassle about the reset method and
  making sure Map exist there).
  
  
  c:forEach var=beanInMap items=${formBean.fooMap}
  
  someCode: html-el:text property=/br
  someDescrip:  html-el:text property=/br
  br

  /c:forEach
  
  
  the text will display fine in the form with:
  
  someCode: html-el:text name=beanInMap property=beanInMap.deptCode /
  
  but when the form submits all the bean property values are null ( in the
  reset if it matters for testing i'm just creating a few maps with empty
  BarBeans in the map).
  
  I'm stumped.. any help much appreciated.
  
 
 
 


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



Re: JSTL- el - nested beans from a map used in a form?

2003-06-28 Thread Jason Lea
Hi Rick,

Rick Reumann wrote:
On Sat, 2003-06-28 at 19:00, Jason Lea wrote:
 

Here are some ideas, I haven't tested them so they could be horribly 
wrong :)

The html-el:text tag are just like the html:text tag, but I can evaluate 
EL expressions.

What you want to generate is something like this:

someCode:  input type=text name=fooMap['aCode'].someCode 
value=aCodebr

because when this is submitted Struts will do something like:
formBean.getFooMap().get(aCode).setSomeCode(a new value)


Thanks Jason. I'll have to try some of this. The problem with the above
though is what do i substitute in for aCode that represents key. The
keys can be different obviously as the iterations take place.  


So then looking at the html:text tag documentation we see for 'property':

Name of this input field, and the name of the corresponding bean 
property if value is not specified. The corresponding bean property (if 
any) must be of type String.

This means the value of 'property' will be the name of the text input 
field - this is the bit we want to become name=fooMap['aCode'].someCode.

The other importent part is the 'indexed' property:

Valid only inside of logic:iterate tag.  


Actually this seemed to also work within the JSTL foreach loop.


If true then name of the html 
tag will be rendered as id[34].propertyName. Number in brackets will 
be generated for every iteration and taken from ancestor logic:iterate tag.

You are using JSTL and have not created a logic:iterate tag so the index 
isn't going to be generated for you.  You could switch to using 
logic:iterate and I think the tags figure out what to call themselves eg

html:form action=
logic:iterate id=beanInMap name=fooMap
someCode: html-el:text name=beanInMap 
property=deptCode indexed=true/br
/logic:iterate
/html:form


I tried the above but it complained that it couldn't find my map (fooMap
in the above example).
Are you using the html:form tag?  All of these tags should be inside one 
so they know what formBean to use.



or use the nested:* tags, which would be something like:

nested:form action=
nested:iterate name=fooMap
someCode: nested:text property=deptCode /br
/nested:iterate
/html-el:form
If you want to use JSTL, you probably have to generate the property name 
yourself:

html:form action=
c:forEach var=beanInMap items=${formBean.fooMap}
someCode: html-el:text 
property=fooMap['${beanInMap.someCode}'].someCode /br
someDescrip:  html-el:text 
property=fooMap['${beanInMap.someDescrip}'].someDescrip /br
br
/c:forEach
/html:form


With the above I end up with the error:

org.apache.jasper.JasperException: An error occurred while evaluating
custom action attribute property with value
departments['${beanInMap.deptCode}'].deptCode: Unable to find a value
for deptCode in object of class java.util.HashMap$Entry using
operator . (null)
Ahh, yes.  That now triggers something I read a while ago.  When JSTL 
gets something out of a map it will be of the type java.util.Map.Entry 
so perhaps try

c:forEach var=beanInMap items=${employeeForm.departments}
  Code:  html-el:text 
property=departments['${beanInMap.key}'].deptCode /
br
  Name:  html-el:text 
property=departments['${beanInMap.key}'].deptName /
br
br
/c:forEach

You will have to use the html-el:text to evaluate the ${beanInMap.key} 
 (at least I hope it tries to evaluate it that way).  If you use 
html:text then it will just treat it as text, essentially looking up 
the departments map with '${beanInMap.key}' instead of the actual key.


the syntax looks like:

c:forEach var=beanInMap items=${employeeForm.departments}
  Code: 
html:text  property=departments['${beanInMap.deptCode}'].deptCode /
br
  Name:  
html:text  property=departments['${beanInMap.deptName}'].deptName /
br
br
/c:forEach 

I've tried all kinds of other combos also and still stumped.

Thanks for the help so far.


Rick Reumann wrote:

Ok this has me stumped...

the down and dirty:

formBean has HashMap called fooMap

fooMap has keys that bring back beans of type BarBean

BarBean has properties someCode , someDescrip 

Now I want to iterate over this map and create the properties based on
the properties in BarBean and be able to update this form which will
then update the underlying BarBeans in the map.
(Ignore the part that I know that's a hassle about the reset method and
making sure Map exist there).
c:forEach var=beanInMap items=${formBean.fooMap}

   someCode: html-el:text property=/br
   someDescrip:  html-el:text property=/br
   br
 
/c:forEach

the text will display fine in the form with:

someCode: html-el:text name=beanInMap property=beanInMap.deptCode /

but when the form submits all the bean property values are null ( in the
reset if it matters for testing i'm just creating a few maps with empty
BarBeans in the map).
I'm stumped.. any help much appreciated.