Results 1 to 4 of 4
  1. #1
    keanhoo168 is offline Member
    Join Date
    Sep 2010
    Posts
    2
    Rep Power
    0

    Question Submit jsp form data to java

    I have a jsp form that required user to input multiple name and email.
    Then the form will be submitted to a servlet.

    I manage to get the form data using request.getParameter() one by one.
    But this seems troublesome.

    Anyway i can do it easily as my form is consisting of multiple data rows that have name and email? I heard about using java bean, but not very sure how to use it.

    Can show me some simple example?

    Thank you.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,798
    Rep Power
    19

    Default

    Quote Originally Posted by keanhoo168 View Post
    I have a jsp form that required user to input multiple name and email.
    Then the form will be submitted to a servlet.
    No you don't. You have an HTML form that is submitted to the server.
    A JSP is purely server side and, in fact, ceases to exist once it's been interpreted into a servlet by Tomcat.

    I am on a crusade against this misuse!
    :)

    Quote Originally Posted by keanhoo168 View Post
    I manage to get the form data using request.getParameter() one by one.
    But this seems troublesome.

    Anyway i can do it easily as my form is consisting of multiple data rows that have name and email? I heard about using java bean, but not very sure how to use it.

    Can show me some simple example?

    Thank you.
    Use a framework like Struts or Spring that has already written the code to do this for you.

    Or, if that's not possible for whatever reason, show us the code you currently have and we might be able to point out ways to tidy it up.

  3. #3
    keanhoo168 is offline Member
    Join Date
    Sep 2010
    Posts
    2
    Rep Power
    0

    Default

    Tolls, sorry for my wrong word. Yes, it is a html page after all at client side.

    Btw, any Struct example that suite the kind of newbie like me?

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,798
    Rep Power
    19

    Default

    I think both Spring and Struts have pretty good documentation for doing this sort of thing.

    There's a bunch of upfront configuration with either of them, so you'd do better to work through their examples.

    Struts might be the slightly easier one to read through. There's a primer, then the main docs. There's also a basic PDF somewhere...

Similar Threads

  1. invoking servlet from jsp form submit using web.xml
    By java_hyd in forum Java Servlet
    Replies: 1
    Last Post: 11-24-2009, 08:57 PM
  2. Replies: 0
    Last Post: 10-31-2009, 09:24 AM
  3. Replies: 10
    Last Post: 08-12-2009, 04:02 PM
  4. How to use one form to submit data to 2 tables on mysql
    By kwesiaryee in forum New To Java
    Replies: 2
    Last Post: 10-10-2008, 01:41 PM
  5. enctype=multipart/form-data with form data in struts
    By vk_satheesh in forum New To Java
    Replies: 0
    Last Post: 09-19-2008, 12:48 PM

Tags for this Thread

Posting Permissions

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