Hi friend,
<html>
<head>
<title>Insert data in database using JSTL</title>
</head>
<table border="1" width="75%">
<body bgcolor=lightpink>
<table border="1" width="100%" callspacing="0" cellpadding="0">
<form method=post action="query.jsp">
<input type=text name='text1'>name<br>
<input type=text name='text2'>number<br>
<input type=text name='text3'>Position<br>
<select name=combo1>
<option value="add">add
<option value="delete">delete
</select>
<br>
<input type=submit name="submit" value="Submit">
</table>
</from>
</body>
</table>
</html>
------------------------------------------
<%@ taglib prefix="c" uri="
http://java.sun.com/jstl/core"; %>
<%@ taglib uri="
http://java.sun.com/jsp/jstl/sql"; prefix="sql" %>
<html>
<body>
<sql:setDataSource var="db" driver="jdbc:
mysql://192.168.10.211:3306/"; url="com.mysql.jdbc.Driver" />
<c:set var="a" value="${param.text1}" />
<c:set var="b" value="${param.text2}" />
<c:set var="c" value="${param.text3}" />
<c:set var="d" value="${param.combo1}" />
<c:if test="${d == 'add'}" >
<sql:update var="query1" dataSource="${db}" sql="insert into empdetail values${a}','${b}')">
</sql:update>
<c:out value="record added"/>
</c:if>
<c:forEach var="row" tems="${query1.rows}" >
<c:set var="n" value="OK" />
<tr>
<td> <c:out value="${row.name}" /></td>
<td> <c:out value="${row.place}" /></td>
</tr>
</c:forEach>
<c:if test="${n != 'OK'}" >
<c:out value="No such Records" />
</c:if>
</table>
</body>
</html>
---------------------------------------------
Read for more information.
http://www.roseindia.net/jsp/