voyent
netbeans 6.5 + Visual Icefaces 1.8.1 init()  XML
Forum Index -> Tools
Author Message
garry.donnelly

Joined: 10/May/2009 00:00:00
Messages: 13
Offline


I've spent a lot of time trying to figure out this one.

I upgraded from the 1.7.2 Icefaces plug-in because of the selectoneradio (when layout=spread binding does not work properly) bug to the 1.8.1 Iceface plug-in.

Now the behavior of the managed page bean has changed. The init() method is only called when first navigating to the page. This method was supposed to be called every time the page was navigated to (including postbacks)

Can anyone help please explain this or provide a work around?
frank.ye

Joined: 26/Oct/2004 00:00:00
Messages: 709
Offline


please reference to:
http://www.icefaces.org/JForum/posts/list/12618.page
[Email]
garry.donnelly

Joined: 10/May/2009 00:00:00
Messages: 13
Offline


Hi Frank

I had previously stumbled across this thread but it offers no solution.

In that thread you wrote:


* init() - Called immediately after the view that this backing bean is associated with is created. (Technically, it happens when ViewManager.createView() is called.) For a postback, this happens during the Restore View phase of the request processing lifecycle, once it has been determined which view should be restored. If your application navigates from one page to another, the init() method of the second page will be called as part of the NavigationHandler.handleNavigation() processing.  


It is unclear from this whether there is an intentional change to the way this method is intended to work or if there is was misunderstanding as to its existing function.

This is how the method is supposed to function as defined in the com.sun.rave.web.ui.appbase.AbstractPageBean

Callback method that is called whenever a page is navigated to,
either directly via a URL, or indirectly via page navigation.
Override this method to acquire resources that will be needed
for event handlers and lifecycle methods, whether or not this
page is performing post back processing. 


Please note when using visual icefaces
com.icesoft.faces.standardRequestScope is false

As a result when the user navigates back to a page that has already been visited it will be display exactly as it did before navigating away.

init() was used to do any initialization of the page that may be required when viewing it for the first time OR returning to it after navigating away.


I will try to explain the importance of this functionality by example with 2 pages.

Page1
This page allows the user enter some search criteria for customers and displays the results in a table.

The user is then allowed to select a customer from the table, the customerId is stored in SessionBean1. Clicking the SHOW button will navigate to Page2


Page2
The init() method in Page2 uses the customerId in SessionBean1 to display the details of the customer.

The user can now return to Page1 with the NEW SEARCH button.

Page1
A new customer is selected from the table and SHOW is clicked again.
This time init() is not called and so the previous customers details are still displayed.



This is obviously a considerable problem when migrating from woodstock to icefaces. As previously alluded to init() is was supposed to be called every time the page was navigated to including postbacks (see com.sun.rave.web.ui.appbase.AbstractPageBean). This is no longer the case. If it is a bug, is there a bug-tracker i can view but if it is an intentional change can you please suggest another means to achieve previous functionality as I am probably not the only one dealing with this problem.

Thanks!

frank.ye

Joined: 26/Oct/2004 00:00:00
Messages: 709
Offline


Please clarify why need to navigate to another Page? Page1 should provide all the steps as you described.

ie, a stack of panel display Customer 1 or Customer the Yth etc ... and showing the corresponding panel instead.
[Email]
garry.donnelly

Joined: 10/May/2009 00:00:00
Messages: 13
Offline


Hi Frank

Thanks again for the swift response.

This project is a woodstock migration. Each page has its own responsibilities and roughly map to a database table. Are you saying I should migrate each page in Woodstock to a panel in Icefaces?

This still does not explain why the init method's functionality has changed when upgrading from netbeans icefaces plug-in 1.7.2 to 1.8.1



By way of a more complex example:


Database Tables:

Customer with customer_id column
Transaction with transaction_id and customer_id columns

Purchase with purchase_id and transaction_id columns
Payment with payment_id and transaction_id columns
Loan with loan_id and transaction_id columns
Bet with bet_id and transaction_id columns


SearchCustomersPage
used to search existing customers and display results in a table.
Selected customer_id is stored in attribute customerID in SessionBean1 (a session scope bean) or set as null if NEW CUSTOMER button is pressed
init()
Used to clear the search parameters if not a postback
Buttons:
NEW CUSTOMER
USE SELECTED CUSTMER


CustomerPage
Displays and allows editing of customer details
init()
used to retrieve the customer details and bind the correct pojo to the view or set up a new Customer pojo if customerId is null on SessionBean1
Buttons:
CANCEL
CONTINUE

TransactionPage
Displays previous transactions in a table using customerID from SessionBean1 and allows creation of new tranactions against that customerID.
Selected (or new) transaction_id is stored in attribute tranactionID in SessionBean1 or set as null if NEW TRANSACTION button is pressed
init()
used to validate that a customerID is on SessionBean1
Then retrieves previous transactions to display in table
Buttons
CANCEL
NEW TRANSACTION
USE EXISTING TRANSACTION

SelectTransactionPage
Displays 5 buttons allowing navigation to the 4 different transaction types
Buttons
PURCHASE
PAYMENT
LOAN
BET
CANCEL

PurchasePage
Allows record of a purchase transaction against transactionID stored on SessionBean1
init()
used to validate transationID is on SessionBean1
Buttons:
SUBMIT
CANCEL

PaymentPage
Allows record of payment transaction against transactionID stored on SessionBean1
init()
used to validate transationID is on SessionBean1
Buttons:
SUBMIT
CANCEL

LoanPage
Allows record of loan transaction against transactionID stored on SessionBean1
init()
used to validate transationID is on SessionBean1
Buttons:
SUBMIT
CANCEL

