You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Ed_ <ed...@hotmail.com> on 2007/07/30 18:58:42 UTC
Re: editable form saw a similar issue fixed with forms and
pallettes in 1.3
http://mail-archives.apache.org/mod_mbox/wicket-commits/200707.mbox/%3c3968904.1184003764866.JavaMail.jira@brutus%3e
Is there any correlation?
I am currenlty using 1.2
Ed_ wrote:
>
> Thanks the toString override seems to work in that the correct values/ids
> that I want do get posted back.
> Like you mentioned is this the right way to do it?
>
> Even with this solution in response to the submit I still continue to get
> an error back - which isn't making much sense to me.
>
> http://localhost:8080/wicket/test/?wicket:interface=:5:DisplayPanel:PublishForm::IFormSubmitListener
>
> WicketMessage: No get method defined for class: class java.lang.String
> expression: id
> Root cause:
> wicket.WicketRuntimeException: No get method defined for class: class
> java.lang.String expression: id
> at
> wicket.util.lang.PropertyResolver.getGetAndSetter(PropertyResolver.java:324)
> at
> wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:200)
> at wicket.util.lang.PropertyResolver.getValue(PropertyResolver.java:88)
> at
> wicket.markup.html.form.ChoiceRenderer.getIdValue(ChoiceRenderer.java:148)
> at
> wicket.markup.html.form.AbstractSingleSelectChoice.getModelValue(AbstractSingleSelectChoice.java:140)
> at wicket.markup.html.form.FormComponent.getValue(FormComponent.java:583)
> at
> wicket.markup.html.form.AbstractChoice.onComponentTagBody(AbstractChoice.java:319)
>
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
> at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
> at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
> at java.lang.Thread.run(Thread.java:613)
> ............
> .............
> [Page class = com.test.web.myaccount.MyAccount, id = 5]:
> # Path Size Type Model Object
> 1 <auto>_header 481 bytes
> wicket.markup.html.internal.HtmlHeaderContainer
> 2 DisplayPanel 6.5K
> com.test.web.myaccount.AccountPublishDisplayPanel
> 3 DisplayPanel:PublishForm 9.5K wicket.markup.html.form.Form
>
>
>
>
>
> Ed_ wrote:
>>
>>
>> I am trying to create an editable form - this has a drop down list. in it
>>
>> List ratingList = cfg.getContentRatingList();
>> DropDownChoice ratingChoice = new DropDownChoice("rating", new
>> PropertyModel(form, "category"), ratingList, new
>> ChoiceRenderer("label", "id"));
>>
>> ratingChoice.setRequired(true);
>> add(ratingChoice);
>>
>> ratingList is a list of object types of the following class.
>> public class ConfigContent implements Serializable{
>> private String label;
>> private String id;
>> public ConfigContent(String id, String label){
>> this.label = label;
>> this.id = id;
>> }
>> public String getLabel(){
>> return this.label;
>> }
>> public String getId(){
>> return this.id;
>> }
>> public void setLabel( String label){
>> this.label = label;
>> }
>> public void setId( String Id){
>> this.id = Id;
>> }
>> }
>>
>>
>> private class FormData implements Serializable{
>> private String m_name;
>> private String m_siteUrl;
>> private String m_rating;
>> public String getName() {
>> return this.m_title;
>> }
>> public String getSiteUrl() {
>> return this.m_SiteUrl;
>> }
>> public String getRating() {
>> return this.m_rating;
>> }
>> .... setter methods.
>>
>> }
>> }
>>
>> The html seems to be getting rendered properly -
>> <select wicket:id="rating" name="rating"><option selected="selected"
>> value="">Choose One</option><option value="0">PG</option><option
>> value="1">PG-13</option>
>> <option value="2">PG-17</option><option
>> value="3">Restricted</option></select>
>> But when i submit the form and print out the values beign returned to me
>> -
>> public void onSubmit(){
>> Log log = LogFactory.getLog(PublishForm.class);
>> FormData mod = (PublishFormModel)getModelObject();
>> String title = mod.getTitle();
>> String feedUrl = mod.getSiteUrl();
>> String rating = mod.getRating();
>>
>>
>> the values for the dropdown are not right - I end up getting -
>> category:com.test.ConfigContent@1f3834
>> And then an error is returned to the web page -
>>
>> ERROR [http-8080-1] (WebRequestCycle.java:200) - No get method defined
>> for class: class java.lang.String expression: id
>> wicket.WicketRuntimeException: No get method defined for class: class
>> java.lang.String expression: id
>> at
>> wicket.util.lang.PropertyResolver.getGetAndSetter(PropertyResolver.java:324)
>> at
>> wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver.java:200)
>> at
>> wicket.util.lang.PropertyResolver.getValue(PropertyResolver.java:88)
>> at
>> wicket.markup.html.form.ChoiceRenderer.getIdValue(ChoiceRenderer.java:148)
>>
>>
>> would appreciate pointers
>>
>> thx,
>>
>> ed
>>
>> Missed the show? Watch videos of the Live Earth Concert on MSN. See them
>> now!
>>
>> _________________________________________________________________
>> PC Magazine’s 2007 editors’ choice for best web mail—award-winning
>> Windows Live Hotmail.
>> http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HMWL_mini_pcmag_0707
>>
>
>
--
View this message in context: http://www.nabble.com/editable-form-tf4165841.html#a11866785
Sent from the Wicket Users New mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: editable form saw a similar issue fixed with forms and pallettes in 1.3
Posted by Gabor Szokoli <sz...@gmail.com>.
On 7/30/07, Ed_ <ed...@hotmail.com> wrote:
>
> http://mail-archives.apache.org/mod_mbox/wicket-commits/200707.mbox/%3c3968904.1184003764866.JavaMail.jira@brutus%3e
> Is there any correlation?
I don't think so, but I'm not much more experienced with wicket than
you are :-)
> > Thanks the toString override seems to work in that the correct values/ids
> > that I want do get posted back.
> > Like you mentioned is this the right way to do it?
No, I think it's a quick hack to get it working in the
component->model direction :-)
I think the design of DropDownChoice implies you use a list of the
same class for choices as the actual model. Then you use a
ChoiceRenderer to pretty print them on the user-visible choice list.
But I could be wrong because I don't remember seeing this in any
documentation or tutorial :-)
Or is there a way to express "this" in the property expression
language? "." maybe?
Because the rating string in your model object is the choice id itself.
Gabor
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org