Re: Type conversion exceptions

2009-03-20 Thread musomesa
No problem -- I have learnt plenty from others too.
Cheers
Chris M.


-Original Message-
From: ryangr grigg...@gmail.com
To: user@struts.apache.org
Sent: Fri, 20 Mar 2009 5:12 am
Subject: Re: Type conversion exceptions




Well I'll be damned...it's working! It looks like the solution was to remove
the *-conversion.properties entries and then change this in SettingAction:

public void setSettings(SettingList settings) {
   this.settings = settings;
}


public SettingList getSettings() {
   return settings;
} 

to:

public void setSettings(ListSetting settings) {
  this.settings = new SettingList();
  for (Setting setting : settings) {
 this.settings.add(setting);
  }
}


public ListSetting getSettings() {
 return settings;
} 

I probably would never have tried the ListSetting approach, I am in your
debt! Thanks for taking the time to work with it a bit, I appreciate it as
it was driving me nuts!

You get free drinks if I go to Japan or you come to the States...

Cheers,
Ryan

musomesa wrote:
 
 
 I got your code to run (paseted below). Just so I am sure I am doing what
 you are trying to do:
 
 1. I made no changes to Setter or SetterList so that I don't break your
 design. Only to the action and the jsp
 2. I assume what you want is to be able to display and edit and create the
 settings (I did not do delete)?
 3. I assume you are using Struts 2.1.6 (I should have asked -- sorry)
 
 
 Some observations:
 1. You don't need a converter at all.
 Why? Because you are sending the title and value as separate Strings and
 want to create a Settings object with those items as its state.
 Instantiating an object and injecting it with a couple of Strings does not
 require a converter. If you have a String representation of the Setting as
 a whole (e.g. theTitletheValue) then you would need a converter to parse
 the String and create a Setting object.
 
 2. You don't need entries in *-converters.xml 
 Why? Becaus of 1.
 
 3. You don't need to expose?a property of type StringList.
 Why? Your JSP only uses the fact that it is a ListSetting. StringList is
 an implementation. So you only need a getter/setter that returns/takes a
 ?ListSetting?
 
 Note: I am posting from Japan and I noticed I som
etimes get characters
 that are non-printing here appearing in the paste -- I think it is the
 encoding so please clean it up if that happens
 
 Action:
 
 public class SettingAction extends ActionSupport {
 ?private static final long serialVersionUID = -7082992787920559583L;
 ?private Setting newSetting;
 ?private SettingList settings = new SettingList();
 
 ?public String execute() {
 ??if (newSetting != null) {
 ???//give it an id
 ???newSetting.setId( + settings.size());
 ???settings.add(newSetting);
 ??}
 ??return SUCCESS;
 ?}
 
 
 ?public void setSettings(ListSetting settings) {
 ??this.settings = new SettingList();
 ??for (Setting setting : settings) {
 ???this.settings.add(setting);
 ??}
 ?}
 
 
 ?public ListSetting getSettings() {
 ??return settings;
 ?}
 
 
 ?public Setting getNewSetting() {
 ??return newSetting;
 ?}
 
 
 ?public void setNewSetting(Setting newSetting) {
 ??this.newSetting = newSetting;
 ?};
 
 }
 
 
 JSP:
 
 s:form action=setting
 ?s:iterator value=%{settings} status=rowstatus
 ??tr
 ???th
 input?
 name='settings[s:property value=#rowstatus.index /].title'
 value='s:property value=title /' type=hidden /
  
 label?for='setting_s:property value=id /' 
 s:property value=title /: /label
 ???/th
 ???td
 input id='setting_s:property value=id /'
 name='settings[s:property value=#rowstatus.index /].value'
 value='s:property value=value /' //td
 ??/tr
 ?/s:iterator
 ?s:label value=New Setting /
 ?s:textfield name=newSetting.title label=Title/s:textfield
 ?s:textfield name=newSetting.value label=Value/s:textfield
 ?s:submit /
 /s:form
 
 
 Cheers
 Chris M
 
 
 
 
 -Original Message-
 From: ryangr grigg...@gmail.com
 To: user@struts.apache.org
 Sent: Wed, 18 Mar 2009 10:55 pm
 Subject: Re: Type conversion exceptions
 
 
 
 
 
 Here is the converter code: http://pastie.org/41
