Re-display JSP page with form

Posted on 2006-05-02
Last Modified: 2010-08-05
Hi Guys,
I am designing a Accommodation web page(.jsp page) which contains an availability enquiry form which a user can use to enquire if the accommodation is available for a period or not.

<form name="CheckAvail" ACTION='insert_enquiry.jsp' METHOD="POST">

The action of this form is another jsp page which inserts the enquiry into a database and also checks if the period is already booked.
I have all the logic for checking if already booked working.

I am now wondering if there is a way that I can redisplay the CheckAvail form with users previously entered data so as they can change their period of enquiry if they wish??
Question by:Barry Cunney
    1 Comment
    LVL 27

    Accepted Solution

    In Accommodation.jsp  you could use something like this.
      String checkAvailability = (String)session.getAttribute("checkAvailability");
      if(checkAvailability == null) checkAvailability = "";
    and in form  
    <input type="text" name="checkAvailability" value="<%=checkAvailability%>"/>
    and in insert_enquiry.jsp  you could use  
       String checkAvailability = request.getParameter("checkAvailability");
       if(checkAvailability == null) checkAvailability = "";
       session.setAttribute("checkAvailability" , checkAvailability);

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    After several days of searching and hunting for limited documentation, I wanted to share this guide to hopefully save someone the hassle of trying to figure this out on their own. I have tested this on Xendesktop 7.1 and PS 4.5 running simultaneous…
    DECT technology has become a popular standard for wireless voice communication. DECT devices are not likely to be affected by other electronic devices and signals because they operate in a separate frequency-band.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now