1) Thank you. I missed that when I made this simpler bean to test. (the
change had no effect though - still not output).

2) Yes I fixed the beans setter to String. (I've tried this with and
without a managed property - same result)

3) Yes. There is none. The original bean used an SQL Query. I just
wanted to see if a simple bean would instantiate. 

4) Yes. That's what I expected.

5) No exceptions (although changes in the layout do change the output -
so it's not a caching or the lack of seeing my changes).

6) Are you saying put the 400 on the first or second gridLayout (I put
it on the 2nd and now I don't see the tables headers even).

Thanks for helping with this...

John



-----Original Message-----
From: Volker Weber [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 25, 2006 4:14 AM
To: MyFaces Discussion
Subject: Re: Managed beans not being instantiated

Hi John,

there are some problems in your example code:

1. your bean has no setter for property hithere!
   public void setHithere() {...} is no valid setter. You need a arg (of
type String in this case).

2. I think your managed-property declaration can't be right.
   You have a declared property with name hithere of type
com.jak.EMP.QuarantineBean with value String?
   But your bean has no setter for hithere neither for String nor for
com.jak.EMP.QuarantineBean.

3. I can't see any initialisation for property testData. If not
initialized you will get is a sheet with no rows.

4. the return type of getTestData() (the value of the sheet) is
String[]! So while rendering the rows the var bean 'quar' will contain a
single string. There are no properteis like 'sender', 'recipient' ... on
String.

If you realy run this code, with properly initialzed testData, you
*must* have a lot of Exceptions in the log files.

If you run this code without initialzed testData, but fixed managed bean
declaration you should have a text ("Hello out there") and a box with a
empty sheet (5 columns but no rows) rendered.


BTW: the height attribute (on the box) takes precedence over the layout
constraint '3*', but is not considered on layout calculation. If you
want to have the box 400px height you should set this in the rows
declaration: <t:gridLayout rows="2*;400px"/> and not in the box.

Regards,
  Volker

John wrote:
> ---JSP PAGE - WORKS FINE ACCEPT BEAN DATA--- AT THIS POINT ONLY 
> testdata should work----
>  
> <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> uri="http://www.atanion.com/tobago/component"; prefix="t"%> <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]> uri="http://java.sun.com/jsf/core"; prefix="f"%> 
> <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> tagdir="/WEB-INF/tags/layout" 
> prefix="layout"%> <layout:main>
>   <jsp:body>
>     <t:panel>
>       <f:facet name="layout">
>         <t:gridLayout rows="2*;3*"/>
>       </f:facet>
>       <t:out value="#{quarantine.hithere}">      </t:out>
>       <t:box label="Box" height="400px">
>         <f:facet name="layout">
>           <t:gridLayout/>
>         </f:facet>
>         <t:sheet
>           value="#{quarantine.testData}"
>           id="sheet"
>           columns="3*;1*;3*;3*;3*"
>           var="quar"
>           state="1"
>           showRowRange="left"
>           showPageRange="right"
>           showDirectLinks="center"
>           pagingLength="7"
>           directLinkCount="5">
>           <t:column label="From" id="name" sortable="true">
>             <t:out value="#{quar.sender}" id="t_sender"/>
>           </t:column>
>           <t:column label="To" id="number" sortable="false"
align="center">
>             <t:out value="#{quar.recipient}" id="t_recipient"/>
>           </t:column>
>           <t:column label="Subject" sortable="true">
>             <t:out value="#{quar.subject}" id="t_subject"/>
>           </t:column>
>           <t:column label="Matched" sortable="true">
>             <t:out value="#{quar.matchtext}" id="t_matchtext"/>
>           </t:column>
>           <t:column label="Filtered" sortable="true" align="right">
>             <t:out value="#{quar.filteredby}" id="t_filteredby"/>
>           </t:column>
>         </t:sheet>
>       </t:box>
>     </t:panel>
>   </jsp:body>
> </layout:main>
>  
> --- MANAGED BEAN ---- THIS IS JUST A SIMPLE TEST BEAN --- package 
> com.jak.EMP;
>  
> public class QuarantineBean {
>   private boolean initialized;
>   private String[] testData;
>   private String hithere;
>  
>   public QuarantineBean() {
>   }
>  
>   public void setInitialized(boolean initialized) {
>     this.initialized = initialized;
>   }
>  
>   public void setTestData(String[] testData) {
>     this.testData = testData;
>   }
>  
>   public boolean isInitialized() {
>     return initialized;
>   }
>  
>   public String[] getTestData() {
>     System.out.println("called getTestData");
>     return testData;
>   }
>   public String getHithere() {
>     return "Hello out there";
>   }
>   public void setHithere() {
>     this.hithere = "Hello out there 1";
>    
>   }
> }
>  
> ---- FACES-CONFIG--- I KNOW Managed Property not necessary --- <?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 xmlns="http://java.sun.com/JSF/Configuration";>
>   <application>
>     <locale-config>
>       <default-locale>en</default-locale>
>     </locale-config>
>   </application>
>   <managed-bean>
>     <managed-bean-name>quarantine</managed-bean-name>
>
<managed-bean-class>com.jak.EMP.QuarantineBean</managed-bean-class>
>     <managed-bean-scope>request</managed-bean-scope>
>     <managed-property>
>       <property-name>hithere</property-name>
>       <property-class>com.jak.EMP.QuarantineBean</property-class>
>       <value>defaultValue</value>
>     </managed-property>
>   </managed-bean>
> </faces-config>
>  
> 
> ----------------------------------------------------------------------
> --
> *From:* Grant Smith [mailto:[EMAIL PROTECTED]
> *Sent:* Tuesday, January 24, 2006 4:57 PM
> *To:* MyFaces Discussion
> *Subject:* Re: Managed beans not being instantiated
> 
> John,
> 
> Show us the page source, as well as your web.xml and faces config. At 
> least then we have a starting point :)
> 
> On 1/24/06, *Dennis Byrne* < [EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
> 
>     Make sure you don't have two managed beans with the same name.
The
>     second one will be configured over the first.  Both MyFaces and
the
>     RI do this :(
> 
>     Dennis Byrne
> 
>     >-----Original Message-----
>     >From: John [mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>]
>     >Sent: Tuesday, January 24, 2006 07:26 PM
>     >To: [email protected] <mailto:[email protected]>
>     >Subject: Managed beans not being instantiated
>     >
>     >I'm having incredible difficulty getting a managed bean to be
>     >instantiated.
>     >
>     >-- I've gone to a very simple JavaBean for testing.
>     >
>     >-- The managed bean XML is in faces-config.xml
>     >
>     >-- I'm using Tobago
>     >
>     >-- I'm using Tomcat 5.9 embedded within our application.
>     >
>     >The beans constructor never gets called, although the JSF page
displays
>     >fine (except of course the beans values aren't displayed).
>     >
>     >No errors.
>     >
>     >
>     >I'm stumped.
>     >
>     >John
>     >
> 
> 
> 
> 
> 
> --
> Grant Smith

--
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by concatenating my
forename to my senders domain.

Reply via email to