Mark, 
 
The bean (I believed) is created. Because, using the toString() method
that I overwrite in the bean and found that it shows information as I
predicted.
 
Here are the code snippets .. 
 
Pls help
 
 
Code to init the digester
 
private void initDigester() throws ServletException {
        
        sites = new Sites();        
        FileInputStream fis = null;
        BufferedInputStream bis = null;
        String realPath = null;
        
        try{
            //if(log.isDebugEnabled()) {
                log.info("loading einout-config from '" + pathname +
"'");
            //}
            realPath = calculatePath(pathname);
            fis = new FileInputStream(realPath);
            bis = new BufferedInputStream(fis);
                        
            //Construct a digester to use for parsing
            Digester digester = new Digester();
            digester.push(this);        
            digester.setValidating(false);        
            //rule to create instance of Site class for site data
            digester.addFactoryCreate("einout-config/sites/site", 
                                        new SiteCreationFactory(sites));
            digester.parse(bis);
            bis.close();
            bis = null;
            fis = null;            
        }
        catch(Exception e) {
            log.error("Loading einout-config from '" + pathname + "'
:'", e);
            throw new ServletException("Loading einout-config error" +
e.getMessage());
        }
        finally{
            if(bis != null){
                try{
                    bis.close();
                }
                catch(Throwable t){
                    ;
                }
                bis = null;
                fis = null;
            }
        }              
                
    } 
 
class to create the bean
 
class SiteCreationFactory implements ObjectCreationFactory{
    
    private Sites sites = null;
    private Digester digester = null;
    
    public SiteCreationFactory(Sites sites){
        this.sites = sites;
    }
    
    public Digester getDigester(){
        return (this.digester);
    }
    public void setDigester(Digester digester){
        this.digester = digester;
    }
    
    public Object createObject(Attributes attributes){        
        Site site = new Site();                
        site.setName(attributes.getValue("name"));
 
site.setConnectionPoolName(attributes.getValue("connectionPoolName"));
        site.setSelected(attributes.getValue("selected"));
        sites.addSite(site);
        return(site);
    }
}
 
to store in servlet context I used the following line
 
servlet.getServletContext().setAttribute(Constant.SITES_KEY,sites);
 
when I try to get from JSP page the bean .. it failed.
 
<bean:define id="sites" name="<%= Constant.SITES_KEY %>"
scope="application" property="sites"/>    
  <logic:iterate name="sites" property="sites"
type="my.com.shinyang.einout.Site" id="site">    
    <tr>
        <td width="16%"></td>
        <td width="84%" colspan="3">
            <html:checkbox name="site" property="site.selected"
value="yes" > 
            <bean:write name="site" property="site.name"/>        
        </td>
    </tr>    
  </logic:iterate>
 
 
The Sites bean is a wrapper of Site bean. Inside the Sites bean I have a
HashMap to store all site beans. And there is a getter method to return
an array of Site.
 
Pls help 
 
Thanks
 
Step
 
 
 
-----Original Message-----
From: Galbreath, Mark [mailto:[EMAIL PROTECTED]] 
Sent: 03 June 2002 20:39
To: 'Struts Users Mailing List'
Subject: RE: Need Help!!! Pls
 
Much better!  It appears obvious that the bean you are attempting to
create
from rendering the XML through Digester is either not being created or
is
not being set in scope properly.  Can you post that/those particular
section(s) of code?
 
Mark
 
-----Original Message-----
From: Stephen [mailto:[EMAIL PROTECTED]]
Sent: Sunday, June 02, 2002 4:42 AM
To: Struts Users Mailing List
Subject: Re: Need Help!!! Pls
 
 
Hi Mark!
 
Thanks for your suggestion to read the how to ask smart question!!
 
Indeed, this is the first time i submit question to this user-group and
don't really know to what extend i should elaborate on the problems.
 
The things i try to do is:
 
1. I have a class that extends struts PlugIn, in this class i initialize
the
data source ( stored in JNDI filesystem context) and connection pooling
(store in servlet context) , and use Digester to read an XML file to
create
javabean object and store the objects in servlet context.
 
2. Now in the JSP input page, i want some of the fields to be populated
with
information that was previously store in servlet context. It is an array
of
javabean.  in the JSP page i use the logic:iterate tag to populate the
page.
To do this i created the ActionForm and action class
The client will point to the action class, in the excute method it will
set
the action form with the array object take from servlet context then
forward
to the jsp page.... eveytime when it run, the below exception will be
threw..  roughly this is the scenario and where i stuck...
 
hear from you all.......thx
 
Step
 
 
----- Original Message -----
From: "Galbreath, Mark" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Friday, May 31, 2002 3:45 AM
Subject: RE: Need Help!!! Pls
 
 
> Yes, there are a number of people here who can help.  No, we cannot
suggest
> a better way of doing what you are trying to do because you have not
given
> us the slightest hint of how you are trying to accomplish your
pre-visit
> form population.  I suspect that you are relying on Struts to
magically
> populate a JavaBean which in turn would populate the field(s) of an
HTML
> form prior to a client accessing the form.  Doesn't work that way.
The
> Struts "plugin" (I assume you mean the action class) must be activated
by
a
> client request.  If you want a form to be dynamically populated with
data
> prior to a client reaching it, the client must first request something
else
> (HTML, JSP or action class) that triggers the action class to populate
the
> bean (by calling a DAO, VO, or other helper class that actually makes
the
> database calls).  You could redirect to the action if you wanted to
hide
> your implementation by the use of HTML meta refresh to trigger the
action
> (<meta http-equiv='refresh' content='0; url=/do/myActionClass'>) or
the <%
> jsp:forward %> tag, and the results would be displayed based on your
forward
> path in struts-config.
>
> You should also read:
> http://www.tuxedo.org/~esr/faqs/smart-questions.html
>
> Cheers (it's Friday)!
> Mark
>
> -----Original Message-----
> From: Shinyang [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 31, 2002 2:31 AM
> To: [EMAIL PROTECTED]
> Subject: Need Help!!! Pls
>
>
> Hi,
>
> I am struts newbie!
>
> I develop an application to search a database. I have some problems
that
> I fail to solve, before even connect to db.
>
> I do a search form. Before display the form, I need to populate some
of
> the fields with java bean get from servlet context. The java bean in
the
> servlet context was set through the struts plug-in.
>
> Now, I try to set the searchForm from searchAction, before display the
> search.jsp page, but every time failed. The following exception
throws:
>
> Can anyone help!! Or recommend better approach to do this things. thx.
>
> javax.servlet.ServletException: No collection found
>         at
>
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContex
> tImpl.java:463)
>         at
> org.apache.jsp.searchRFQ$jsp._jspService(searchRFQ$jsp.java:553)
>         at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
>         at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
>
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServle
> t.java:202)
>         at
>
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
>         at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
>         at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
>
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatc
> her.java:683)
>         at
>
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDisp
> atcher.java:431)
>         at
>
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispat
> cher.java:355)
>         at
>
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.jav
> a:972)
>         at
>
org.apache.struts.action.RequestProcessor.processValidate(RequestProcess
> or.java:947)
>         at
>
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
> 245)
>         at
>
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1109)
>         at
> org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:452)
>         at
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
>         at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
> tionFilterChain.java:247)
>         at
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
> erChain.java:193)
>         at
>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
> e.java:243)
>         at
>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
> va:566)
>         at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
> 72)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>         at
>
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
> e.java:190)
>         at
>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
> va:566)
>         at
>
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.ja
> va:246)
>         at
>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
> va:564)
>         at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
> 72)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>         at
>
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:234
> 3)
>         at
>
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
> :180)
>         at
>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
> va:566)
>         at
>
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa
> lve.java:170)
>         at
>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
> va:564)
>         at
>
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
> :170)
>         at
>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
> va:564)
>         at
>
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468
> )
>         at
>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
> va:564)
>         at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
> 72)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>         at
>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
> java:174)
>         at
>
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja
> va:566)
>         at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
> 72)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
>         at
>
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.j
> ava:1012)
>         at
>
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:
> 1107)
>         at java.lang.Thread.run(Thread.java:536)
>
> Can you Java Guru out there.. pls help
>
> Step
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
 
 
 
--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
 
--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


Reply via email to