Results 1 to 3 of 3
  1. #1
    Faheem_Ahmed is offline Member
    Join Date
    Feb 2009
    Posts
    3
    Rep Power
    0

    Default want sql Query ouput in the calling HTML Form.. Pls Help

    Hi!

    I have created a simple page in JSP which contains 5 fields (input fields).
    when i enter the employee number and press submit button. the details of that particular employee are to be retrieved in the same fields.. Is it possible?

    at present i am displaying the data in another page : -------
    In the submit button i called a JSP prg and it displays the values but i want the details to be displayed in the first page itself (an in the respective fields ).

    Pls help
    Faheem

  2. #2
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    Yes, just redisplay the same page and load the data from a bean that you create. When you create the bean, check if an employee number was passed. If so, retrieve the employee data and make it accessible. If not, set the employee data fields to default values.

  3. #3
    marclurr is offline Member
    Join Date
    Mar 2009
    Posts
    8
    Rep Power
    0

    Default

    Yes, it's quite simple really.

    After you've executed your SQL query and have your results back, set those results as request attributes in the same way you're most likely already doing then dispatch to the jsp of your form and use el or something in your form's input fields.

    eg:

    Java Code:
    <form ...>
    ...
    <input type="text" name="firstName" value="${requestScope.firstName}" />
    ...
    </form>
    Hope this helps

Similar Threads

  1. calling up servlet from Html
    By mosto in forum Java Servlet
    Replies: 7
    Last Post: 10-18-2009, 03:38 PM
  2. HTML Form
    By Java Tip in forum SWT
    Replies: 0
    Last Post: 07-11-2008, 04:37 PM
  3. Calling Java methods form Python
    By mew in forum Advanced Java
    Replies: 1
    Last Post: 12-21-2007, 02:30 PM
  4. Getting HTML form values in Servlet
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-17-2007, 08:13 PM
  5. how to upload a file along with html form data
    By pranith in forum Java Servlet
    Replies: 3
    Last Post: 07-30-2007, 02:33 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
  •