Solved

use bean property value

Posted on 2002-04-26
6
258 Views
Last Modified: 2010-04-01
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
Comment
Question by:simi
[X]
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
6 Comments
 
LVL 33

Expert Comment

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

Accepted Solution

by:
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();
  someBean.setSomeProperty(ht);
<%
0
 
LVL 33

Expert Comment

by:knightEknight
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.
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!

 
LVL 19

Expert Comment

by:cheekycj
ID: 6972091
try this:

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

or

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

CJ
0
 
LVL 19

Expert Comment

by:cheekycj
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.
0
 

Author Comment

by:simi
ID: 6972293
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!

Question has a verified solution.

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

Suggested Solutions

The world seems to conceive of a curious bubble separating IT from “the business.”  More so than just about any other pursuit in the commercial world, people think of IT as some kind of an island.
We have put together a white paper that aims to explain how MSPs can both improve their offering and ease the pain of after-hours service by: -Suggesting changes to workflow -Indicating how to rework policy to suit your team -Providing ConnectW…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

697 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