New webframeworks - same problems


Web tier: servlets, JSP, Web frameworks: New webframeworks - same problems

  1. New webframeworks - same problems (2 messages)

    I was recently working with webwork framework after having worked a lot before using struts.

    What i cant believe is that with webwork the age old problem of not being able to submit complex objects (that is not java wrappers or primitives but my own domain objects) as input values in a form.
    In struts if I have a form for creating an Object type A, which has one attribute Object B. so my jsp form looks like a list of radio buttons for each B object possible. rendered within an iterator tag. But in the form, it cant handle object B, so instead it has a string id, and form submits, of the selected radio button. Meaning in the action i have to go get B object again using the submitted id. (which is the killer having to do another get).

    So i expected this to be a glaring problem that all new frameworks will breeze by. But use webwork, and nope doesnt seem possible. I have only been at it a while, so maybe i am missing something, maybe its allowed.

    As i am only interested in building small crud app for editing my domain objects, i am not too interested in other features would just like the http form to domain object mapping to be transparent to me.

    So which of thse frameworks will allow that.
    Struts - defo not.
    Webwork - it seems not.
    Tapestry = ???
    JSF / my faces impl - ????
    Wicket = ????

    then i came across which in its docco mentions that it address this issue (using reflection , which i thought most new frameworks would do) .

    Threaded Messages (2)

  2. New webframeworks - same problems[ Go to top ]

    Well, JSF handles this just fine:

       value="#{carBean.carList}" />

    where carBean is the jsf-managed bean you want the selected value to be submitted to (by calling setCurrentCar()), and carBean's getCarList() method returns a list of objects that should be used to populate the list.

  3. New webframeworks - same problems[ Go to top ]

    If I understood ur problem correctly, then ur trying some sort of inner class mechanism say ObjectA holds ObjectB.
    If that's what u r doing, then here is the solution:

    create a form bean. Inside it create a static inner class that implements serializable interface. generate getter an d setters for the attributes of both the classes and use it in ur jsp.

    An Example:

    class ObjectA extends ValidatorForm{

       public static class ObjectB implements Serializable{
          private int id;
          private String name;
          public ObjectB(int a,String name){
    = a;
    = name;

          //getters and setters come here

       static Collection collections = new ArrayList();

       public ObjectA(){

       public ObjectA(int id, String name){
           //if ur retrieving values from a database
           collections.add(new ObjectB(id, name);
           //or passing the values right here
           collections.add(new ObjectB(1, "abc");
           collections.add(new ObjectB(2, "fdgfg");
           collections.add(new ObjectB(3, "dfsr");

       //attributes of form
       private int [] selectedObject;
       public void setSelectedObject(int [] i){
          selectedObject = i;

       public int [] getSelectedObject(){
          return selectedObject;

       public Collection getCollections(){
          return collections;

    in ur jsp page use
    <html:form action="/xxxxx">
    <html:select property="selectedObject">