Hi,

I need to create dynamic table in jsp and submit data to the server. What is the best way to do this?
Anyone has sample code?

thanks in advance,
bvssn

Here is an example for the 1st part (creating a dynamic table) using JSP. You can only do this if you have the JSTL libraries. If you don't have them, you will need to use Java to generate the tags. Let us know if you need an example of that:

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"  %>

<!-- Quirk on -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<script language="Javascript" type="text/javascript" src="/ajax/ajaxLib.js">
</script> 

<script language="Javascript" type="text/javascript">

	function loadRpt() {
		loadXmlData("http://wfgsust.pp.iw.gm.com/darItem.jsp?time=" + new Date().getTime(),"itmFrame","nothing");		

	}
	
</script>


<html>
<body onLoad="loadRpt();">
	<% out.write( "Testing .." +  request.getHeader("cn")); %>
	<table>
	<c:forEach var="hdr" items="${headerValues}">
	<tr>
		<td><c:out value="${hdr.key}"/></td>
			<c:forEach var="val" items="${hdr.value}">
				<td><c:out value="${val}"/></td>
			</c:forEach>
	</tr>
	</c:forEach>
	<tr>
	<td>User ID:</td>	
	
	</tr>
	</table>
	<div id="tabFrame">
		<form name="tabForm" >
		Testing Ajax....
		<input name="myId" type="text" />
		<input type="button" value="Refresh" onclick="loadRpt();"/>
		</form>
	</div>
	
	<div id="itmFrame" style="height:500px; width:500px;">
		 
	</div>
	<!~-   -->
</body>
</html>

There are different ways to submit data. Do you want the users to fill out a form and submit that data?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.