You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Prakash Inuganti -X (pinugant - Digital-X, Inc. at Cisco)" <pi...@cisco.com> on 2006/11/02 13:49:57 UTC
Cannot find bean countDetails in any scope
Hi,
I am a newbie to struts and trying to figure out a way to solve the
problem "Cannot find bean countDetails in any scope" I am getting when
trying to show an error when first option in select box is chosen. I
have an action class that reads data from database and populates in the
jsp. Then on this page, I have a select box and if user doesn't make a
selection, I should display an error. I am providing the classes, jsp
and struts-config.xml below
public class ExsHomeAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm
form,
HttpServletRequest request, HttpServletResponse
response)
throws Exception {
ExsStatesCount excnt = new ExsStatesCount();
HashMap counts = excnt.getStateCounts();
request.setAttribute("countDetails", counts);
return (mapping.findForward("home"));
}
EscHome.jsp
<bean:define id="counts" name="countDetails" property="Counts"/>
<html:html>
<html:form action="/ExsProduct">
<logic:greaterThan value="0" name="counts" property="draft">
<TR><TD><bean:message key="home.draft"/></TD><TD
align="right"><bean:write name="counts" property="draft"/></TD></TR>
</logic:greaterThan>
<html:select property="committype" tabindex="1">
<html:option value ="Select One">Select One</html:option>
<html:option value ="IB">IB</html:option>
<html:option value="RFPwPID">RFPwPID</html:option>
</html:select>
<html:errors />
<html:submit><bean:message key="home.submit"/></html:submit>
</html:form>
</html:html>
Struts-config.xml
<form-beans>
<form-bean name="exsHomeForm" type="xxx.request.ExsHomeForm"/>
<form-bean name="exsProductForm"
type="xxx.request.product.ExsProductForm"/>
</form-beans>
<global-forwards>
<forward name="/Home" path="/tiles/ExsHome.jsp"/>
</global-forwards>
<action-mappings>
<action path="/Home" type="xxx.request.ExsHomeAction"
scope="request" >
<forward name="home" path="exs.home"/>
</action>
<action path="/ExsProduct" name="exsProductForm"
type="xxx.request.product.ExsProductAction" scope="session"
input="/pages/home/EscHome.jsp">
<forward name="product" path="exs.product"/>
</action>
</action-mappings>
The home page displays properly when I try
http://localhost:8080/Support/Home.do. Now in the displayed form, If I
choose 'Select One' and click submit, I am trying to display error but
it throws error javax.servlet.ServletException: Cannot find bean
countDetails in any scope
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageCont
extImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContex
tImpl.java:758)
......
If I choose other options, I am able to proceed to next screen without
issue. Any help is greatly appreciated.
Thanks
Prakash