Hi,
I am new with JSP so i want to know how to use SQL syntax in jsp?
I want to connect with the sql database & fetch output.
this is my query
Code:"SELECT employee FROM email WHERE employee like '%"+newUserID+"%'"
Hi,
I am new with JSP so i want to know how to use SQL syntax in jsp?
I want to connect with the sql database & fetch output.
this is my query
Code:"SELECT employee FROM email WHERE employee like '%"+newUserID+"%'"
I hope you have put exception in your code.
Please use exception handling feature provided by JVM so you will come to know the exact problem with your code.
Syntax of JSP Declaratives is:
<%!
//java codes
%>
JSP Declaratives begins with <%! and ends with %>
try this code.
Code:<sql:setDataSource var="variable" driver="oracle.jdbc.driver.OracleDriver" user="a" password="b" <sql:query var="jack"> SELECT * FROM mytable </sql:query> <%-- Get the column names for the header of the table --%> <c:forEach var="columnName" items="${jack.columnNames}"> <th><c:out value="${columnName}"/></th> </c:forEach> <%-- Get the value of each column while iterating over rows --%> <c:forEach var="row" items="${jack.rows}"> <tr> <c:forEach var="column" items="${row}"> <td><c:out value="${column.value}"/></td> </c:forEach> </tr> </c:forEach> />
You must always put your business logic in JAVA classes & call these classes from jsp.
Even if you put your SQL statements in JSP it will be hidden from the client & the client will only see the html code.
Bookmarks