9709
 
 Obviously it isn't doing anything other than outputting the values being
 passed in, but none of the values contain anything yet as the parameters
 are
 getting lost somewhere so there's no point in processing them yet.
 
 
 
 musomesa wrote:
 
 I have downloaded your code and will study it so that I don't
 misunderstand. Can you also post the converter?
 If I see it I might?suggestions that fit what you are doing better. 
 Chris
 
 
 -- 
 View this message in context:
 http://www.nabble.com/Type-conversion-exceptions-tp22497261p22579161.html
 Sent from the Struts - User mailing list archive at Nabble.com.
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Type

Re: Type conversion exceptions

2009-03-19 Thread ryangr

Well I'll be damned...it's working! It looks like the solution was to remove
the *-conversion.properties entries and then change this in SettingAction:

public void setSettings(SettingList settings) {
   this.settings = settings;
}


public SettingList getSettings() {
   return settings;
} 

to:

public void setSettings(ListSetting settings) {
  this.settings = new SettingList();
  for (Setting setting : settings) {
 this.settings.add(setting);
  }
}


public ListSetting getSettings() {
 return settings;
} 

I probably would never have tried the ListSetting approach, I am in your
debt! Thanks for taking the time to work with it a bit, I appreciate it as
it was driving me nuts!

You get free drinks if I go to Japan or you come to the States...

Cheers,
Ryan

musomesa wrote:
 
 
 I got your code to run (paseted below). Just so I am sure I am doing what
 you are trying to do:
 
 1. I made no changes to Setter or SetterList so that I don't break your
 design. Only to the action and the jsp
 2. I assume what you want is to be able to display and edit and create the
 settings (I did not do delete)?
 3. I assume you are using Struts 2.1.6 (I should have asked -- sorry)
 
 
 Some observations:
 1. You don't need a converter at all.
 Why? Because you are sending the title and value as separate Strings and
 want to create a Settings object with those items as its state.
 Instantiating an object and injecting it with a couple of Strings does not
 require a converter. If you have a String representation of the Setting as
 a whole (e.g. theTitletheValue) then you would need a converter to parse
 the String and create a Setting object.
 
 2. You don't need entries in *-converters.xml 
 Why? Becaus of 1.
 
 3. You don't need to expose?a property of type StringList.
 Why? Your JSP only uses the fact that it is a ListSetting. StringList is
 an implementation. So you only need a getter/setter that returns/takes a
 ?ListSetting?
 
 Note: I am posting from Japan and I noticed I sometimes get characters
 that are non-printing here appearing in the paste -- I think it is the
 encoding so please clean it up if that happens
 
 Action:
 
 public class SettingAction extends ActionSupport {
 ?private static final long serialVersionUID = -7082992787920559583L;
 ?private Setting newSetting;
 ?private SettingList settings = new SettingList();
 
 ?public String execute() {
 ??if (newSetting != null) {
 ???//give it an id
 ???newSetting.setId( + settings.size());
 ???settings.add(newSetting);
 ??}
 ??return SUCCESS;
 ?}
 
 
 ?public void setSettings(ListSetting settings) {
 ??this.settings = new SettingList();
 ??for (Setting setting : settings) {
 ???this.settings.add(setting);
 ??}
 ?}
 
 
 ?public ListSetting getSettings() {
 ??return settings;
 ?}
 
 
 ?public Setting getNewSetting() {
 ??return newSetting;
 ?}
 
 
 ?public void setNewSetting(Setting newSetting) {
 ??this.newSetting = newSetting;
 ?};
 
 }
 
 
 JSP:
 
 s:form action=setting
 ?s:iterator value=%{settings} status=rowstatus
 ??tr
 ???th
 input?
 name='settings[s:property value=#rowstatus.index /].title'
 value='s:property value=title /' type=hidden /
  
 label?for='setting_s:property value=id /' 
 s:property value=title /: /label
 ???/th
 ???td
 input id='setting_s:property value=id /'
 name='settings[s:property value=#rowstatus.index /].value'
 value='s:property value=value /' //td
 ??/tr
 ?/s:iterator
 ?s:label value=New Setting /
 ?s:textfield name=newSetting.title label=Title/s:textfield
 ?s:textfield name=newSetting.value label=Value/s:textfield
 ?s:submit /
 /s:form
 
 
 Cheers
 Chris M
 
 
 
 
 -Original Message-
 From: ryangr grigg...@gmail.com
 To: user@struts.apache.org
 Sent: Wed, 18 Mar 2009 10:55 pm
 Subject: Re: Type conversion exceptions
 
 
 
 
 
 Here is the converter code: http://pastie.org/419709
 
 Obviously it isn't doing anything other than outputting the values being
 passed in, but none of the values contain anything yet as the parameters
 are
 getting lost somewhere so there's no point in processing them yet.
 
 
 
 musomesa wrote:
 
 I have downloaded your code and will study it so that I don't
 misunderstand. Can you also post the converter?
 If I see it I might?suggestions that fit what you are doing better. 
 Chris
 
 
 -- 
 View this message in context:
 http://www.nabble.com/Type-conversion-exceptions-tp22497261p22579161.html
 Sent from the Struts - User mailing list archive at Nabble.com.
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Type-conversion-exceptions-tp22497261p22608399.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr

