Hi all,
I have a
jsp form. The requirement is that it gets all the details from a
servlet and displays on the jsp form page. This has to be done for more than 100 users and it should be automatic. ALso all the information displayed in the text boxes should be submitted automatically to a servlet without any user intervension. How can this be done.
Actually I have got a jsp form to get the details for 10 users (for example) and I use meta-tag refresh and display the details.
The next part is I have the script
<script language="JavaScript" type="text/javascript">
//document.frmServeBetter.action = /test/ctrl?do=SUBMIT";// This should go to a servlet
document.frmServeBetter.submit();
</script>
at the bottom of the page, ie after the </form> tag.
But how can I integrate this?
But even when I dont have the meta tag refresh, all the 10 users are displayed and the loop wont stop. Please can you go thru my jsp code and let me know where I am wrong.
Thanks for the help.
JSP FILE
---------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Information</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<LINK href="/test/images/survey_StyleSheet.css" type=text/css rel=stylesheet>
<META content="Microsoft FrontPage 5.0" name=GENERATOR>
<!-- <meta http-equiv="refresh" content="5"> -->
<%@page import="java.lang.*"%>
<%@page import="java.util.*" %>
<%
String strCaller = new String(request.getRemoteHost());%>
<script>
function fnSubmit()
{
alert("Inside fnSubmit: ");
document.frmServeBetter.action = "/test/ctrl?do=SUBMIT";
document.frmServeBetter.submit();
}
</script>
</HEAD>
<BODY>
<form name="frmServeBetter" method="post" >
<%
HashMap objHashMap = new HashMap();
ArrayList objArrayList = new ArrayList();
//objHashMap = (HashMap)request.getAttribute("DETAILS");
objArrayList = (ArrayList)request.getAttribute("DETAILS");
%>
<%!
static int size = 10;
static int counter = 0;
static int counter1 = 0;
%>
<INPUT TYPE=hidden Name="Caller" value=strCaller>
<TABLE class=content borderColor=#FEE25B cellSpacing=0 cellPadding=0 width=700
border=1>
<TBODY>
<TR>
<TD vAlign=top align=middle height=353>
<table width="650" border="0" cellspacing="0" cellpadding="5">
<tr>
<td height="351" align="center" valign="top" bgcolor="#FFFced">
<TABLE cellSpacing=0 cellPadding=3 width=700 border=0>
<TBODY>
<TR>
<TD colspan="2" class=content><img src="/test/images/space.gif" width="5" height="8"></TD>
</TR>
<TR class=content>
<TD height=14 colspan="2"><img src="/test/images/space.gif" width="5" height="8"></TD>
</TR>
<%
while(counter < size)
{
objHashMap = (HashMap)objArrayList.get(counter);
%>
<TR>
<TD class=content height=25><font color="#FF0000">FirstName :</TD>
<TD> <INPUT class=field value = "<%=objHashMap.get("FIRSTNAME")%>" name="FirstName" size="20" ></TD>
<TR>
<TD class=content height=25><font color="#FF0000">LastName :</TD>
<TD> <INPUT class=field value = "<%=objHashMap.get("LASTNAME")%>" name="LastName" size="20"></TD>
</TR>
<TR>
<TD colspan="2"><img src="/test/images/space.gif" width="5" height="8"></TD>
</TR>
<TR>
<TD class=content><font color="#FF0000">EMail Address :</TD>
<TD> <INPUT class=field value = "<%=objHashMap.get("EMAIL")%>" name="EMailAddress" size="20"></TD>
</TR>
<%
counter ++;
%>
<%
break;
}//whileloop
%>
</TR>
<TR>
<TD class=content height=24><INPUT class="btn" type="Reset" value=Cancel name="B1"></TD>
</TR>
<TR>
<TD class=content colSpan=2 height=24> </TD>
</TR>
</TBODY>
</TABLE>
</td>
</tr>
</table></TD></TR></TBODY></TABLE>
<p> </p>
</form>
<script language="JavaScript" type="text/javascript">
//document.frmServeBetter.action = "/test/jsp/test1.jsp";
document.frmServeBetter.submit();
</script>
</BODY>
</HTML>
---------------------------------------------------------------
Thanks once again. If you didnt understand any part, please let me know.