Here's a pretty straight forward situation. I have a java bean "Report"(code pasted below). It has public static final String variables defined. I have defined the getter methods for the variables (public static methods returning string). All the variable name begin with a 'k' (don't beging with a capital letter, hence complies with Bean specification).
I get the following error when trying to view throug tomcat.
Can someone point out why this is happens.. (is it to do with static stuff by any chance.. ).
And if someone can give me the equivalent code using the struts tag lib (<bean:define> and <bean:write>) code too.. that would be really really great (nothing worked for me :( ).
org.apache.jasper.JasperException: Cannot find any information on property 'kDSStatusReport' in a bean of type 'com.nyse.mfr.fpmonitor.reports.Report'
The JSP CODE is
<%@ page language="java" import="com.nyse.mfr.fpmonitor.reports.Report"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<jsp:useBean id="reportDetails" class="com.nyse.mfr.fpmonitor.reports.Report" scope="session"/>
The value is : <jsp:getProperty name="reportDetails" property="kDSStatusReport" />
The JAVA CODE for BEAN Report is
public class Report
public static final String SESSION_ATTRIBUTE_STRING = "reportDetails";
/* Data Synchronization Reports */
public static final String kDSStatusReport = "DS1";
public static final String kDSSummaryReport = "DS2";
public static final String kDSMonthlyReport = "DS3";
public static final String REPORT_ID_REQUEST_STRING = "requestId";
public static String getKDSStatusReport()
public static String getKDSSummaryReport()
public static String getKDSMonthlyReport()
public static String getREPORT_ID_REQUEST_STRING()
Geez, I've forgotten some of that JSP stuff but maybe it doesn't like that your methods are static? I never tried that in a bean. Also, if those are public, static and final, why not just do something like:
The value is: <%= com.nyse.mfr.fpmonitor.reports.Report.kDSStatusReport %>
Just a thought.
Ya.. that's right.. Infact that's what I am using right now. But I somehow didn't find it good coding style. So..
And regarding the static stuff, why would it fail.. I don't think the bean spec. has any thing on it. But anyways.. thanks for you response, I appritiate it.