having two depending controllers

Hello,

i have a new problem.

In my application I need two controllers.

One should be started automaticaly when the webserver comes up and an other for the session.

The Problem is:

Every Session-Controller should have an 'attribute' that is pointed to the ApplicationController. I tried:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE faces-config PUBLIC

"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"

"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">

<faces-config>

<managed-bean>

<managed-bean-name>jsfApplicationControl</managed-bean-name>

<managed-bean-class>com.oneclickse.JsfApplicationControl</managed-bean-class>

<managed-bean-scope>application</managed-bean-scope>

</managed-bean>

<managed-bean>

<managed-bean-name>JsfSessionFacade</managed-bean-name>

<managed-bean-class>com.oneclickse.JsfSessionFacade</managed-bean-class>

<managed-bean-scope>session</managed-bean-scope>

<map-entries>

<map-entry>

<key>jac</key>

<value-class>com.oneclickse.JsfApplicationControl</value-class>

<value>#{jsfApplicationControl}</value>

</map-entry>

</map-entries>

</managed-bean>

</faces-config>

My SessionController looks like:

publicclass JsfSessionFacade

{

private JsfApplicationControl jac;

private String teststring ="test";

public JsfSessionFacade()

{

if(this.jac != NULL)

{

teststring ="Success !";

}

else

{

teststring ="ERROR!";

}

}

public JsfApplicationControl getJac()

{

return jac;

}

publicvoid setJac(JsfApplicationControl jac)

{

this.jac = jac;

}

public String getTeststring()

{

return teststring;

}

publicvoid setTeststring(String teststring)

{

this.teststring = teststring;

}

}

when I start it I get an:

javax.servlet.ServletException: javax.servlet.jsp.JspException: javax.faces.FacesException: java.lang.ClassCastException: com.oneclickse.JsfSessionFacade

org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:842)

org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)

org.apache.jsp.index_jsp._jspService(index_jsp.java:175)

org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)

javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)

javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)

com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)

com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)

com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)

com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)

javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)

any ideas? Or is it not possible to 'mount' one controller to an other?

[4754 byte] By [Reddingoa] at [2007-11-27 7:33:02]
# 1

classcast was my give away. You are not using map-entries correctly. you need a managed property and then use the map entries and what you would set is a Map. To do what you want use this instead.

<managed-bean>

<managed-bean-name>JsfSessionFacade</managed-bean-name>

<managed-bean-class>

com.oneclickse.JsfSessionFacade

</managed-bean-class>

<managed-bean-scope>session</managed-bean-scope>

<managed-property>

<property-name>jac</property-name>

<property-class>

com.oneclickse.JsfApplicationControl

</property-class>

<value>#{jsfApplicationControl}</value>

</managed-property>

</managed-bean>

smurray_eriea at 2007-7-12 19:13:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Okay. This works :-)Thanks
Reddingoa at 2007-7-12 19:13:24 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...