Hi all. I'm new with jsp and i'm just looking for create a login solution.
I use a mysql database and what i'm looking for is what follows:
Make a query to my sql database and then insert the output of one field in a variable.
I need this variable to pass the "id" to a form ... maybe with this code i will explain better.
/* part of the page with sql query
<sql:setDataSource
url="jdbc:mysql://localhost/table"
driver="com.mysql.jdbc.Driver"
user="user"
password="password" />
<sql:query var="userdb" >
SELECT * FROM table WHERE etc etc...%>'
</sql:query>
And the query work... so I get what i need with the following:
<c:forEach items="${userdb.rows}" var="blogs" >
<tr>
<td> <c:out value="${blogs.title}" /> </td>
<td> <c:out value="${blogs.description}" /> </td>
<td> <c:out value="${blogs.surname}" /> </td>
<td> <c:out value="${blogs.email}" /> </td>
<td> <c:out value="${blogs.id_user}" /> </td>
</tr>
</c:forEach>
And so everythings works...
The problem is that the:
<td> <c:out value="${blogs.id_user}" /> </td>
contains an output that i want to forward to a page with a form so that I can get the form pre-filled with the id_user... I tried with:
<c:set var="id_user" value="${blogs.id_user}" />
...but when i go to the page that contain:
[...]
<input type="hidden" name="id_user" value="<% out.write(id_user); %>" />
[...]
nothing works and no variable is passed to the form... i get errors of course...
I don't know how to manage this variables from mysql to jsp, can somebody help me please?
I hope that what i wrote was not too confused!
Thanks to all!
Shella.