| Author |
JBoss/config/Collections
|
D. Clarke
Greenhorn
Joined: May 09, 2006
Posts: 25
|
|
<moved from EJB forum> I have an EAR file deployed under JBoss 4.0.2, running JDK1.5 on OS X. I am getting the following error from this line in my JSP: <html:select property="state" tabindex="14" > <html ption value="">Select</html ption> <html ptions collection="states" property="value" labelProperty="value"/> </html:select> where "state" is a collection in the session. Here is the error: javax.servlet.jsp.JspException: No getter method available for property value for bean under name states at org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:252) I have the struts-html.tld in the appropriate JAR file contained in the EAR. I also have the struts-1.1.jar file in both my deploy/lib/ and in the EAR file. The object that is being used to display is the ValueBean. I can't say I know what is causing this - the libraries appear to be there. The previous "html:text" instances are not throwing an error. This code was working before, but now that I am creating new EAR files, I wonder if its because of the proper libraries not getting picked up? thank you for any advice or pointers you can share with me.
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
where "state" is a collection in the session.
The name that the <html ptions> tag is looking for is "states" not "state. Also, this message is telling you that as Struts examines each element in the collection, it's not finding a getValue() method on the individual element. Make sure that the object you're putting in the collection has a getValue() method. [ October 30, 2006: Message edited by: Merrill Higginson ]
|
Merrill
Consultant, Sima Solutions
|
 |
D. Clarke
Greenhorn
Joined: May 09, 2006
Posts: 25
|
|
I think this is a deployment issue, because this code is currently working in production (I have inherited it). I have this code that builds it: EnrollHelper getCoveredStateList() { List stateCoverage = new ArrayList(51); ... stateCoverage.add( new ValueBean( stateCode, stateName)); return stateCoverage; } this are set via the JSP: pageContext.setAttribute("states", EnrollHelper.getCoveredStateList()); Unfortunately, it would appear the original code uses it's own ValueBean (basic bean). I can only assume it was done this way because the application pre-dates ValueBeans. However, this ValueBean class is definately in the jar. Because I am now deploying to a single application server (JBoss) instead of JBoss and Tomcat - could that be an issue? the jar file is in the EAR and I wonder if it could be classloading.
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
I suspect you're on the right track with this being a classpath or classLoader issue. This error would occur if there were two classes of the same name in the classpath, and one of them does not have a getValue() method. I don't really have a solution to suggest, though, other than changing what's in the shared classpath and what's in the WAR file's WEB-INF/lib directory. There may also be some classpath configuration settings within JBOSS that you can adjust.
|
 |
D. Clarke
Greenhorn
Joined: May 09, 2006
Posts: 25
|
|
I am pretty sure it has to be a classloader issue. I tested this by replacing the customer ValueBean with Apache LabelValueBean. When I did this, my dropdown and other properties on the JSP's worked properly. So I started to just do a global replace until I ran into this: ArrayList valList = new ArrayList(); ValueBean val = new ValueBean("Some display text"); val.setValue(0, DBUtil.formatBigDecimalAsCurrency(current.getPremium())); val.setValue(1, DBUtil.formatBigDecimalAsCurrency(renew.getPremium())); val.setValue(2, DBUtil.formatBigDecimalAsCurrency(alternate.getPremium())); valList.add(val); then I realized that the ValueBean isn't a one-one matching because it holds a list of values. So, unless I want to do a major refactor of some existing code (that works great in production) I need to find out how to get everyone to use this class. Now I am back to my original problem of how to get my JSP's to use the ValueBean that is in the jar. Here is my jboss EAR struture: product.ear -default.jar <- where the ValueBean class is -default.war <-Webapp that uses ValueBean -admin.war <-Webapp that uses ValueBean - someEJB.jar - jakarta-oro.2.0.6.jar - commons-validator.1.0.1 - struts-1.1.jar I am deploying to jboss4.0.2/server/default/deploy/ and I just don't understand why this class file can't be seen by the JSP, or is getting confused with another. Hope that made sense, I know I am certainly confused
|
 |
 |
|
|
subject: JBoss/config/Collections
|
|
|