Shawn,
Thanks for clarifying the concept betwennt attribute and property.
Please read below for the problem.
>> But when I use ${agentHelper.blocks} where the "blocks" is not an
>> attribute, I get an error message as:
>>
>> An error occurred while evaluating custom action attribute "value"
>> with value "${agentHelper.blocks}": An error occurred while getting
>> property "blocks" from an instance of class ....
>>
>It means that no "blocks" property was found -- either that no getBlocks()
>method was found, the getBlocks() method was unsuitable for another reason
>(e.g., accepting an argument, or having a setBlocks() method that doesn't
>correspond to it in data type), or a BeanInfo overrides it.
There is a method. getBlocks() in the class without taking any argument, but not "set"
method. I don't see anything
wrong. Here is the related code:
public class MatchAgentHelper implements Serializable {
static private DBConnectionPool conn;
private String hostID;
private MatchAgentDAO dao;
private int count = 2;
private int start = 0;
/**
* Constructor for MatchAgentHelper.
*/
public MatchAgentHelper() {
super();
}
public MatchAgentHelper(DBConnectionPool conn) throws
MatchAgentDAOSysException{
if(this.conn == null)
this.conn = conn;
dao = new MatchAgentDAOImpl(conn);
}
public void setCount(String countString) {
this.count = (new Integer(countString)).intValue();
}
public void setStart(String startString) {
if (startString != null) {
this.start = (new Integer(startString)).intValue();
} else {
start = 0;
}
}
public void sethostID(String id) {
this.hostID = id;
}
public Page getBlocks() throws MatchAgentException {
return getBlocksFromDAO(hostID, start, count, "");
}
private Page getBlocksFromDAO(String Id, int start, int count, String
localeString)
throws MatchAgentException {
Locale locale = getLocaleFromString(localeString);
return dao.getBlocks(Id, start, count, locale);
}
private Locale getLocaleFromString(String localeString) {
//...
}
}
And the followings is the related JSP page code:
<%@ taglib prefix="c" uri="/WEB-INF/tlds/c.tld" %>
<%@ taglib prefix="fmt" uri="/WEB-INF/tlds/fmt.tld" %>
<jsp:useBean
id="agentHelper"
class="com.vernonwu.mm.web.client.MatchAgentHelper"
scope="session"
/>
<c:choose>
<c:when test="${param.count != null}">
<c:set value="${param.start}" target="${agentHelper}" property="start"/>
<c:set value="${param.count}" target="${agentHelper}" property="count"/>
</c:when>
<c:otherwise>
<c:set value="0" target="${agentHelper}" property="start"/>
<c:set value="2" target="${agentHelper}" property="count"/>
</c:otherwise>
</c:choose>
<c:set value="${param.id}" target="${agentHelper}" property="hostID"/>
<c:set value="${agentHelper.blocks}" var="pageResults" />
Thank for your help.
Vernon
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>