No problem -- I have learnt plenty from others too.
Cheers
Chris M.
-Original Message-
From: ryangr
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
??
> ???
> name='settings[].title'
> ????value='' type="hidden" />
>
> '>
> :
> ???
> ???
> name='settings[].value'
> value='' />
> ??
> ?
> ?
> ?
> ?
> ?
s.newSetting = newSetting;
?};
}
JSP:
?
??
???
'>
:
???
???
??
?
?
?
?
?
Cheers
Chris M
-Original Message-
From: ryangr
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/41970
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 h
10 pm
Subject: Re: Type conversion exceptions
2009/3/18 :
> 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 di
2009/3/18 :
> 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 (ArrayList) it is.
Regards
--
Lukasz
ht
But then how do you plan to write a converter to convert a String[] to a
SettingList? Also why is aggregation a bad design?
Regards
Chris M
-Original Message-
From: Lukasz Lenart
To: Struts Users Mailing List
Sent: Wed, 18 Mar 2009 5:50 pm
Subject: Re: Type conversion exceptions
2009/3/18 :
> My bad -- I didn't realize SettingList extends ArrayList. Suggestion: make it
> aggregation so that SettingList has a property of type ArrayList and
> your type conversion problems will go away.
In such case SettingList is useless, it will be bad design
Regards
--
Lukasz
http:/
2009 6:59 am
Subject: Re: Type conversion exceptions
Okay, I'm officially very confused as to what should and shouldn't be used
since apparently the documentation example is not correct.
Let me level set with what each of my files contains again:
[xwork-conversion.properties]
E
2009/3/17 ryangr :
> [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 abo
rs
Chris M?
>
>> com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.converter.SettingListConverter
>
-Original Message-
From: ryangr
To: user@struts.apache.org
Sent: Wed, 18 Mar 2009 6:59 am
Subject: Re: Type conversion exceptions
Okay, I'm officially very confused as to what s
Okay, I'm officially very confused as to what should and shouldn't be used
since apparently the documentation example is not correct.
Let me level set with what each of my files contains again:
[xwork-conversion.properties]
Element_settings=com.rjssoft.webdocs.setting.Setting
According to the d
2009/3/17 ryangr :
> com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.setting.Setting
What this is for?
> com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.converter.SettingListConverter
This tells Xwork which converter to call if it will need to convert
Array to SettingList
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 docume
2009/3/17 ryangr :
> 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
I do have the global xwork-conversion.properties in the proper
WEB-INF/classes which is loaded above the section of the log that I copied
along with the SettingAction-conversion.properties in the SettingAction
class directory. The Setting-Action-conversion.properties only contains:
Element_settin
2009/3/16 ryangr :
> 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
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
Addre
Yes.
Hence why I'm confused! :confused:
:-D
Ryan
Lukasz Lenart wrote:
>
> 2009/3/16 ryangr :
>>
>> 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 t
2009/3/16 ryangr :
>
> 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.p
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 yo
2009/3/16 ryangr :
> 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.a
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
2009/3/16 ryangr :
> 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 d
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.
2009/3/16 ryangr :
> settings is a SettingList which is just an extended ArrayList.
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/
settings is a SettingList which is just an extended ArrayList.
The rendered source looks like:
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 :
>> ERROR com.opensymphony.xwork2.
2009/3/16 ryangr :
> 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
Okay, I changed it back to settings[0] type syntax (I had tried it before and
it didn't work), so now I have this:
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 us
30 matches
Mail list logo