Re: Type conversion exceptions

2009-03-18 Thread Lukasz Lenart
2009/3/17 ryangr grigg...@gmail.com:
 [xwork-conversion.properties]
 Element_settings=com.rjssoft.webdocs.setting.Setting

That's ok but your SettingList is not full List implementation and you
have to specified how to convert array to SettingList that's why you
have to specified also converter for SettingList above.

I will try to prepare something similar today evening and test.


Regards
-- 
Lukasz
http://www.lenart.org.pl/

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Type conversion exceptions

2009-03-18 Thread Lukasz Lenart
2009/3/18  musom...@aol.com:
 But then how do you plan to write a converter to convert a String[] to a 
 SettingList?

It's already done, just to the configuration has to be adjusted

 Also why is aggregation a bad design?

It isn't but exposing directly internal field (ArrayListSetting) it is.


Regards
-- 
Lukasz
http://www.lenart.org.pl/

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Type conversion exceptions

2009-03-18 Thread ryangr

Here is the converter code: http://pastie.org/419709

Obviously it isn't doing anything other than outputting the values being
passed in, but none of the values contain anything yet as the parameters are
getting lost somewhere so there's no point in processing them yet.



musomesa wrote:
 
 I have downloaded your code and will study it so that I don't
 misunderstand. Can you also post the converter?
 If I see it I might?suggestions that fit what you are doing better. 
 Chris
 

-- 
View this message in context: 
http://www.nabble.com/Type-conversion-exceptions-tp22497261p22579161.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Type conversion exceptions

2009-03-17 Thread Lukasz Lenart
2009/3/16 ryangr grigg...@gmail.com:
 com.opensymphony.xwork2.util.XWorkConverter  - processing conversion file
 [com/rjssoft/webdocs/admin/SettingAction-conversion.properties] [class=class
 com.rjssoft.webdocs.admin.SettingAction]

As I see you have only SettingAction-conversion.properties, could you
try to use global xwork-conversion.properties?

http://struts.apache.org/2.x/docs/type-conversion.html#TypeConversion-ApplyingaTypeConverterforanapplication


Regards
-- 
Lukasz
http://www.lenart.org.pl/

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Type conversion exceptions

2009-03-17 Thread ryangr

If I do that, then there will be two lines as such in the properties file:

com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.setting.Setting
com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.converter.SettingListConverter

How will it know the difference? I followed the documentation where it said
to use () instead of [] which was apparently wrong, now putting
com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.setting.Setting
instead of Element_settings like the examples...neither way works and this
is getting frustrating. :(

Making this change (with or without the second line) simply causes
exceptions to be thrown setting each of the 3 attributes:

ERROR com.opensymphony.xwork2.util.InstantiatingNullHandler  - Could not
create and/or set value back on to object
ognl.OgnlException: settings [java.lang.IllegalArgumentException: argument
type mismatch]

ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor  -
ParametersInterceptor - [setParameters]: Unexpected Exception caught setting
'settings[0].title' on 'class com.rjssoft.webdocs.admin.SettingAction: Error
setting expression 'settings[0].title' with value
'[Ljava.lang.String;@13acc52'


Ryan



Lukasz Lenart wrote:
 
 2009/3/17 ryangr grigg...@gmail.com:
 Element_settings=com.rjssoft.webdocs.setting.Setting
 
 But you should put there
 com.rjssoft.webdocs.setting.SettingList =
 com.rjssoft.webdocs.setting.Setting
 
 
 Regards
 -- 
 Lukasz
 http://www.lenart.org.pl/
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Type-conversion-exceptions-tp22497261p22568375.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Type conversion exceptions

2009-03-16 Thread ryangr
-16A21DFCEDA7).title = [ SMTP Server
 Address ] 
 
 My SettingAction-conversion.properties has(Setting is just a custom bean
 object with all id, title, and value along with all getters/setters):
 KeyProperty_settings=id
 Element_settings=Setting
 
 I followed the examples so I'm not sure where it is going wrong...any
 help?
 
 Thanks!
 Ryan
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Type-conversion-exceptions-tp22497261p22538757.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Type conversion exceptions

