How to difference between events on a Web Form?

hi there

I have a question that suppose I have a form(I am using JSP) that is requesting some data from server based on a Id.

I am getting all stuff(Sending Request and getting data from server).What I want is to display that data.

Here is problem.
Suppose I have make a search field that will request some data based on Id.And when server side component(Servlet in mycase) forward data to jsp then at that time that search box should remove and newly fetched data should be displayed from server


in this case as you can see when I reload page data from server then this Id should remove

My Simple question how to detect when their is data on request and when not?

Hope I have explain my problem well

Something like this I have try so far

    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
 <%@ include file="/jsp/include.jsp" %>
 <%@page import="formdemo.model.Address" %>
 <%@page import="formdemo.model.HighSchool" %>
 <%@page import="formdemo.model.InterSchool" %>
 <%@page import="formdemo.model.Mobile" %>
 <%@page import="formdemo.model.PastEmployment" %>
 <%@page import="formdemo.model.Person" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Search </title>
<link href="<c:url value="/resources/css/jquery-ui.css" />" rel="stylesheet">
<link href="<c:url value="/resources/css/mainfile.css" />" rel="stylesheet">
<script src="<c:url value="/resources/js/jquery.js" />"></script>
<script src="<c:url value="/resources/js/jquery-ui.js" />"></script>
<script src="<c:url value="/resources/js/jquery.validate.js" />"></script>
<script src="<c:url value="/resources/js/registration.js" />"></script>
<script type="text/javascript">
$(document).ready(function(){
var c=<%= request.getParameter("person")%>
$("#userId").val(c);
});
</script>
</head>
<body>
<div id="page-wrap">
<ul class="dropdown">
<li><a href="http://localhost:8080/WebFormSpringHibernate/jsp/registration.jsp">Add Employee</a></li>
<li><a href="http://localhost:8080/WebFormSpringHibernate/jsp/searchemployee.jsp">Search Employee</a></li>
<li><a href="http://localhost:8080/WebFormSpringHibernate/jsp/deleteemployee.jsp">Delete Employee</a></li>
<li><a href="http://localhost:8080/WebFormSpringHibernate/jsp/updateemployee.jsp">Update Employee</a></li>
</ul>
</div>
<div id="main_container">
<br>
<br>
<form action="http://localhost:8080/WebFormSpringHibernate/search" method="get">
<label style="font-size: 20px; margin-left: 40px;">Id</label><input type="text" id="userId" name="userId"/><br>
<input type="submit" value="Submit"/>
</form>
<div id="main_block"></div>
 </div>
</body>

Thanks

EDIT
This post has been reformatted by enclosing the code block in 3 backticks
```
on their own lines.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.