I'm trying to create an edit page. I think I already in the right direction, 
but still unable to populate data even with a direct value via action class. 
Please let me what's wrong here. I've spend 3 days alone with this problem. 
Thank you.


I created two action file:
- SetUpCategoryEditAction.java (this action will populate data from db to form)
- CategoryEditAction.java (this action will save the data)

My formbean: CategoryEditForm.java
----------------------
public class CategoryEditForm extends ValidatorForm  {                      
    private String name;
    private String categoryId;     

    public void setName(String s) {
        this.name = s;
    }
    public String getName() {
        return name;
    }              
    public void setcategoryId(String s) {
        this.categoryId = s;
    }
    public String getcategoryId() {
        return categoryId;
    }
}


My struts-config.xml
----------------------
<form-bean name="categoryEditForm" 
type="com.strutsgen.garuda.CategoryEditForm"/>

        <action path="/setUpCategoryEditForm"
            type="com.strutsgen.garuda.SetUpCategoryEditAction"
            name="categoryEditForm"
            scope="request"
            validate="false"
            >
            <forward
                    name="continue"
                    path="/categoryEditForm.jsp"/>
        </action>

        <action path="/categoryEdit"
            type="com.strutsgen.garuda.CategoryEditAction"
            name="categoryEditForm"
            attribute="val_categoryEdit"
            scope="request"
            validate="true"
            input="/categoryEditForm.jsp"
            >
            <forward
                    name="success"
                    path="/categoryEditOk.jsp"/>
        </action>


SetUpCategoryEditAction.java:
----------------------
public final class SetUpCategoryEditAction extends Action {

    public ActionForward execute(ActionMapping mapping,
                                 ActionForm form,
                                 HttpServletRequest request,
                                 HttpServletResponse response)
        throws Exception {
 
        CategoryEditForm categoryEditForm = (CategoryEditForm)form;
        categoryEditForm.setName("testing");

        return (mapping.findForward("continue"));
    }
}



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to