[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 268
  • Last Modified:

use bean property value

Hi,
<%Hashtable ht = new Hashtable()%>
 <jsp:setProperty name="someBean" property="someProperty" value=ht>

A bean can have properties that are of tipe String.
Say I have a someProperty that is a Hashtable.
How/if, can I use the setProperty to set that property, something like the example from above.

Thanks.
0
simi
Asked:
simi
  • 3
  • 2
1 Solution
 
knightEknightCommented:
you can't do it using the <jsp: tag ...
0
 
knightEknightCommented:
you'll have to use the setter on the bean object ... something like:

<%
  Hashtable ht = new Hashtable();
  Bean someBean = new Bean();
  someBean.setSomeProperty(ht);
<%
0
 
knightEknightCommented:
... you don't have to instantiate the bean the way I did above, but you will have to use the setter that way.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
cheekycjCommented:
try this:

<jsp:setProperty name="someBean" property="someProperty" value=<%=ht%>/>

or

<jsp:setProperty name="someBean" property="someProperty" value=<%ht%>/>

CJ
0
 
cheekycjCommented:
property="propertyName" value="{string | <%= expression %>}"

Sets one bean property to a specific value. The value can be a String or an expression that is evaluated at runtime. If the value is a String, it is converted to the bean property's data type according to the conversion rules shown above in TABLE 1. If it is an expression, its value must have a data type that matches the the data type of the value of the expression must match the data type of the bean property.


If the parameter has an empty or null value, the corresponding bean property is not set. You cannot use both the param and value attributes in a <jsp:setProperty> element.
0
 
simiAuthor Commented:
Thanks.

Chee your solution does not work. I tried it prior to asking the question and it results in an error message asking for quotes arround the parameter value.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now