This content has been marked as final.
Show 6 replies
-
1. Re: a4j:mediaOutput and Spring beans
nbelaevski Nov 3, 2008 7:09 PM (in response to olibutzki)Lobster,
createContent is not a property that can have getter but method that accepts two parameters: OutputStream and Object. Can you please post page/bean code? -
2. Re: a4j:mediaOutput and Spring beans
olibutzki Nov 4, 2008 7:03 AM (in response to olibutzki)"nbelaevski" wrote:
Lobster,
createContent is not a property that can have getter but method that accepts two parameters: OutputStream and Object. Can you please post page/bean code?
Yes, I can:
Bean definition:<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id="PaintBean" class="com.package.PaintBean"/> </beans>
The bean itself:public class PaintBean { private int tileWidth; private int tileHeight; private ImageData[] imageData; public void paint(OutputStream out, Object data) throws IOException { // ... } // getters and setters }
Usage in jspx-File<a4j:repeat value="#{paintBean.imageData}" var="imageTile"> <a4j:outputPanel layout="block" style="left: #{imageTile.left}px; top: #{imageTile.top}px; width: #{paintBean.tileWidth}px; height: #{paintBean.tileHeight}px"> <a4j:mediaOutput createContent="#{paintBean.paint}" element="img" mimeType="image/png" shape="rect" standby="loading..." value="#{imageTile}" /> </a4j:outputPanel> </a4j:repeat>
It results in this stacktrace:javax.faces.el.EvaluationException: /pages/views/main/richgraph.jspx @54,223 createContent="#{paintBean.paint}": Target Unreachable, identifier 'paintBean' resolved to null at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73) at org.ajax4jsf.resource.UserResource.send(UserResource.java:111) at org.ajax4jsf.resource.ResourceLifecycle.sendResource(ResourceLifecycle.java:223) at org.ajax4jsf.resource.ResourceLifecycle.send(ResourceLifecycle.java:148) at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:227) at org.ajax4jsf.resource.InternetResourceService.serviceResource(InternetResourceService.java:144) at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:265) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at de.bmiag.gear.frontend.FrontendFilter.doFilter(FrontendFilter.java:291) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:595)
If I use managed-beans, everything works fine.
Thanks for your help! -
3. Re: a4j:mediaOutput and Spring beans
nbelaevski Nov 4, 2008 9:14 AM (in response to olibutzki)Please describe how do you wire Spring with JSF.
-
4. Re: a4j:mediaOutput and Spring beans
olibutzki Nov 4, 2008 9:34 AM (in response to olibutzki)"nbelaevski" wrote:
Please describe how do you wire Spring with JSF.
Spring (web flow) is integrated in web.xml and faces-config.xml
web.xml<listener> <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> </listener> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener>
faces-config.xml<application> <navigation-handler>org.springframework.webflow.executor.jsf.FlowNavigationHandler</navigation-handler> <variable-resolver>org.springframework.webflow.executor.jsf.DelegatingFlowVariableResolver</variable-resolver> <variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver> </application> <lifecycle> <phase-listener>org.springframework.webflow.executor.jsf.FlowPhaseListener</phase-listener> </lifecycle>
-
5. Re: a4j:mediaOutput and Spring beans
olibutzki Nov 4, 2008 9:38 AM (in response to olibutzki)I forgot the reference to te Spring beans in web.xml
<context-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/webflow-config.xml /WEB-INF/beans/*.xml </param-value> </context-param>
and the myfaces listener:<listener> <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class> </listener>
-
6. Re: a4j:mediaOutput and Spring beans
mdiskin Jan 26, 2009 11:38 AM (in response to olibutzki)Did anyone find a way around this issue? I tried to use a standard managedbean for the paintBean (content) and pass the Spring bean as the value but this does not work.
Any alternatives?
Thanks in advance for any assistance.
Mark