Online Hibernate Training just in Rs. 1000

One week online training in Hibernate ORM framework. Learn Hibernate Framework and enhance your skills. Best Online Hibernate training at 90% discount. Join Now!! Offer is valid Only for limited Period!!! Online Training Big Data and Hadoop Training Java Training  

How to store values in a database using JSTL?



Share on Google+Share on Google+

How to store values in a database using JSTL?
1 Answer(s)      9 years ago
Posted in : JSP-Servlet
View Answers

May 29, 2008 at 7:49 PM

Hi friend,

<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.


Related Tutorials/Questions & Answers: