use bean property value

<%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.

Who is Participating?

Improve company productivity with a Business Account.Sign Up

knightEknightConnect With a Mentor Commented:
you'll have to use the setter on the bean object ... something like:

  Hashtable ht = new Hashtable();
  Bean someBean = new Bean();
you can't do it using the <jsp: tag ...
... you don't have to instantiate the bean the way I did above, but you will have to use the setter that way.
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

try this:

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


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

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.
simiAuthor Commented:

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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.