I accessed the bean from the servlet

HttpSession session = request.getSession(true);
FileList fl = (FileList) session.getAttribute("fileList");

but it returns null so I put this before calling the imageServlet
<h:outputText value="" rendered="#{fileList.b}"/> and the bean gets
instantiated.  Is there another way of doing this ?

..kace



kace wrote:
> 
> Hey, I never realised my post got throught; came back as not being
> accepted so I ended up deleting it.  
> 
> Anyway, it was a servlet but I changed it to a pojo now so I can access
> jsf beans.  
> 
> Out of curiousity how would I go about accessing a bean from a servlet.
> 
> ..kace
> 
> 
> 
> Matt Raible-3 wrote:
>> 
>> Is your ImageServlet a servlet or a POJO? Is fileManager a bean  
>> defined in your Spring context files.
>> 
>> Matt
>> 
>> On Oct 26, 2007, at 8:53 AM, kace wrote:
>> 
>>>
>>> Hi guys ive got a bean imageServlet which dishes out images
>>>
>>> managed bean looks like:
>>> <managed-bean>
>>>             <managed-bean-name>imageServlet</managed-bean-name>
>>>
>>> <managed-bean- 
>>> class>com.mobileanarchy.gym.webapp.action.ImageServlet</managed- 
>>> bean-class>
>>>             <managed-bean-scope>session</managed-bean-scope>
>>>             <managed-property>
>>>                 <property-name>fileManager</property-name>
>>>                 <value>#{fileManager}</value>
>>>             </managed-property>
>>> </managed-bean>
>>>
>>> and I am setting the fileManager in imageServlet :
>>>
>>>  private FileManager fileManager;
>>>
>>>     public void setFileManager(FileManager fileManager) {
>>>         this.fileManager = fileManager;
>>>     }
>>>
>>> but at this line imageFile = fileManager.getFile(1L); its giving me  
>>> a null
>>> pointer exception.
>>>
>>> Where am i going wrong - if i call this line from any of the other  
>>> beans it
>>> works but here it gives me problems.  Am i missing something here?
>>>
>>> Appreciate any insight.
>>>
>>> ..kace
>>>
>>> -- 
>>> View this message in context: http://www.nabble.com/null-pointer- 
>>> exception-%21%21-tf4697752s2369.html#a13428694
>>> Sent from the AppFuse - User mailing list archive at Nabble.com.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Re%3A-null-pointer-exception-%21%21-tf4698401s2369.html#a13446835
Sent from the AppFuse - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to