I am trying to access the database and retrieve a attribute 'sno' from it. I have hidden the value in a input field using the following code.
<input type="hidden" value="<%= request.getParameter("well_name") %>" name="well_name" id="well_name">
The above code is put in some other page when the user submits, it is passed to next page and here I am trying to access the database like
<sql:setDataSource var="snapshot" driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/kn"
user="root" password="password"/>
<p><%= request.getParameter("well_name") %></p>
<sql:query dataSource="${snapshot}" var="result">
SELECT sno FROM well_name WHERE name = '<%= request.getParameter("well_name") %>' ;
</sql:query>
<c:forEach var="row" items="${result.rows}">
<p><c:out value="${row.sno}"/></p>
</c:forEach>
I am able to access the database when I provide a value which is defined like name = 'value'. I am not able to access like these please help me out.
Thanks in Advance.
Aucun commentaire:
Enregistrer un commentaire