2009-03-16 Thread Lukasz Lenart
2009/3/16 ryangr grigg...@gmail.com:
 ERROR com.opensymphony.xwork2.util.InstantiatingNullHandler  - Could not
 create and/or set value back on to object
 ognl.OgnlException: settings [java.lang.IllegalArgumentException: argument
 type mismatch]
 ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor  -
 ParametersInterceptor - [setParameters]: Unexpected Exception caught setting
 'settings[0].title' on 'class com.rjssoft.webdocs.admin.SettingAction: Error
 setting expression 'settings[0].title' with value
 '[Ljava.lang.String;@185fe0c'

settings is a List?
could you take a look on rendered page source, are there different
indexes (settings[x].title)?


Regards
-- 
Lukasz
http://www.lenart.org.pl/

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Type conversion exceptions

2009-03-16 Thread ryangr

settings is a SettingList which is just an extended ArrayListSetting.

The rendered source looks like:
input value=192.168.1.1 name=settings[0].value
id=setting_D176A8AA-1636-4AFF-9C71-16A21DFCEDA7/

Currently there is only one Setting, but adding another arbitrary entry does
come up with settings[1].value, etc.

Ryan


Lukasz Lenart wrote:
 
 2009/3/16 ryangr grigg...@gmail.com:
 ERROR com.opensymphony.xwork2.util.InstantiatingNullHandler  - Could not
 create and/or set value back on to object
 ognl.OgnlException: settings [java.lang.IllegalArgumentException:
 argument
 type mismatch]
 ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor  -
 ParametersInterceptor - [setParameters]: Unexpected Exception caught
 setting
 'settings[0].title' on 'class com.rjssoft.webdocs.admin.SettingAction:
 Error
 setting expression 'settings[0].title' with value
 '[Ljava.lang.String;@185fe0c'
 
 settings is a List?
 could you take a look on rendered page source, are there different
 indexes (settings[x].title)?
 
 
 Regards
 -- 
 Lukasz
 http://www.lenart.org.pl/
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Type-conversion-exceptions-tp22497261p22540046.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Type conversion exceptions

2009-03-16 Thread Lukasz Lenart
2009/3/16 ryangr grigg...@gmail.com:
 settings is a SettingList which is just an extended ArrayListSetting.

That can be a problem, generics are erased during compilation and Ognl
doesn't know how to convert array to SettingList, did you try to
prepare converter for it?


Regards
-- 
Lukasz
http://www.lenart.org.pl/

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Type conversion exceptions

2009-03-16 Thread ryangr

Well I can't seem to find documentation or examples of how to use the
convertValue() API. This is what each call outputs (it seems both versions
get called each time the converter is run):

Called convertValue(Map, Object, Member, String, Object, Class)
target: com.rjssoft.webdocs.admin.settingact...@12cb585
member: public void
com.rjssoft.webdocs.admin.SettingAction.setSettings(com.rjssoft.webdocs.setting.SettingList)
propertyName: settings
value (java.util.ArrayList): []
toType: class com.rjssoft.webdocs.setting.SettingList

Called convertValue(Map, Object, Class)
context: ognl.ognlcont...@eb7f1c7f
o (java.util.ArrayList): []
toClass: class com.rjssoft.webdocs.setting.SettingList

It appears both values objects (value and o, respectively) are completely
empty...

Ryan



