Share on Google+Share on Google+

William Wood

2 Answer(s)      9 years ago
Posted in : JSP-Servlet
View Answers

August 28, 2008 at 6:06 PM

Hi friend,

i am sending simple program.

<title>Insert data in database using JSTL</title>
<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

<input type=submit name="submit" value="Submit">



<%@ taglib prefix="c" uri="";; %>
<%@ taglib uri="";; prefix="sql" %>

<sql:setDataSource var="db" driver="jdbc:mysql://";; 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}')">
<c:out value="record added"/>

<c:forEach var="row" tems="${query1.rows}" >
<c:set var="n" value="OK" />
<td> <c:out value="${}" /></td>
<td> <c:out value="${}" /></td>
<c:if test="${n != 'OK'}" >
<c:out value="No such Records" />


Read for more information.


August 28, 2008 at 9:32 PM

Dude thanks for the help. You have just recreated all my code. Good job. I knew how to do all that but when I get all that data brought back to the screen in a tabular column I want to choose a row and send that info to another program then after done come back to this calling page with the proper row I was on. Dont know how to put that row into the <c:forEach> statement. If your willing to help I will make an example table and system to display the data and show you what I mean. It will take me a short time to do so though. Just let me know. Thanks for the try.
v/r Bill


Related Tutorials/Questions & Answers:


Advertisement null