Re-display JSP page with form

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??
LVL 17
Barry CunneyAsked:
Who is Participating?
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);
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.