ryangr wrote:
 
 That makes sense...I've added a converter for it similar to others that
 already exist in the app, but it doesn't appear to be calling
 convertFromString which the others use. Instead, it seems to be calling
 convertValue(Map, Object, Member, String, Object, Class) which I do not
 see in the Struts 2.0.14 API:
 
 http://struts.apache.org/2.0.14/struts2-core/apidocs/org/apache/struts2/util/StrutsTypeConverter.html
 
 Is there documentation on this somewhere that I'm missing? Is this what is
 supposed to be used? None of our other typeconverters use this method
 perhaps because it wasn't documented...
 
 Ryan
 
 
 Lukasz Lenart wrote:
 
 2009/3/16 ryangr grigg...@gmail.com:
 settings is a SettingList which is just an extended ArrayListSetting.
 
 That can be a problem, generics are erased during compilation and Ognl
 doesn't know how to convert array to SettingList, did you try to
 prepare converter for it?
 
 
 Regards
 -- 
 Lukasz
 http://www.lenart.org.pl/
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Type-conversion-exceptions-tp22497261p22541495.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Type conversion exceptions

2009-03-16 Thread Lukasz Lenart
2009/3/16 ryangr grigg...@gmail.com:
 It appears both values objects (value and o, respectively) are completely
 empty...

It's strange but anyway you should be able to use Struts2 / XWork2
convertion mechanism, did you setup xwork-conversion.properties file
as mentioned in documentation [1]?

[1] 
http://struts.apache.org/2.x/docs/type-conversion.html#TypeConversion-ASimpleExample


Regards
-- 
Lukasz
http://www.lenart.org.pl/

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Type conversion exceptions

2009-03-16 Thread ryangr

Yes, I have it listed in the xwork-conversion.properties file as such:

com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.converter.SettingListConverter

Ryan



Lukasz Lenart wrote:
 
 
 It's strange but anyway you should be able to use Struts2 / XWork2
 convertion mechanism, did you setup xwork-conversion.properties file
 as mentioned in documentation [1]?
 
 [1]
 http://struts.apache.org/2.x/docs/type-conversion.html#TypeConversion-ASimpleExample
 
 
 Regards
 -- 
 Lukasz
 http://www.lenart.org.pl/
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Type-conversion-exceptions-tp22497261p22546980.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Type conversion exceptions

2009-03-16 Thread Lukasz Lenart
2009/3/16 ryangr grigg...@gmail.com:

 Yes, I have it listed in the xwork-conversion.properties file as such:

 com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.converter.SettingListConverter

And the file is in the root of your classpath (WEB-INF/classes)?


Regards
-- 
Lukasz
http://www.lenart.org.pl/

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Type conversion exceptions

2009-03-16 Thread ryangr

Yes.

Hence why I'm confused! :confused:

:-D

Ryan


Lukasz Lenart wrote:
 
 2009/3/16 ryangr grigg...@gmail.com:

 Yes, I have it listed in the xwork-conversion.properties file as such:

 com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.converter.SettingListConverter
 
 And the file is in the root of your classpath (WEB-INF/classes)?
 
 
 Regards
 -- 
 Lukasz
 http://www.lenart.org.pl/
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Type-conversion-exceptions-tp22497261p22547311.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Type conversion exceptions

2009-03-16 Thread ryangr

Somewhere in here it appears to be losing the values because the parameter
interceptor has them then once it hits the converter they disappear:

com.opensymphony.xwork2.interceptor.ParametersInterceptor  - Setting params
settings[0].value = [ 192.168.1.1 ] settings[0].title = [ SMTP Server
Address ] 

com.opensymphony.xwork2.util.InstantiatingNullHandler  - Entering
nullPropertyValue [target=[com.rjssoft.webdocs.admin.settingact...@a6d35,
com.opensymphony.xwork2.defaulttextprovi...@e2892b], property=settings]

com.opensymphony.xwork2.util.XWorkConverter  - Property: settings

com.opensymphony.xwork2.util.XWorkConverter  - Class:
com.rjssoft.webdocs.admin.SettingAction

com.opensymphony.xwork2.util.XWorkConverter  - processing conversion file
[com/rjssoft/webdocs/admin/SettingAction-conversion.properties] [class=class
com.rjssoft.webdocs.admin.SettingAction]

com.opensymphony.xwork2.util.XWorkConverter  - 
Element_settings:com.rjssoft.webdocs.setting.Setting[treated as Class class
com.rjssoft.webdocs.setting.Setting]

com.opensymphony.xwork2.util.XWorkConverter  - converter is null for
property settings. Mapping size: 1

com.opensymphony.xwork2.util.XWorkConverter  - Element_settings:class
com.rjssoft.webdocs.setting.Setting

com.opensymphony.xwork2.util.XWorkConverter  - field-level type converter
for property [settings] = none found

