El mié, 17 de 05 de 2006 a las 17:19, David G. Friedman escribió:

> Jorge,
> 
> 1. I believe Struts PlugIns were initially created because, at the time, the 
> servlet spec didn't have ServletContextListeners.  So, why are you mixing the 
> two instead of just using a ServletContextListener?

i didn't know that. At the beginning, my app was coded without struts
using a servlerContextListener. Then when i decided the migration to
struts i supose the PlugIn was the best choice.

> 
> 2. Did you define the PlugIn in your struts-config.xml (or similar file that 
> you are sure is loading?

of course.

[...]
    <plug-in className="com.defactops.smartcvweb.struts.plugin.StartupPlugin">
        <set-property 
                property="serviceClass" 
                value="com.defactops.smartcvweb.service.SmartcvwebServiceImpl"/>
    </plug-in>
[...]

> 
> 3. Have you done a simple logging in your PlugIn to ensure the plugIn is 
> loaded?

i have used a property of the ApplicationContainer, the ServiceFactory.
Works perfect.

public class BaseAction extends Action {

[...]
        /**
         * Obtiene el contenedor de aplicacion
         * @return
         */
        protected ApplicationContainer getApplicationContainer() {
                return 
(ApplicationContainer)servlet.getServletContext().getAttribute(
                                IConstants.APPLICATION_CONTAINER_KEY);
        }
        
        
        /**
         * Obtiene el servicio
         * 
         * @return
         * @throws SmartcvwebServiceException
         */
        protected ISmartcvwebService getSmartcvwebService() 
                throws SmartcvwebServiceException {
                
                ISmartcvwebService service = null;
                
                try {
                        service = 
getApplicationContainer().getServiceFactory().createService();
                } catch (Exception e) {
                        throw new SmartcvwebServiceException(e);
                }
                
                return service;
        }
[...]

> 4. Have you done a simple logging in your JSP to ensure that the main object, 
> __APPLICATION_CONTAINER_KEY can be found?

I have test it and the jsp resturns 27


<%=((com.defactops.smartcvweb.struts.util.ApplicationContainer)application.getAttribute("__APPLICATION_CONTAINER_KEY")).getArea().size()%>



> 
> 5. Have you tried to find the object saved under the key 
> "__APPLICATION_CONTAINER_KEY" inside an action to be sure you can reach it 
> normallly?

look at answer 3

> 
> 6. Are you using Action 1 or Action to and what specific version?

i use "classic" struts 1.2.9 with action 1

> 



David, thank you for response


> Regards,
> David
> 
> -----Original Message-----
> From: Jorge Martín Cuervo [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, May 17, 2006 5:05 AM
> To: Struts Users Mailing List
> Subject: Re: Cannot find bean under name
> __APPLICATION_CONTAINER_KEY.area
> 
> 
> anyone have used a container to store application scope data?
> 
> please, let me know if it's a bad practice.
> 
> El mar, 16 de 05 de 2006 a las 17:15, Jorge Martín Cuervo escribió:
> 
> > Hi all,
> > 
> > <h2><fmt:message key="search2.filter.job.title"/></h2>
> > <p class="pEstrecho">
> >     <span><fmt:message key="search2.filter.job.sector"/></span>
> >     <html:select property="industryCode" styleClass="selectAncho">
> >             <html:options collection="industryCodeMap"
> >                   property="key" labelProperty="value"/>
> >     </html:select>
> > </p>
> > 
> > I use html:select with html:options to populate the options from the
> > application scope.
> > In the application scope i have a attribute called "industryCodeMap"
> > with a Map that contains the data.
> > I used a ServletContextListener to load the data on the webapp startup
> > and goes fine.
> > 
> > Now i want to change the startup process with struts plugin, and also
> > works good with the service.
> > 
> > [...]
> > public void init(ActionServlet servlet, ModuleConfig config) throws
> > ServletException {
> >             
> >     serviceClassName = findServiceClassName(config);
> >             
> >     ItemDAO itemDAO = DAOFactory.getDAOFactory().getItemDAO();
> > 
> >     ApplicationContainer container = new ApplicationContainer();
> >             
> >     container.setSector(itemDAO.getItems(IConstants.SECTOR_BLOCK_NAME));
> >     container.setArea(itemDAO.getItems(IConstants.AREA_BLOCK_NAME));
> >     
> > container.setCoutries(itemDAO.getItems(IConstants.COUNTRIES_BLOCK_NAME));
> >             
> >     container.setServiceFactory(this);
> >             
> >     servlet.getServletContext().setAttribute(
> >             IConstants.APPLICATION_CONTAINER_KEY, container);
> > }
> > [...]
> > public interface IConstants {
> > 
> >     String APPLICATION_CONTAINER_KEY = "__APPLICATION_CONTAINER_KEY";
> > 
> > [...]
> > 
> > 
> > I prefer to user a container bean to keep my data, and now i try to
> > change the html:options to:
> > 
> > <html:options collection="__APPLICATION_CONTAINER_KEY.area"
> >                   property="key" labelProperty="value"/>
> > and crash with:
> > 
> > 
> > javax.servlet.jsp.JspException: Cannot find bean under name
> > __APPLICATION_CONTAINER_KEY.area
> > 
> > 
> > the questionm is, how can i access to the container and then the
> > property area?

-- 
;-)
____________________________________
Jorge Martin Cuervo
Analista Programador

Outsourcing Emarketplace
deFacto Powered by Standards

email <[EMAIL PROTECTED]>
voz +34 985 129 820
voz +34 660 026 384
____________________________________

Reply via email to