why would you do that? why not let wicket handle all type conversions? and you only work with the real types?
if you make a model with just strings then you have youre stri ngs and you can call wicket.Request.getParameters() to get a map with the key value pairs On 3/26/06, Vincent Jenks <[EMAIL PROTECTED]> wrote: > That's assuming I *have* a model object, right? Simply put, can I access > each form element as a *string*, just like I would w/ JSP if I used > getParameter()? > > > > On 3/24/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote: > > > > sure, just call formcomponent.getModelObject() and > > formcomponent.setModelObject() > > > > > > -Igor > > > > > > On 3/24/06, Vincent Jenks < [EMAIL PROTECTED]> wrote: > > > > > > OK, I'll try it....thanks for the help! But, to answer my question - Is > > > there a way to access each of the form fields as stand-alone variables? > > > > > > On 3/24/06, Vincent Jenks < [EMAIL PROTECTED]> wrote: > > > > > > > > OK, I'll try it....thanks for the help! But, to answer my question - > > > > Is there a way to access each of the form fields as stand-alone > variables? > > > > > > > > > > > > On 3/24/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote: > > > > > > > > > > public class MyPage extends WebPage { > > > > > > > > > > private Map<Long,Integer> selection=new HashMap<Long,Integer>(); > > > > > > > > > > public MyPage() { > > > > > IModel categories=.... > > > > > > > > > > Form form=new Form("form"); > > > > > add(form); > > > > > > > > > > firm.add(new ListView("quantities", categories) { > > > > > > > > > > public void populateItem(ListItem item) { > > > > > > > > > > ProductCategory cat=item.getModelObject(); > > > > > final Long catId= cat.getId(); > > > > > > > > > > // this model will populate an appropriate entry in the > > > > > selection map > > > > > IModel selectionModel=new Model() { > > > > > setObject(Component c, Object o) { > > > > > selection.put (catId, (Integer)o); > > > > > } > > > > > > > > > > Object getObject(Component c) { > > > > > return selection.get(catId); > > > > > } > > > > > } > > > > > > > > > > add(new DropDownChoice("qty", selectionModel, .....) > > > > > > > > > > } > > > > > > > > > > }); > > > > > > > > > > form.add(new Button() { onSubmit() { System.out.println( > > > > > selection.toString()); } } > > > > > > > > > > ... > > > > > > > > > > > > > > > -Igor > > > > > > > > > > > > > > > On 3/24/06, Vincent Jenks <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > It makes sense but I wouldn't know how to begin (I'm rather new to > > > > > > Java as well as Wicket)...is there an example in the > wicket-examples > > > > > > somewhere? > > > > > > > > > > > > Would I just create a Map inside of the ListView? > > > > > > > > > > > > > > > > > > On 3/24/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > > if you are using a listview there is really no way to use a > > > > > > > compound property model. here is what you can do: > > > > > > > > > > > > > > on your page create a map:configid->qty > > > > > > > > > > > > > > then to the dropdown choices assign a model that will read/write > > > > > > > a key from this map. > > > > > > > > > > > > > > so when the form submits you endup with a filled in map in your > > > > > > > page. > > > > > > > > > > > > > > makes sense? > > > > > > > > > > > > > > > > > > > > > -Igor > > > > > > > > > > > > > > On 3/24/06, Vincent Jenks < [EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > > > > I've attached a screenshot of what this page does. > > > > > > > > > > > > > > > > Basically, the page you see receives a Product object in the > > > > > > > > constructor when it is called from the previous page. Each > Product has a > > > > > > > > List of Configuration objects...which you see listed in the > screenshot ( > > > > > > > > i.e. 1 Bone In Ham Half 7-10 lbs @ $99.00). Admins can define > > > > > > > > many product Configurations that the user can select on this > screen. The > > > > > > > > Configurations have an inverse relationship back to the > Product so when the > > > > > > > > Configuration is added to the cart, the Product can be > referenced as well. > > > > > > > > > > > > > > > > My problem is; in this form, how can I bind a single > > > > > > > > Configuration when there are (potentially) several, > per-product? > > > > > > > > > > > > > > > > My thinking was; I could add the Product to the ShoppingCart > > > > > > > > session bean instead and it would carry the product > Configuration(s) with > > > > > > > > it...assuming I could grab each Configuration from the > ListView in the form > > > > > > > > (where you see the 1 "Bone In Ham Half 7-10 lbs" text and the > > > > > > > > DropDownChoice lists) and manually create the Configuration > object(s) and > > > > > > > > add them to the Product before submitting the form. > > > > > > > > > > > > > > > > Does this make sense? > > > > > > > > > > > > > > > > Thanks again!! > > > > > > > > > > > > > > > > On 3/24/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > > > > > > do you have a screenshot/mockup of the form? seeing it would > > > > > > > > > help. > > > > > > > > > > > > > > > > > > so there is a list of configurations? and the user can click > > > > > > > > > on one and edit it? > > > > > > > > > > > > > > > > > > -Igor > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On 3/24/06, Vincent Jenks <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > > > > > > > > I've got a form where I can't exactly bind a model object > > > > > > > > > > because of the way the form is used. On this page, the > user selects from a > > > > > > > > > > list of product configurations (ProductConfiguration > class) which belong to > > > > > > > > > > a Product object....so there is a one-to-many > > > > > > > > > > Product->ProductConfiguration. I can't pass a > ProductConfiguration object > > > > > > > > > > into the CompoundPropertyModel because the user may choose > more than one (or > > > > > > > > > > can I?) I'm thinking I need to bind the Product and > manually add the > > > > > > > > > > ProductConfiguration objects to the product before > submitting. > > > > > > > > > > > > > > > > > > > > If I do it this way...how can I access each of the form > > > > > > > > > > fields programmatically, individually? In other > words...can form field > > > > > > > > > > values be called w/o using a CompoundPropertyModel if > needed? > > > > > > > > > > > > > > > > > > > > Also, if there's a better way to do this, please let me > > > > > > > > > > know! > > > > > > > > > > > > > > > > > > > > Thanks! > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642 _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user