Once again you can use the sql tags available in the Standard tag library. You can populate a bean like this:
<sql:update var="newTable"> create table mytable ( nameid int primary key, name varchar(80) ) </sql:update> <sql:query var="resultSet"> SELECT * FROM mytable </sql:query> <c:forEach var="row" items="${resultSet.rowsByIndex}"> <jsp:useBean id="mybean" class="mybean" scope="request"/> <jsp:setProperty name="mybean" property="nameId" value="<%=row[0]%>"/> <jsp:setProperty name="mybean" property="name" value="<%=row[1]%>"/> </c:forEach> Justy ----- Original Message ----- From: "Soefara Redzuan" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, March 11, 2002 6:06 AM Subject: can output of dbtags query be used to fill javabean properties ? > Sorry I have another question. I have a form that sets the default values of > the fields with a javabean like this > > <jsp:useBean id="mybean" class="mybean" scope="request"> > > <form> > First name is <input type="text" name="firstname" > value="<%=mybean.getFirstname()%>"> > > Last name is <input type="text" name="lastname" > value="<%=mybean.getLastname()%>"> > </form> > > This fills default field values if the parameters are submitted in the > request otherwise it makes the fields blank "". > > But how can I set the values of the bean properties from the SQL result > returned from the dbtags query ? > > For example I would like to loop through the results of a sql:query and set > or create a javabean each time. > > <sql:statement id="stmt1" conn="conn1"> > <sql:query> > select * from members > </sql:query> > <%-- loop through the rows and create a bean each time --%> > <jsp:useBean id="resultbean" class="mybean"> > <sql:resultSet id="rset2"> > First name is <input type="text" name="firstname" > value="<%=resultbean.getFirstname()%>"> > Last name is <input type="text" name="lastname" > value="<%=resultbean.getLastname()%>"> > </sql:resultSet> > </sql:statement> > > Is something like this possible ? > > Thank you, Soefara > > _________________________________________________________________ > MSN Photos is the easiest way to share and print your photos: > http://photos.msn.com/support/worldwide.aspx > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>