use bean property value

Posted on 2002-04-26
Last Modified: 2010-04-01
<%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.

Question by:simi
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 33

Expert Comment

ID: 6971889
you can't do it using the <jsp: tag ...
LVL 33

Accepted Solution

knightEknight earned 50 total points
ID: 6971894
you'll have to use the setter on the bean object ... something like:

  Hashtable ht = new Hashtable();
  Bean someBean = new Bean();
LVL 33

Expert Comment

ID: 6971896
... you don't have to instantiate the bean the way I did above, but you will have to use the setter that way.
Technology Partners: 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!

LVL 19

Expert Comment

ID: 6972091
try this:

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


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

LVL 19

Expert Comment

ID: 6972098
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.

Author Comment

ID: 6972293

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.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let’s face it: one of the reasons your organization chose a SaaS solution (whether Microsoft Dynamics 365, Netsuite or SAP) is that it is subscription-based. The upkeep is done. Or so you think.
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question