com.opensymphony.xwork2.util.XWorkConverter  - Property: settings.settings

com.opensymphony.xwork2.util.XWorkConverter  - Class:
com.rjssoft.webdocs.admin.SettingAction

com.opensymphony.xwork2.util.XWorkConverter  - processing conversion file
[com/rjssoft/webdocs/admin/SettingAction-conversion.properties] [class=class
com.rjssoft.webdocs.admin.SettingAction]

com.opensymphony.xwork2.util.XWorkConverter  - 
Element_settings:com.rjssoft.webdocs.setting.Setting[treated as Class class
com.rjssoft.webdocs.setting.Setting]

com.opensymphony.xwork2.util.XWorkConverter  - converter is null for
property settings.settings. Mapping size: 1

com.opensymphony.xwork2.util.XWorkConverter  - Element_settings:class
com.rjssoft.webdocs.setting.Setting

com.opensymphony.xwork2.util.XWorkConverter  - global-level type converter
for property [settings] =
com.rjssoft.webdocs.converter.settinglistconver...@61f533

com.rjssoft.webdocs.converter.SettingListConverter  - Called
SettingListConverter.convertValue(Map, Object, Member, String, Object,
Class)

com.rjssoft.webdocs.converter.SettingListConverter  - target:
com.rjssoft.webdocs.admin.settingact...@a6d35

com.rjssoft.webdocs.converter.SettingListConverter  - member: public void
com.rjssoft.webdocs.admin.SettingAction.setSettings(com.rjssoft.webdocs.setting.SettingList)

com.rjssoft.webdocs.converter.SettingListConverter  - propertyName: settings

com.rjssoft.webdocs.converter.SettingListConverter  - value
(java.util.ArrayList): []

com.rjssoft.webdocs.converter.SettingListConverter  - toType: class
com.rjssoft.webdocs.setting.SettingList

com.rjssoft.webdocs.converter.SettingListConverter  - Called
SettingListConverter.convertValue(Map, Object, Class)

com.rjssoft.webdocs.converter.SettingListConverter  - context:
ognl.ognlcont...@eb75affa

com.rjssoft.webdocs.converter.SettingListConverter  - o
(java.util.ArrayList): []

com.rjssoft.webdocs.converter.SettingListConverter  - toClass: class
com.rjssoft.webdocs.setting.SettingList

-- 
View this message in context: 
http://www.nabble.com/Type-conversion-exceptions-tp22497261p22548129.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Type conversion exceptions

2009-03-14 Thread dusty

your syntax for the field name should be 
...name = settings[]  rather than name = settings()

Also, I think your action expects to build a List of Settings rather than
Map of settings.  If that is the case then you don't want to use key values
in settings[ASDF1-123AS-123SA-123] you want to use an index for a List,
settings[0]...  settings[1]..., etc.  You don't need the Key_xxx in
-conversion.properties file if your target is a List.

I am wondering if you want struts to load your Settings models from the db
based on the ID.  If that was the case then you would need to use an
entirely different pattern with a custom TypeConverter...