BetPage
Allows record of bet transaction against transactionID stored on SessionBean1
init()
used to validate transationID is on SessionBean1
Buttons:
SUBMIT
CANCEL

The CANCEL button always returns to the customer search page.

In all these pages the init method was used to do some page requirement validation and set up the page based on the relevant id stored in SessionBean1. This is an extremely simplified example of a real world application. As you can appreciate the init method with previously fired every time a page was navigated to is quite fundamental to this design.

Can you please ascertain if the way it is now working (ie only every firing once per session - the first time the page is navigated to) is a bug or some kind of a fundamental change that requires me to rewrite how the application was designed? Or am I just doing something wrong? :o)

Thanks again
-G
frank.ye

Joined: 26/Oct/2004 00:00:00
Messages: 709
Offline


Is the same screen working for you on 1.7.2?

Is the problem after upgrade to 1.8.1?

it might be related where the value is false in 1.8.1.
com.icesoft.faces.standardRequestScope

init is call back method for request scope bean, there are other call back method call as well, Are you using all of them?

What is environments like? Glassfishs v2.1 , jsf version , etc ?
[Email]
garry.donnelly

Joined: 10/May/2009 00:00:00
Messages: 13
Offline


Hi Frank

Thanks again for the swift response.

Yes the init() method worked fine in 1.7.2
It is because of a different bug that I had to upgrade to 1.8.1

preprocess() and prerender() callback methods work as intended.
destroy() is called after init() as intended

Environment: From the server log:
Servlet Context Name: , Server Info: Sun Java System Application Server 9.1_02
deployed with moduleid = webapp
Initializing Sun's JavaServer Faces implementation (1.2_04-b20-p03) for context '/webapp'
ViewRootStateManagerImpl constructed with Delegate: com.sun.faces.application.StateManagerImpl@ff7304
ICEsoft Technologies, Inc.
ICEfaces 1.8.1
Build number: 7
Revision: 18926
Adapting to GlassFish ARP environment
Blocking Request Handler: "auto-detect"
Push Server not found - the Push Server must be deployed to support multiple asynchronous applications.
Adapting to Push environment.
Failed to add Comet handler:
Exception message: Grizzly Comet hasn't been registered
Exception cause: null
To enable GlassFish ARP, please set the cometSupport property to true in the
domain's config/domain.xml for the http-listener listening to port 16033.
Falling back to Thread Blocking environment.




See my Web.xml below


<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>com.icesoft.faces.concurrentDOMViews</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>com.icesoft.faces.debugDOMUpdate</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.verifyObjects</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>com.icesoft.faces.uploadMaxFileSize</param-name>
<param-value>4048576</param-value>
</context-param>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.enableRestoreView11Compatibility</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>com.icesoft.faces.standardRequestScope</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>com.icesoft.faces.synchronousUpdate</param-name>
<param-value>false</param-value>
</context-param>
<listener>
<listener-class>org.icefaces.netbeans.rave.web.ui.appbase.servlet.LifecycleListener</listener-class>
</listener>
<servlet>
<servlet-name>Persistent Faces Servlet</servlet-name>
<servlet-class>com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>Blocking Servlet</servlet-name>
<servlet-class>com.icesoft.faces.webapp.xmlhttp.BlockingServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>uploadServlet</servlet-name>
<servlet-class>com.icesoft.faces.component.inputfile.FileUploadServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>/xmlhttp/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>*.iface</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>*.jspx</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Blocking Servlet</servlet-name>
<url-pattern>/block/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>uploadServlet</servlet-name>
<url-pattern>/uploadHtml</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Persistent Faces Servlet</servlet-name>
<url-pattern>*.jsp</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/EntryPage.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>



And faces-config.xml

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

<faces-config version="1.2"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
<application>
<view-handler>org.icefaces.netbeans.rave.web.ui.appbase.faces.ViewHandlerImpl</view-handler>
</application>
<managed-bean>
<managed-bean-name>SessionBean1</managed-bean-name>
<managed-bean-class>webapp.SessionBean1</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>EntryPage</managed-bean-name>
<managed-bean-class>webapp.EntryPage</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>RequestBean1</managed-bean-name>
<managed-bean-class>webapp.RequestBean1</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>ApplicationBean1</managed-bean-name>
<managed-bean-class>webapp.ApplicationBean1</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>Header</managed-bean-name>
<managed-bean-class>webapp.Header</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
</faces-config>
frank.ye

Joined: 26/Oct/2004 00:00:00
Messages: 709
Offline


at least two options here:

#1. Need to debugging a bit with your implementation, ie you could implement a call back,

org.icefaces.netbeans.rave.web.ui.appbase.servlet.LifecycleListener
org.icefaces.netbeans.rave.web.ui.appbase.faces.ViewHandlerImpl

copy the above in the project and create a new call back for your specific situations.

If having problems, please attach a simple project...

#2. not sure if all jsf components are ICEfaces, if could be changed to fragment of the pages. ie, a panel stack with layer of layer of fragment of pages using jsp:include.
[Email]
garry.donnelly

Joined: 10/May/2009 00:00:00
Messages: 13
Offline


Hi Frank

Thank again for your assistance.

If required there are a few work-arounds I believe will work. What I'm interested in is finding out if there is a bug here so that it can be raised and resolved. There are a number of posts on the forum related to this issue so it would be good to get it ironed out. :o)

Is there someone who maintains the netbeans plugins I can contact directly regarding this issue?

Thanks again
-Garry
frank.ye

Joined: 26/Oct/2004 00:00:00
Messages: 709
Offline


feel free to open a new jira, please attach a simple test case
http://jira.icefaces.org/browse/ICE
[Email]
 
Forum Index -> Tools
Go to:   
Powered by JForum 2.1.7ice © JForum Team