|
From: <jue...@we...> - 2003-07-07 17:28:34
|
Hi Rhandy, For multiple form objects, you could use custom objects that you bind = parameters onto via BindUtils and put in the session as some custom = attribute. I consider it preferable to use a different strategy though: = Not a map, but a custom root object that contains the form objects as = bean properties, like a MyRootObject class with getMyFirstObject and = getMySecondFormObject methods. It's easy to bind to the contained = objects via nested properties, e.g. "myFirstFormObject.myProperty" and = "mySecondFormObject.myOtherProperty". Regarding a list of objects, it's probably indeed the best way to parse = respective request parameters manually, in a custom onBindAndValidate = implementation. Especially if you want to add and remove elements, I = can't think of a different way. We could try to bind to an existing list = of objects, but it's not too obvious how to go about this (via an index? = what if it's a Set, Collection, or Map), so we don't support this yet. = If you have an idea how to achieve this, please let me know :-) Regards, Juergen -----Original Message----- From: Rhandy Lado [mailto:rh...@do...] Sent: Monday, July 07, 2003 10:49 AM To: j=FCrgen h=F6ller [werk3AT] Subject: [Springframework] Request Binding Hi Jurgen, I've been using the FormController classes in a few webpages now and found that I sometimes need to work with more than one form object. How do I return more than two objects and bind each of them in the webpage? Should I put each object in a Map and then return the map? If so, how do you access the map using the <i21:bind> tags? Also, I have a list defined in my form object. Do the <i21:bind> tags support binding data to a list? If not, do you have any suggestions on how I may go about this? (I was initially thinking of passing back a series of request parameters and manually adding these values to the form object list but I have a feeling there is a more elegant way of doing this.) Thanks in advance, Rhandy |
|
From: JP P. <jp....@ti...> - 2003-07-07 19:56:01
|
Hi Juergen,
I'm not sure that my answer is related to this, maybe.
I had to handle with multiselect listboxes. The issue is the same with
checkboxes. The form returns many values for the same identifier. I just
take a look at the code. It is already the same as in the original
framework and don't handle this situation.
I had modified in my own i21 version the
com.interface21.web.util.WebUtils class the method
getParametersStartingWith(ServletRequest as follows:
----------------------
public static Properties getParametersStartingWith(ServletRequest
request, String base) {
Enumeration enum =3D request.getParameterNames();
Properties props =3D new Properties();
=09
if (base =3D=3D null)
base =3D "";
while (enum !=3D null && enum.hasMoreElements()) {
String paramName =3D (String) enum.nextElement();
if (base =3D=3D null || "".equals(base) ||
paramName.startsWith(base)) {
String val =3D request.getParameter(paramName);
// JPP My add
if (request.getParameterValues(paramName).length > 1) {
val =3D
StringUtils.arrayToDelimitedString(request.getParameterValues(paramName)
, ","); =09
}
// JPP End My add
String unprefixed =3D
paramName.substring(base.length());
props.setProperty(unprefixed, val);
}
}
return props;
} // getParameterValuesStartingWith
--------------
By the way, I checked what others change I made and discover also I
added in com.interface21.beans.propertyeditors.
StringArrayPropertyEditor the getAsText method:
public String getAsText() {
String[] array =3D (String[])this.getValue();
return StringUtils.arrayToDelimitedString(array,",");
}
Even if it's not related with Rhandy's question, can I or you integrate
these changes?
Regards,
Jean-Pierre=20
-----Message d'origine-----
De=A0: spr...@li...
[mailto:spr...@li...] De la
part de j=FCrgen h=F6ller [werk3AT]
Envoy=E9=A0: lundi 7 juillet 2003 19:26
=C0=A0: Rhandy Lado
Cc=A0: spr...@li...
Objet=A0: [Springframework-developer] RE: [Springframework] Request
Binding
Hi Rhandy,
For multiple form objects, you could use custom objects that you bind
parameters onto via BindUtils and put in the session as some custom
attribute. I consider it preferable to use a different strategy though:
Not a map, but a custom root object that contains the form objects as
bean properties, like a MyRootObject class with getMyFirstObject and
getMySecondFormObject methods. It's easy to bind to the contained
objects via nested properties, e.g. "myFirstFormObject.myProperty" and
"mySecondFormObject.myOtherProperty".
Regarding a list of objects, it's probably indeed the best way to parse
respective request parameters manually, in a custom onBindAndValidate
implementation. Especially if you want to add and remove elements, I
can't think of a different way. We could try to bind to an existing list
of objects, but it's not too obvious how to go about this (via an index?
what if it's a Set, Collection, or Map), so we don't support this yet.
If you have an idea how to achieve this, please let me know :-)
Regards,
Juergen
-----Original Message-----
From: Rhandy Lado [mailto:rh...@do...]
Sent: Monday, July 07, 2003 10:49 AM
To: j=FCrgen h=F6ller [werk3AT]
Subject: [Springframework] Request Binding
Hi Jurgen,
I've been using the FormController classes in a few webpages now and
found that I sometimes need to work with more than one form object. How
do I return more than two objects and bind each of them in the webpage?
Should I put each object in a Map and then return the map? If so, how do
you access the map using the <i21:bind> tags?
Also, I have a list defined in my form object. Do the <i21:bind> tags
support binding data to a list? If not, do you have any suggestions on
how I may go about this? (I was initially thinking of passing back a
series of request parameters and manually adding these values to the
form object list but I have a feeling there is a more elegant way of
doing this.)
Thanks in advance,
Rhandy
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|
|
From: JP P. <jp....@ti...> - 2003-07-07 20:41:10
|
In my case, there is no add or delete, only selection in well known
number of elements (used for instantiation of the array). I didn't try
with a list but the conversion is perhaps made internally. At least with
arrays, the two minor changes I proposed work as I use them. If lists
work also it will no care about the number of elements.
Jean-Pierre
-----Message d'origine-----
De=A0: spr...@li...
[mailto:spr...@li...] De la
part de JP Pawlak
Envoy=E9=A0: lundi 7 juillet 2003 21:55
=C0=A0: 'j=FCrgen h=F6ller [werk3AT]'; 'Rhandy Lado'
Cc=A0: spr...@li...
Objet=A0: RE : [Springframework-developer] RE: [Springframework] Request
Binding
Hi Juergen,
I'm not sure that my answer is related to this, maybe.
I had to handle with multiselect listboxes. The issue is the same with
checkboxes. The form returns many values for the same identifier. I just
take a look at the code. It is already the same as in the original
framework and don't handle this situation.
I had modified in my own i21 version the
com.interface21.web.util.WebUtils class the method
getParametersStartingWith(ServletRequest as follows:
----------------------
public static Properties getParametersStartingWith(ServletRequest
request, String base) {
Enumeration enum =3D request.getParameterNames();
Properties props =3D new Properties();
=09
if (base =3D=3D null)
base =3D "";
while (enum !=3D null && enum.hasMoreElements()) {
String paramName =3D (String) enum.nextElement();
if (base =3D=3D null || "".equals(base) ||
paramName.startsWith(base)) {
String val =3D request.getParameter(paramName);
// JPP My add
if (request.getParameterValues(paramName).length > 1) {
val =3D
StringUtils.arrayToDelimitedString(request.getParameterValues(paramName)
, ","); =09
}
// JPP End My add
String unprefixed =3D
paramName.substring(base.length());
props.setProperty(unprefixed, val);
}
}
return props;
} // getParameterValuesStartingWith
--------------
By the way, I checked what others change I made and discover also I
added in com.interface21.beans.propertyeditors.
StringArrayPropertyEditor the getAsText method:
public String getAsText() {
String[] array =3D (String[])this.getValue();
return StringUtils.arrayToDelimitedString(array,",");
}
Even if it's not related with Rhandy's question, can I or you integrate
these changes?
Regards,
Jean-Pierre=20
-----Message d'origine-----
De=A0: spr...@li...
[mailto:spr...@li...] De la
part de j=FCrgen h=F6ller [werk3AT]
Envoy=E9=A0: lundi 7 juillet 2003 19:26
=C0=A0: Rhandy Lado
Cc=A0: spr...@li...
Objet=A0: [Springframework-developer] RE: [Springframework] Request
Binding
Hi Rhandy,
For multiple form objects, you could use custom objects that you bind
parameters onto via BindUtils and put in the session as some custom
attribute. I consider it preferable to use a different strategy though:
Not a map, but a custom root object that contains the form objects as
bean properties, like a MyRootObject class with getMyFirstObject and
getMySecondFormObject methods. It's easy to bind to the contained
objects via nested properties, e.g. "myFirstFormObject.myProperty" and
"mySecondFormObject.myOtherProperty".
Regarding a list of objects, it's probably indeed the best way to parse
respective request parameters manually, in a custom onBindAndValidate
implementation. Especially if you want to add and remove elements, I
can't think of a different way. We could try to bind to an existing list
of objects, but it's not too obvious how to go about this (via an index?
what if it's a Set, Collection, or Map), so we don't support this yet.
If you have an idea how to achieve this, please let me know :-)
Regards,
Juergen
-----Original Message-----
From: Rhandy Lado [mailto:rh...@do...]
Sent: Monday, July 07, 2003 10:49 AM
To: j=FCrgen h=F6ller [werk3AT]
Subject: [Springframework] Request Binding
Hi Jurgen,
I've been using the FormController classes in a few webpages now and
found that I sometimes need to work with more than one form object. How
do I return more than two objects and bind each of them in the webpage?
Should I put each object in a Map and then return the map? If so, how do
you access the map using the <i21:bind> tags?
Also, I have a list defined in my form object. Do the <i21:bind> tags
support binding data to a list? If not, do you have any suggestions on
how I may go about this? (I was initially thinking of passing back a
series of request parameters and manually adding these values to the
form object list but I have a feeling there is a more elegant way of
doing this.)
Thanks in advance,
Rhandy
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|
|
From: JP P. <jp....@ti...> - 2003-07-08 06:45:13
|
Hello Juergen and others,
In a final touch, I consider this current lack (arrays, lists and maps
request mappings) as very important. It is unconceivable a Web Framework
to not handle this. Otherwise it cut information sent by standard HTML
form elements. We should take time to provide a good general solution
and not quickly provide somewhat before a release. On the other hand,
it's not an each day need.
In others words, 0.9.1 can be released without this, but not 1.0.
So, we will have some time to cleanly implement this. For my needs, I
can continue to hack the framework until a more general solution is
found.
Whatever the solution we will provide, I don't see how it could work
without my change requests. As they are very basic and certainly we
cannot go away from them. It's a starting point.
Regards,
Jean-Pierre
-----Message d'origine-----
De=A0: spr...@li...
[mailto:spr...@li...] De la
part de JP Pawlak
Envoy=E9=A0: lundi 7 juillet 2003 22:41
=C0=A0: 'JP Pawlak'; 'j=FCrgen h=F6ller [werk3AT]'; 'Rhandy Lado'
Cc=A0: spr...@li...
Objet=A0: RE : RE : [Springframework-developer] RE: [Springframework]
Request Binding
In my case, there is no add or delete, only selection in well known
number of elements (used for instantiation of the array). I didn't try
with a list but the conversion is perhaps made internally. At least with
arrays, the two minor changes I proposed work as I use them. If lists
work also it will no care about the number of elements.
Jean-Pierre
-----Message d'origine-----
De=A0: spr...@li...
[mailto:spr...@li...] De la
part de JP Pawlak
Envoy=E9=A0: lundi 7 juillet 2003 21:55
=C0=A0: 'j=FCrgen h=F6ller [werk3AT]'; 'Rhandy Lado'
Cc=A0: spr...@li...
Objet=A0: RE : [Springframework-developer] RE: [Springframework] Request
Binding
Hi Juergen,
I'm not sure that my answer is related to this, maybe.
I had to handle with multiselect listboxes. The issue is the same with
checkboxes. The form returns many values for the same identifier. I just
take a look at the code. It is already the same as in the original
framework and don't handle this situation.
I had modified in my own i21 version the
com.interface21.web.util.WebUtils class the method
getParametersStartingWith(ServletRequest as follows:
----------------------
public static Properties getParametersStartingWith(ServletRequest
request, String base) {
Enumeration enum =3D request.getParameterNames();
Properties props =3D new Properties();
=09
if (base =3D=3D null)
base =3D "";
while (enum !=3D null && enum.hasMoreElements()) {
String paramName =3D (String) enum.nextElement();
if (base =3D=3D null || "".equals(base) ||
paramName.startsWith(base)) {
String val =3D request.getParameter(paramName);
// JPP My add
if (request.getParameterValues(paramName).length > 1) {
val =3D
StringUtils.arrayToDelimitedString(request.getParameterValues(paramName)
, ","); =09
}
// JPP End My add
String unprefixed =3D
paramName.substring(base.length());
props.setProperty(unprefixed, val);
}
}
return props;
} // getParameterValuesStartingWith
--------------
By the way, I checked what others change I made and discover also I
added in com.interface21.beans.propertyeditors.
StringArrayPropertyEditor the getAsText method:
public String getAsText() {
String[] array =3D (String[])this.getValue();
return StringUtils.arrayToDelimitedString(array,",");
}
Even if it's not related with Rhandy's question, can I or you integrate
these changes?
Regards,
Jean-Pierre=20
-----Message d'origine-----
De=A0: spr...@li...
[mailto:spr...@li...] De la
part de j=FCrgen h=F6ller [werk3AT]
Envoy=E9=A0: lundi 7 juillet 2003 19:26
=C0=A0: Rhandy Lado
Cc=A0: spr...@li...
Objet=A0: [Springframework-developer] RE: [Springframework] Request
Binding
Hi Rhandy,
For multiple form objects, you could use custom objects that you bind
parameters onto via BindUtils and put in the session as some custom
attribute. I consider it preferable to use a different strategy though:
Not a map, but a custom root object that contains the form objects as
bean properties, like a MyRootObject class with getMyFirstObject and
getMySecondFormObject methods. It's easy to bind to the contained
objects via nested properties, e.g. "myFirstFormObject.myProperty" and
"mySecondFormObject.myOtherProperty".
Regarding a list of objects, it's probably indeed the best way to parse
respective request parameters manually, in a custom onBindAndValidate
implementation. Especially if you want to add and remove elements, I
can't think of a different way. We could try to bind to an existing list
of objects, but it's not too obvious how to go about this (via an index?
what if it's a Set, Collection, or Map), so we don't support this yet.
If you have an idea how to achieve this, please let me know :-)
Regards,
Juergen
-----Original Message-----
From: Rhandy Lado [mailto:rh...@do...]
Sent: Monday, July 07, 2003 10:49 AM
To: j=FCrgen h=F6ller [werk3AT]
Subject: [Springframework] Request Binding
Hi Jurgen,
I've been using the FormController classes in a few webpages now and
found that I sometimes need to work with more than one form object. How
do I return more than two objects and bind each of them in the webpage?
Should I put each object in a Map and then return the map? If so, how do
you access the map using the <i21:bind> tags?
Also, I have a list defined in my form object. Do the <i21:bind> tags
support binding data to a list? If not, do you have any suggestions on
how I may go about this? (I was initially thinking of passing back a
series of request parameters and manually adding these values to the
form object list but I have a feeling there is a more elegant way of
doing this.)
Thanks in advance,
Rhandy
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|
|
From: William G. T. Jr. <wg...@ru...> - 2003-07-07 20:28:01
|
jürgen höller [werk3AT] wrote: > Hi Rhandy, > > For multiple form objects, you could use custom objects that you bind parameters onto via BindUtils and put in the session as some custom attribute. I consider it preferable to use a different strategy though: Not a map, but a custom root object that contains the form objects as bean properties, like a MyRootObject class with getMyFirstObject and getMySecondFormObject methods. It's easy to bind to the contained objects via nested properties, e.g. "myFirstFormObject.myProperty" and "mySecondFormObject.myOtherProperty". > > Regarding a list of objects, it's probably indeed the best way to parse respective request parameters manually, in a custom onBindAndValidate implementation. Especially if you want to add and remove elements, I can't think of a different way. We could try to bind to an existing list of objects, but it's not too obvious how to go about this (via an index? what if it's a Set, Collection, or Map), so we don't support this yet. If you have an idea how to achieve this, please let me know :-) There might be something we could borrow from the Japple framework. Don't know if this the most elegant solution, but it works. The Japple framework supports something like this for a Collection of objects by maintaining an internal "sequence" for each object and a hidden "queryString" which is used to provide hints to the binding mechanism. http://www.japple.org/tutorial/complex_objects.html Bill > > Regards, > Juergen > > > -----Original Message----- > From: Rhandy Lado [mailto:rh...@do...] > Sent: Monday, July 07, 2003 10:49 AM > To: jürgen höller [werk3AT] > Subject: [Springframework] Request Binding > > > Hi Jurgen, > > I've been using the FormController classes in a few webpages now and > found that I sometimes need to work with more than one form object. How > do I return more than two objects and bind each of them in the webpage? > Should I put each object in a Map and then return the map? If so, how do > you access the map using the <i21:bind> tags? > > Also, I have a list defined in my form object. Do the <i21:bind> tags > support binding data to a list? If not, do you have any suggestions on > how I may go about this? (I was initially thinking of passing back a > series of request parameters and manually adding these values to the > form object list but I have a feeling there is a more elegant way of > doing this.) > > Thanks in advance, > Rhandy > > |