| Author |
How to assign ${somevalue} to a bean using jsp:setproperty
|
Ravi Kumar
Greenhorn
Joined: Oct 15, 2007
Posts: 16
|
|
Hi, I'm trying to set a value to the bean. The value is from DB <sql:query var="items"> SELECT name FROM emp </sql:query> <c:forEach var="row" items="${items.rows}"> <jsp:useBean id="empName" class="test.emp"> <jsp:setProperty name="empName" property="empName" value="${row.name}"/> </jsp:useBean> The value that is setting is ${row.name}
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56192
|
|
You have a bean named empName and a property named empName. Bad idea. Very confusing and likely to lead to name collisions. Either use the JSTL or don't. There's no need to use <jsp:setProperty> if <c:set> is available.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Ravi Kumar
Greenhorn
Joined: Oct 15, 2007
Posts: 16
|
|
Thanks Bear, I used the following code <jsp:useBean id="chkBxNm" scope="session" class="TUnit.TUnitNmBean" /> <c:set target="${chkBxNm}" property="TSName" value="${row.TSName}" />
|
 |
 |
|
|
subject: How to assign ${somevalue} to a bean using jsp:setproperty
|
|
|