ryangr wrote:
 
 This is probably going to be a really simple solution, but after searching
 I still haven't quite found an answer so I appreciate any help with this.
 I'm using 2.0.14 and trying to do type conversion on a custom collection
 (called settings in this case, it is just an extended ArrayList). I'm
 getting the following in my logs:
 
 Unexpected Exception caught setting
 'settings(D176A8AA-1636-4AFF-9C71-16A21DFCEDA7).id' on 'class
 com.rjssoft.webdocs.admin.SettingAction: Error setting expression
 'settings(D176A8AA-1636-4AFF-9C71-16A21DFCEDA7).id' with value
 '[Ljava.lang.String;@1f796d0'
 
 Unexpected Exception caught setting
 'settings(D176A8AA-1636-4AFF-9C71-16A21DFCEDA7).title' on 'class
 com.rjssoft.webdocs.admin.SettingAction: Error setting expression
 'settings(D176A8AA-1636-4AFF-9C71-16A21DFCEDA7).title' with value
 '[Ljava.lang.String;@1ce64f6'
 
 Unexpected Exception caught setting
 'settings(D176A8AA-1636-4AFF-9C71-16A21DFCEDA7).value' on 'class
 com.rjssoft.webdocs.admin.SettingAction: Error setting expression
 'settings(D176A8AA-1636-4AFF-9C71-16A21DFCEDA7).value' with value
 '[Ljava.lang.String;@6bba64'
 
 Now, obviously it is trying to set a String[] to a String value and
 failing; however, according to the official doc on type conversion there
 is no additional processing. The form consists of:
 
 ...
 s:iterator value=%{settings}
  tr
   th
   input name=settings(s:property value=id /).id
 value=s:property value=id / type=hidden /
 
   input name=settings(s:property value=id /).title
 value=s:property value=title / type=hidden /
   label for=setting_s:property value=id /
   s:property value=title /:
   /label
   /th
   td
   input id=setting_s:property value=id /
 name=settings(s:property value=id /).value value=s:property
 value=value / /
   /td
  /tr
 /s:iterator
 
 The values that come through are:
 Setting params settings(D176A8AA-1636-4AFF-9C71-16A21DFCEDA7).id = [
 D176A8AA-1636-4AFF-9C71-16A21DFCEDA7 ]
 settings(D176A8AA-1636-4AFF-9C71-16A21DFCEDA7).value = [ 192.168.1.1 ]
 settings(D176A8AA-1636-4AFF-9C71-16A21DFCEDA7).title = [ SMTP Server
 Address ] 
 
 My SettingAction-conversion.properties has(Setting is just a custom bean
 object with all id, title, and value along with all getters/setters):
 KeyProperty_settings=id
 Element_settings=Setting
 
 I followed the examples so I'm not sure where it is going wrong...any
 help?
 
 Thanks!
 Ryan
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Type-conversion-exceptions-tp22497261p22519878.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Type conversion exceptions

2009-03-13 Thread ryangr

This is probably going to be a really simple solution, but after searching I
still haven't quite found an answer so I appreciate any help with this. I'm
using 2.0.14 and trying to do type conversion on a custom collection (called
settings in this case, it is just an extended ArrayList). I'm getting the
following in my logs:

Unexpected Exception caught setting
'settings(D176A8AA-1636-4AFF-9C71-16A21DFCEDA7).id' on 'class
com.rjssoft.webdocs.admin.SettingAction: Error setting expression
'settings(D176A8AA-1636-4AFF-9C71-16A21DFCEDA7).id' with value
'[Ljava.lang.String;@1f796d0'

Unexpected Exception caught setting
'settings(D176A8AA-1636-4AFF-9C71-16A21DFCEDA7).title' on 'class
com.rjssoft.webdocs.admin.SettingAction: Error setting expression
'settings(D176A8AA-1636-4AFF-9C71-16A21DFCEDA7).title' with value
'[Ljava.lang.String;@1ce64f6'

Unexpected Exception caught setting
'settings(D176A8AA-1636-4AFF-9C71-16A21DFCEDA7).value' on 'class
com.rjssoft.webdocs.admin.SettingAction: Error setting expression
'settings(D176A8AA-1636-4AFF-9C71-16A21DFCEDA7).value' with value
'[Ljava.lang.String;@6bba64'

Now, obviously it is trying to set a String[] to a String value and failing;
however, according to the official doc on type conversion there is no
additional processing. The form consists of:

...
s:iterator value=%{settings}
 tr
th
input name=settings(s:property value=id /).id 
value=s:property
value=id / type=hidden / 

input name=settings(s:property value=id /).title
value=s:property value=title / type=hidden /
label for=setting_s:property value=id /
s:property value=title /:
/label
/th
td
input id=setting_s:property value=id /
name=settings(s:property value=id /).value value=s:property
value=value / /
/td
 /tr
/s:iterator

The values that come through are:
Setting params settings(D176A8AA-1636-4AFF-9C71-16A21DFCEDA7).id = [
D176A8AA-1636-4AFF-9C71-16A21DFCEDA7 ]
settings(D176A8AA-1636-4AFF-9C71-16A21DFCEDA7).value = [ 192.168.1.1 ]
settings(D176A8AA-1636-4AFF-9C71-16A21DFCEDA7).title = [ SMTP Server
Address ] 

My SettingAction-conversion.properties has(Setting is just a custom bean
object with all id, title, and value along with all getters/setters):
KeyProperty_settings=id
Element_settings=Setting

I followed the examples so I'm not sure where it is going wrong...any help?

Thanks!
Ryan


-- 
View this message in context: 
http://www.nabble.com/Type-conversion-exceptions-tp22497261p22497261.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org