Results 1 to 2 of 2
  1. #1
    janu.c is offline Member
    Join Date
    Aug 2009
    Posts
    2
    Rep Power
    0

    Default Dynamic fields in form using Form Bean

    Test.Jsp

    <html:form enctype="multipart/form-data" action="testaction.do">
    <html:file property="value(key1)" />
    <html:file property="value(key2)" />
    <html:file property="value(key3)" />
    <html:file property="value(key4)" />
    <html:submit property="submitButton" value="Submit" />
    </html:form>

    public class TestBeanForm extends org.apache.struts.action.ActionForm {

    public final Map values = new HashMap();
    private String submitButton;
    public void setValue(String key, Object value)
    {
    values.put(key, value);
    }

    public Object getValue(String key)
    {
    return values.get(key);
    }

    public String getSubmitButton() {
    return submitButton;
    }
    }

    public class TestAction extends org.apache.struts.action.Action {

    private final static String SUCCESS = "success";
    public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response)
    throws Exception {
    TestBeanForm tb = (TestBeanForm) form;
    FormFile f=(FormFile )tb.getValue("key1");
    System.out.println(":::"+tb.getValue("key1"));
    System.out.println(":::"+tb.getValue("key2"));
    storeAttachment(tb);
    return mapping.findForward("success");


    }

  2. #2
    april198474 is offline Member
    Join Date
    Sep 2009
    Posts
    2
    Rep Power
    0

    Default RE:Dynamic fields in form using Form Bean

    Nice method.I am exactly doing this ...Thanks.

    ___________________

    April

Similar Threads

  1. Using Editable Pdf form fields in Application
    By jiten.mistry in forum Advanced Java
    Replies: 5
    Last Post: 09-21-2011, 09:37 PM
  2. Replies: 10
    Last Post: 08-12-2009, 05:02 PM
  3. how to connect form to another form in netbeans5.5
    By Shivraj in forum AWT / Swing
    Replies: 1
    Last Post: 03-17-2009, 10:01 AM
  4. Replies: 6
    Last Post: 11-28-2008, 07:55 AM
  5. Struts Form Bean with property
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-27-2007, 11:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •