Extending AbstractPageBean

The GUI freaks out when I create an abstract class BasePage extending AbstractPageBean and utilize this page as an ancestor for all of my pages. The GUI complains as follows:
main.java:1: Java class must be a direct subclass of one of the following com.sun.jsfcl.app.AbstractPageBean, com.sun.rave.web.ui.appbase.AbstractPageBean, com.sun.rave.web.ui.appbase.AbstractFragmentBean
The pages all run fine, I am just unable to use the GUI to build them now.
What I am trying to do is create a common base so that things like ensuring the user has logged in will not be coded in each page. This common base, in the init() I call my own method userLoggedIn() that ensures the user has logged in, otherwise the user is redirected to my login page.
Also, each page generated includes methods to get the beans. It would seem that the tool should automatically create a common base page to house these bean retrieval methods. Just seems redundant to have all pages declare these methods.
Either way, it should let me make my own page base (providing I extend one of the proper classes) to provide a common base to allow common functionality to be placed within my pages instead of forcing me to duplicate code in multiple locations, even if it is just a call to a reused method available on another class. As long as the ancestry trails back to the proper class I do not see why the GUI forces me to directly descend a particular class, it should not care.
Thanks,

I have done filters before and for the app I am working on I could do that to get around this if I want to use the GUI.
We have another application that is much more complex and customizable. This application will require decisions to be made that will be much simpler and more straightforward in the pages themselves and much more maintainable if encapsulated in an extended class. We currently have a ton of behavior that each page gets automatically due to inheritance. This other application is built in WebObjects and we are looking at taking it to JSF or some other technology. I need to look into JSF's form handling some more, it sounds like that may be an issue with this other application, too.
My point is the GUI appears to be the only thing preventing taking an OO approach to the pages and letting them make decisions on their own. There are times when we will be wanting to place logic within the classes we build our final page classes from, encapsulating logic like this is good design and should be encouraged. We can do this as long as we acknowledge that these pages will not render properly in the JSC GUI, but we should not have to make this trade-off.
Hopefully someone will see this and not think of it so much as a feature, but as removing an undesired/unnecessary governor on the ancestry of pages. I am at a loss as to why they must be direct descendants of one of these two classes.
Thanks for the feedback.

Similar Messages

  • DataTable Exception: Invalid operation for the current cursor position

    I have a JSF application that lists rows from a view in a SQL Server database. I have set up a commandLinks in an extra columns.
    The data is displayed properly, but when I select one of the commandLinks I get the "Invalid operation for the current cursor position" exception.
    Here's the source
    Domain.jsp
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page">
        <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
        <f:view>
            <html lang="en-US" xml:lang="en-US">
                <head>
                    <meta content="no-cache" http-equiv="Cache-Control"/>
                    <meta content="no-cache" http-equiv="Pragma"/>
                    <title>Page1 Title</title>
                    <link href="resources/stylesheet.css" rel="stylesheet" type="text/css"/>
                </head>
                <body style="-rave-layout: grid">
                    <h:form binding="#{Domains.form1}" id="form1">
                        <h:dataTable binding="#{Domains.dataTable1}" headerClass="list-header" id="dataTable1" rowClasses="list-row-even,list-row-odd"
                            value="#{Domains.dataTable1Model}" var="currentRow">
                            <h:column binding="#{Domains.column9}" id="column9">
                                <h:selectBooleanCheckbox binding="#{Domains.checkbox2}" id="checkbox2"/>
                                <f:facet name="header">
                                    <h:outputText binding="#{Domains.outputText9}" id="outputText9" value="Select"/>
                                </f:facet>
                            </h:column>
                            <h:column binding="#{Domains.column10}" id="column10">
                                <f:facet name="header">
                                    <h:outputText binding="#{Domains.outputText4}" id="outputText4" value="Name"/>
                                </f:facet>
                                <h:commandLink action="#{Domains.groupList}" binding="#{Domains.linkAction1}" id="linkAction1">
                                    <h:graphicImage binding="#{Domains.image1}" id="image1" url="resources/images/domain16.gif" value="resources/images/domain16.gif"/>
                                    <h:outputText binding="#{Domains.linkAction1Text}" id="linkAction1Text" value="#{currentRow['name']}"/>
                                </h:commandLink>
                            </h:column>
                            <h:column binding="#{Domains.column3}" id="column3">
                                <h:outputText binding="#{Domains.outputText5}" id="outputText5" value="#{currentRow['description']}"/>
                                <f:facet name="header">
                                    <h:outputText binding="#{Domains.outputText6}" id="outputText6" value="Description"/>
                                </f:facet>
                            </h:column>
                            <h:column binding="#{Domains.column4}" id="column4">
                                <h:selectBooleanCheckbox binding="#{Domains.checkbox1}" id="checkbox1" value="#{Domains.domainviewRowSet.currentRow['enabled']}==1"/>
                                <f:facet name="header">
                                    <h:outputText binding="#{Domains.outputText8}" id="outputText8" value="Enabled"/>
                                </f:facet>
                            </h:column>
                            <h:column binding="#{Domains.column7}" id="column7">
                                <h:outputText binding="#{Domains.outputText13}" id="outputText13" value="#{currentRow['userCount']}"/>
                                <f:facet name="header">
                                    <h:outputText binding="#{Domains.outputText14}" id="outputText14" value="Users"/>
                                </f:facet>
                            </h:column>
                            <h:column binding="#{Domains.column8}" id="column8">
                                <h:outputText binding="#{Domains.outputText15}" id="outputText15" value="#{currentRow['groupCount']}"/>
                                <f:facet name="header">
                                    <h:outputText binding="#{Domains.outputText16}" id="outputText16" value="Groups"/>
                                </f:facet>
                            </h:column>
                            <h:column binding="#{Domains.column5}" id="column5">
                                <f:facet name="header">
                                    <h:outputText binding="#{Domains.outputText17}" id="outputText17" value="Actions"/>
                                </f:facet>
                                <h:commandLink action="#{Domains.editDomain}" binding="#{Domains.linkAction2}" id="linkAction2">
                                    <h:graphicImage binding="#{Domains.image2}" id="image2" title="Edit" value="resources/images/edit.gif"/>
                                </h:commandLink>
                                <h:commandLink binding="#{Domains.linkAction3}" id="linkAction3">
                                    <h:graphicImage binding="#{Domains.image3}" id="image3" title="View" url="resources/images/view.gif" value="resources/images/view.gif"/>
                                </h:commandLink>
                                <h:commandLink binding="#{Domains.linkAction4}" id="linkAction4">
                                    <h:graphicImage binding="#{Domains.image4}" id="image4" title="Delete" value="resources/images/delete.gif"/>
                                </h:commandLink>
                            </h:column>
                        </h:dataTable>
                    </h:form>
                </body>
            </html>
        </f:view>
    </jsp:root>
    Domains.java
    * Page1.java
    * Created on October 28, 2004, 12:45 PM
    * Copyright Gordon.Bell
    package usergroupmgt;
    import javax.faces.*;
    import com.sun.jsfcl.app.*;
    import javax.faces.component.html.*;
    import com.sun.jsfcl.data.*;
    import javax.faces.component.*;
    import com.sun.sql.rowset.*;
    import javax.faces.convert.*;
    public class Domains extends AbstractPageBean {
        // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Definition">
        private int __placeholder;
        private HtmlForm form1 = new HtmlForm();
        public HtmlForm getForm1() {
            return form1;
        public void setForm1(HtmlForm hf) {
            this.form1 = hf;
        private HtmlDataTable dataTable1 = new HtmlDataTable();
        public HtmlDataTable getDataTable1() {
            return dataTable1;
        public void setDataTable1(HtmlDataTable hdt) {
            this.dataTable1 = hdt;
        private JdbcRowSetXImpl domainviewRowSet = new JdbcRowSetXImpl();
        public JdbcRowSetXImpl getDomainviewRowSet() {
            return domainviewRowSet;
        public void setDomainviewRowSet(JdbcRowSetXImpl jrsxi) {
            this.domainviewRowSet = jrsxi;
        private HtmlOutputText outputText4 = new HtmlOutputText();
        public HtmlOutputText getOutputText4() {
            return outputText4;
        public void setOutputText4(HtmlOutputText hot) {
            this.outputText4 = hot;
        private UIColumn column3 = new UIColumn();
        public UIColumn getColumn3() {
            return column3;
        public void setColumn3(UIColumn uic) {
            this.column3 = uic;
        private HtmlOutputText outputText5 = new HtmlOutputText();
        public HtmlOutputText getOutputText5() {
            return outputText5;
        public void setOutputText5(HtmlOutputText hot) {
            this.outputText5 = hot;
        private HtmlOutputText outputText6 = new HtmlOutputText();
        public HtmlOutputText getOutputText6() {
            return outputText6;
        public void setOutputText6(HtmlOutputText hot) {
            this.outputText6 = hot;
        private UIColumn column4 = new UIColumn();
        public UIColumn getColumn4() {
            return column4;
        public void setColumn4(UIColumn uic) {
            this.column4 = uic;
        private HtmlOutputText outputText8 = new HtmlOutputText();
        public HtmlOutputText getOutputText8() {
            return outputText8;
        public void setOutputText8(HtmlOutputText hot) {
            this.outputText8 = hot;
        private UIColumn column7 = new UIColumn();
        public UIColumn getColumn7() {
            return column7;
        public void setColumn7(UIColumn uic) {
            this.column7 = uic;
        private HtmlOutputText outputText13 = new HtmlOutputText();
        public HtmlOutputText getOutputText13() {
            return outputText13;
        public void setOutputText13(HtmlOutputText hot) {
            this.outputText13 = hot;
        private HtmlOutputText outputText14 = new HtmlOutputText();
        public HtmlOutputText getOutputText14() {
            return outputText14;
        public void setOutputText14(HtmlOutputText hot) {
            this.outputText14 = hot;
        private UIColumn column8 = new UIColumn();
        public UIColumn getColumn8() {
            return column8;
        public void setColumn8(UIColumn uic) {
            this.column8 = uic;
        private HtmlOutputText outputText15 = new HtmlOutputText();
        public HtmlOutputText getOutputText15() {
            return outputText15;
        public void setOutputText15(HtmlOutputText hot) {
            this.outputText15 = hot;
        private HtmlOutputText outputText16 = new HtmlOutputText();
        public HtmlOutputText getOutputText16() {
            return outputText16;
        public void setOutputText16(HtmlOutputText hot) {
            this.outputText16 = hot;
        private HtmlSelectBooleanCheckbox checkbox1 = new HtmlSelectBooleanCheckbox();
        public HtmlSelectBooleanCheckbox getCheckbox1() {
            return checkbox1;
        public void setCheckbox1(HtmlSelectBooleanCheckbox hsbc) {
            this.checkbox1 = hsbc;
        private UIColumn column5 = new UIColumn();
        public UIColumn getColumn5() {
            return column5;
        public void setColumn5(UIColumn uic) {
            this.column5 = uic;
        private UIColumn column9 = new UIColumn();
        public UIColumn getColumn9() {
            return column9;
        public void setColumn9(UIColumn uic) {
            this.column9 = uic;
        private HtmlSelectBooleanCheckbox checkbox2 = new HtmlSelectBooleanCheckbox();
        public HtmlSelectBooleanCheckbox getCheckbox2() {
            return checkbox2;
        public void setCheckbox2(HtmlSelectBooleanCheckbox hsbc) {
            this.checkbox2 = hsbc;
        private HtmlOutputText outputText9 = new HtmlOutputText();
        public HtmlOutputText getOutputText9() {
            return outputText9;
        public void setOutputText9(HtmlOutputText hot) {
            this.outputText9 = hot;
        private UIColumn column10 = new UIColumn();
        public UIColumn getColumn10() {
            return column10;
        public void setColumn10(UIColumn uic) {
            this.column10 = uic;
        private RowSetDataModel dataTable1Model = new RowSetDataModel();
        public RowSetDataModel getDataTable1Model() {
            return dataTable1Model;
        public void setDataTable1Model(RowSetDataModel rsdm) {
            this.dataTable1Model = rsdm;
        private BooleanConverter booleanConverter1 = new BooleanConverter();
        public BooleanConverter getBooleanConverter1() {
            return booleanConverter1;
        public void setBooleanConverter1(BooleanConverter bc) {
            this.booleanConverter1 = bc;
        private HtmlCommandLink linkAction1 = new HtmlCommandLink();
        public HtmlCommandLink getLinkAction1() {
            return linkAction1;
        public void setLinkAction1(HtmlCommandLink hcl) {
            this.linkAction1 = hcl;
        private HtmlOutputText linkAction1Text = new HtmlOutputText();
        public HtmlOutputText getLinkAction1Text() {
            return linkAction1Text;
        public void setLinkAction1Text(HtmlOutputText hot) {
            this.linkAction1Text = hot;
        private HtmlGraphicImage image1 = new HtmlGraphicImage();
        public HtmlGraphicImage getImage1() {
            return image1;
        public void setImage1(HtmlGraphicImage hgi) {
            this.image1 = hgi;
        private HtmlCommandLink linkAction2 = new HtmlCommandLink();
        public HtmlCommandLink getLinkAction2() {
            return linkAction2;
        public void setLinkAction2(HtmlCommandLink hcl) {
            this.linkAction2 = hcl;
        private HtmlGraphicImage image2 = new HtmlGraphicImage();
        public HtmlGraphicImage getImage2() {
            return image2;
        public void setImage2(HtmlGraphicImage hgi) {
            this.image2 = hgi;
        private HtmlCommandLink linkAction3 = new HtmlCommandLink();
        public HtmlCommandLink getLinkAction3() {
            return linkAction3;
        public void setLinkAction3(HtmlCommandLink hcl) {
            this.linkAction3 = hcl;
        private HtmlGraphicImage image3 = new HtmlGraphicImage();
        public HtmlGraphicImage getImage3() {
            return image3;
        public void setImage3(HtmlGraphicImage hgi) {
            this.image3 = hgi;
        private HtmlCommandLink linkAction4 = new HtmlCommandLink();
        public HtmlCommandLink getLinkAction4() {
            return linkAction4;
        public void setLinkAction4(HtmlCommandLink hcl) {
            this.linkAction4 = hcl;
        private HtmlGraphicImage image4 = new HtmlGraphicImage();
        private HtmlOutputText outputText17 = new HtmlOutputText();
        public HtmlOutputText getOutputText17() {
            return outputText17;
        public void setOutputText17(HtmlOutputText hot) {
            this.outputText17 = hot;
        public HtmlGraphicImage getImage4() {
            return image4;
        public void setImage4(HtmlGraphicImage hgi) {
            this.image4 = hgi;
        // </editor-fold>
        public Domains() {
            // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
            try {
                domainviewRowSet.setDataSourceName("java:comp/env/jdbc/HBird");
                domainviewRowSet.setCommand("SELECT ALL dbo.DomainView.id, dbo.DomainView.name, dbo.DomainView.description, dbo.DomainView.enabled, dbo.DomainView.created, dbo.DomainView.modified, dbo.DomainView.userCount, dbo.DomainView.groupCount  FROM dbo.DomainView");
                dataTable1Model.setDataCacheKey("com.sun.datacache.Domains.domainviewRowSet");
                dataTable1Model.setRowSet(domainviewRowSet);
                dataTable1Model.setSchemaName("");
                dataTable1Model.setTableName("");
            } catch (Exception e) {
                log("Page1 Initialization Failure", e);
                throw e instanceof javax.faces.FacesException ? (FacesException) e : new FacesException(e);
            // </editor-fold>
            // Additional user provided initialization code
    //        try {
    //            domainviewRowSet.execute();
    //            domainviewRowSet.next();
    //        } catch (Exception ex) {
    //            throw new FacesException(ex);
        protected usergroupmgt.ApplicationBean1 getApplicationBean1() {
            return (usergroupmgt.ApplicationBean1)getBean("ApplicationBean1");
        protected usergroupmgt.SessionBean1 getSessionBean1() {
            return (usergroupmgt.SessionBean1)getBean("SessionBean1");
         * Bean cleanup.
        protected void afterRenderResponse() {
            domainviewRowSet.close();
        public String groupList() {
            // User event code here...
            return "groupList";
        public String editDomain() {
            // User event code here...
            return "editDomain";
    }and the exception stack:
    Stack trace:
    com.sun.jsfcl.data.ResultSetPropertyResolver$RowData.getData(Unknown Source)
    com.sun.jsfcl.data.ResultSetPropertyResolver.getValue(Unknown Source)
    com.sun.faces.el.impl.ArraySuffix.evaluate(ArraySuffix.java:167)
    com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:151)
    com.sun.faces.el.MixedELValueBinding.getValue(MixedELValueBinding.java:80)
    javax.faces.component.UIOutput.getValue(UIOutput.java:147)
    javax.faces.component.UIInput.validate(UIInput.java:639)
    javax.faces.component.UIInput.executeValidate(UIInput.java:838)
    javax.faces.component.UIInput.processValidators(UIInput.java:412)
    javax.faces.component.UIData.iterate(UIData.java:969)
    javax.faces.component.UIData.processValidators(UIData.java:781)
    javax.faces.component.UIForm.processValidators(UIForm.java:170)
    javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:904)
    javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:342)
    com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:78)
    com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
    sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:324)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:246)
    java.security.AccessController.doPrivileged(AccessController.java:-2)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:268)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:236)
    org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
    org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145)
    java.security.AccessController.doPrivileged(AccessController.java:-2)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:141)
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
    org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:214)
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:168)
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:144)
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:133)
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
    org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:539)
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
    com.sun.enterprise.webservice.EjbWebServiceValve.invoke(EjbWebServiceValve.java:134)
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
    com.sun.enterprise.security.web.SingleSignOn.invoke(SingleSignOn.java:254)
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
    com.sun.enterprise.web.VirtualServerValve.invoke(VirtualServerValve.java:209)
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:114)
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
    com.sun.enterprise.web.VirtualServerMappingValve.invoke(VirtualServerMappingValve.java:166)
    org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
    org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
    org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:936)
    org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:165)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:683)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:604)
    org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:542)
    org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:647)
    java.lang.Thread.run(Thread.java:534)Any help is appreciated.

    Hi,
    Looks like some inconsistency in the jsp source:
    in the 2nd link the url property is set. I don't think
    you need to set this.
    I couldn't tell what action you want to occur when you
    click. If you want some action to occur such as
    navigating to another page then you can use Page Navigation. Then you would need an action handler
    for the LinkAction component.
    <h:commandLink action="#{Domains.editDomain}" binding="#{Domains.linkAction2}" id="linkAction2">
    <h:graphicImage binding="#{Domains.image2}" id="image2" title="Edit" value="resources/images/edit.gif"/>
    </h:commandLink>
    <h:commandLink binding="#{Domains.linkAction3}" id="linkAction3">
    <h:graphicImage binding="#{Domains.image3}" id="image3" title="View" url="resources/images/view.gif" value="resources/images/view.gif"/>
    </h:commandLink>
    <h:commandLink binding="#{Domains.linkAction4}" id="linkAction4">
    <h:graphicImage binding="#{Domains.image4}" id="image4" title="Delete" value="resources/images/delete.gif"/>
    </h:commandLink>
    John
    JSC QA

  • Help Needed - FINAL PROJECT - SAAJ MESSAGING

    Hi there!
    currently im doing my final project and it involves sending and receiving soap messages.
    im working with sun java studio creator for the first time.
    i have done this example (excuse me for possible dumb errors im just a noobie):
    * Page1.java
    * Created on 6 de Novembro de 2006, 12:40
    package webapplication1;
    import com.sun.rave.web.ui.appbase.AbstractPageBean;
    import com.sun.rave.web.ui.component.Body;
    import com.sun.rave.web.ui.component.Form;
    import com.sun.rave.web.ui.component.Head;
    import com.sun.rave.web.ui.component.Html;
    import com.sun.rave.web.ui.component.Link;
    import com.sun.rave.web.ui.component.Page;
    import javax.faces.FacesException;
    import com.sun.rave.web.ui.component.Button;
    import com.sun.rave.web.ui.component.TextArea;
    //soap saaj
    import javax.xml.*;
    import javax.xml.soap.*;
    import java.net.URL;
    import java.net.*;
    import java.util.*;
    import javax.xml.soap.SOAPConnectionFactory;
    import javax.xml.soap.SOAPConnection;
    import javax.xml.soap.MessageFactory;
    import javax.xml.soap.SOAPMessage;
    import javax.xml.soap.SOAPPart;
    import javax.xml.soap.SOAPEnvelope;
    import javax.xml.soap.SOAPBody;
    import javax.xml.soap.SOAPElement;
    // add this import if you need soapaction
    import javax.xml.soap.MimeHeaders;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.Source;
    import javax.xml.transform.stream.StreamResult;
    import com.sun.xml.messaging.saaj.*;
    import java.net.URL;
    import javax.xml.soap.*;
    import java.util.Iterator;
    import javax.xml.soap.Name;
    import javax.xml.soap.MessageFactory;
    import javax.xml.soap.SOAPMessage;
    import javax.xml.soap.SOAPBody;
    import javax.xml.soap.SOAPPart;
    import javax.xml.soap.SOAPEnvelope;
    import javax.xml.soap.SOAPBodyElement;
    import javax.xml.messaging.ReqRespListener;
    import java.text.NumberFormat;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.Source;
    import javax.xml.transform.stream.StreamResult;
    import com.sun.xml.messaging.saaj.*;
    * <p>Page bean that corresponds to a similarly named JSP page. This
    * class contains component definitions (and initialization code) for
    * all components that you have defined on this page, as well as
    * lifecycle methods and event handlers where you may add behavior
    * to respond to incoming events.</p>
    import javax.xml.messaging.JAXMServlet;
    //extends JAXMServlet
    public class Page1 extends AbstractPageBean implements ReqRespListener{
    // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Definition">
    private int __placeholder;
    * <p>Automatically managed component initialization. <strong>WARNING:</strong>
    * This method is automatically generated, so any user-specified code inserted
    * here is subject to being replaced.</p>
    private void _init() throws Exception {
    private Page page1 = new Page();
    public Page getPage1() {
    return page1;
    public void setPage1(Page p) {
    this.page1 = p;
    private Html html1 = new Html();
    public Html getHtml1() {
    return html1;
    public void setHtml1(Html h) {
    this.html1 = h;
    private Head head1 = new Head();
    public Head getHead1() {
    return head1;
    public void setHead1(Head h) {
    this.head1 = h;
    private Link link1 = new Link();
    public Link getLink1() {
    return link1;
    public void setLink1(Link l) {
    this.link1 = l;
    private Body body1 = new Body();
    public Body getBody1() {
    return body1;
    public void setBody1(Body b) {
    this.body1 = b;
    private Form form1 = new Form();
    public Form getForm1() {
    return form1;
    public void setForm1(Form f) {
    this.form1 = f;
    private Button button1 = new Button();
    public Button getButton1() {
    return button1;
    public void setButton1(Button b) {
    this.button1 = b;
    private TextArea textArea1 = new TextArea();
    public TextArea getTextArea1() {
    return textArea1;
    public void setTextArea1(TextArea ta) {
    this.textArea1 = ta;
    private TextArea textArea2 = new TextArea();
    public TextArea getTextArea2() {
    return textArea2;
    public void setTextArea2(TextArea ta) {
    this.textArea2 = ta;
    // </editor-fold>/*
    public MessageFactory messageFactSent= null;
    public MessageFactory messageFactReply=null;
    public MessageFactory messageFactReceiv= null;
    public SOAPConnectionFactory soapConnectionFact;
    public URL URLendpoint;
    public SOAPConnection connection ;
    public SOAPMessage messageSent;
    public SOAPPart soapPartSent;
    public SOAPEnvelope soapEnvelopeSent;
    public SOAPBody SoapBodySent;
    public SOAPMessage messageReceiv;
    public SOAPPart soapPartReceiv;
    public SOAPEnvelope soapEnvelopeReceiv;
    public SOAPBody SoapBodyReceiv;
    public SOAPMessage messageReply;
    public SOAPPart soapPartReply;
    public SOAPEnvelope soapEnvelopeReply;
    public SOAPBody SoapBodyReply;
    public SOAPMessage reply;
    public String StringAux="";
    public final String theURI = "http://172.16.5.223:8080/WebApplication1/";
    //public final String theURI = "http://172.16.5.223:8080/WebApplication1/";
    //public final String theURI = "http://172.16.5.193:8080/WebApplication1/";
    //http://localhost:8080/WebApplication1/faces/Page1.jsp
    public SOAPMessage onMessage(SOAPMessage message) {
    StringAux=StringAux+"On message called in receiving servlet\n";
    this.textArea1.setValue(StringAux);
    try {
    soapPartReceiv = message.getSOAPPart( );
    soapEnvelopeReceiv = soapPartReceiv.getEnvelope();
    SoapBodyReceiv = soapEnvelopeReceiv.getBody();
    //analise...if needed
    // Create the reply message
    messageReply = messageFactReply.createMessage();
    soapEnvelopeReply = messageReply.getSOAPPart().getEnvelope();
    SoapBodyReply= soapEnvelopeReply.getBody();
    // Remove empty header from the Envelope
    soapEnvelopeReply.getHeader().detachNode();
    Name bodyName = soapEnvelopeReply.createName("GetLastTradePrice",
    "m", "http://wombat.ztrade.com");
    SOAPBodyElement gltp = SoapBodyReply.addBodyElement(bodyName);
    Name name = soapEnvelopeReply.createName("symbol");
    SOAPElement symbol = gltp.addChildElement(name);
    symbol.addTextNode("SUNW");
    // Return a reply message back to the JAXM client
    StringAux=StringAux+"devolveu menssagem\n";
    this.textArea1.setValue(StringAux);
    return messageReply ;
    } catch(Exception e) {
    StringAux=StringAux+"Error in processi ng or replying to a message - e: " + e+"\n";
    this.textArea1.setValue(StringAux);
    return null;
    //this.getBean(name)
    public Page1() {
    // Service serve=new Service();
    // Client cli=new Client();
    // this.textArea1.setValue(serve.GetAux());
    // this.textArea2.setValue(cli.GetAux());
    // Create a MessageFactory
    try {
    URLendpoint=new URL(theURI);
    StringAux=StringAux+"depois de criar o endpoint \n";
    //Create SOAP connection
    soapConnectionFact = SOAPConnectionFactory.newInstance();
    connection = soapConnectionFact.createConnection();
    // Create a message from the message factory.
    messageFactSent = MessageFactory.newInstance();
    messageFactReply = MessageFactory.newInstance();
    messageFactReceiv = MessageFactory.newInstance();
    StringAux=StringAux+"depois de criar as message factory \n";
    this.textArea1.setValue(StringAux);
    } catch(Throwable e) {
    StringAux="erro2!\n"+StringAux+e.toString()+"\n";
    this.textArea1.setValue(StringAux);
    * <p>Return a reference to the scoped data bean.</p>
    protected ApplicationBean1 getApplicationBean1() {
    return (ApplicationBean1)getBean("ApplicationBean1");
    * <p>Return a reference to the scoped data bean.</p>
    protected RequestBean1 getRequestBean1() {
    return (RequestBean1)getBean("RequestBean1");
    * <p>Return a reference to the scoped data bean.</p>
    protected SessionBean1 getSessionBean1() {
    return (SessionBean1)getBean("SessionBean1");
    * <p>Callback method that is called whenever a page is navigated to,
    * either directly via a URL, or indirectly via page navigation.
    * Customize 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.</p>
    * <p>Note that, if the current request is a postback, the property
    * values of the components do <strong>not</strong> represent any
    * values submitted with this request. Instead, they represent the
    * property values that were saved for this view when it was rendered.</p>
    public void init() {
    // Perform initializations inherited from our superclass
    super.init();
    // Perform application initialization that must complete
    // before managed components are initialized
    // TODO - add your own initialiation code here
    // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
    // Initialize automatically managed components
    // Note - this logic should NOT be modified
    try {
    _init();
    } catch (Exception e) {
    log("Page1 Initialization Failure", e);
    throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
    // </editor-fold>
    // Perform application initialization that must complete
    // after managed components are initialized
    // TODO - add your own initialization code here
    * <p>Callback method that is called after the component tree has been
    * restored, but before any event processing takes place. This method
    * will <strong>only</strong> be called on a postback request that
    * is processing a form submit. Customize this method to allocate
    * resources that will be required in your event handlers.</p>
    public void preprocess() {
    * <p>Callback method that is called just before rendering takes place.
    * This method will <strong>only</strong> be called for the page that
    * will actually be rendered (and not, for example, on a page that
    * handled a postback and then navigated to a different page). Customize
    * this method to allocate resources that will be required for rendering
    * this page.</p>
    public void prerender() {
    * <p>Callback method that is called after rendering is completed for
    * this request, if <code>init()</code> was called (regardless of whether
    * or not this was the page that was actually rendered). Customize this
    * method to release resources acquired in the <code>init()</code>,
    * <code>preprocess()</code>, or <code>prerender()</code> methods (or
    * acquired during execution of an event handler).</p>
    public void destroy() {
    public String button1_action() {
    try {
    StringAux=StringAux+"antes de criar a messagem para enviar\n";
    messageSent = messageFactSent.createMessage();
    soapEnvelopeSent = messageSent.getSOAPPart().getEnvelope();
    //SoapBodySent = messageSent.getSOAPPart().getEnvelope().getBody();
    SoapBodySent = soapEnvelopeSent.getBody();
    Name bodyName = soapEnvelopeSent .createName("GetLastTradePrice",
    "m", "http://wombat.ztrade.com");
    SOAPBodyElement gltp = SoapBodySent.addBodyElement(bodyName);
    Name name = soapEnvelopeSent.createName("symbol");
    SOAPElement symbol = gltp.addChildElement(name);
    symbol.addTextNode("SUNW");
    StringAux=StringAux+"\nContent of the message: \n"+messageSent.toString()+"\n";
    // Send the SOAP message and get reply
    StringAux=StringAux+"Sending message to URL: \n"+ URLendpoint+"\n"+this.URLendpoint.getPath()+"\n";
    reply = connection.call(messageSent,URLendpoint);
    StringAux=StringAux+"\n\n Content of the reply message: \n"+reply.toString()+"\n";
    this.textArea1.setValue(StringAux);
    //tratamento da resposta
    connection.close();
    } catch(Throwable e) {
    StringAux="erro!\n"+StringAux+e.toString()+"\n";
    this.textArea1.setValue(StringAux);
    return null;
    Very simple , on a click of the button a message was supost to be sent. and receive on the other machine. i have launched the same war file on both pcs
    but now nothing happens just a exception message
    com.sun.xml.messaging.saaj.SOAPExceptionImpl: java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP
    ....could someone help me out here ,even share a wprking project with this goal
    thank you in advance
    DMS
    Message was edited by:
    DaniDaOne

    One time, after quitting IM and re-launching it later, my project disappeared from the project list.
    Apple Support told me to do this.
    1) quit IM
    2) with the finder, move the project out of the project directory
    3) launch IM
    4) quit IM
    5) with the finder, put the project back into the project directory
    6) launch IM
    My project re-appeared. He said these steps forces a project index to be rebuilt.
    Your symptoms are different but maybe the cure is the same --- good luck.

  • How to add a blank row into a datatable

    i hava adatatable which contains the datas from database.i need to add a new data so that i need a blank row which contain the same number of columns in the existing datatable.
    Pls Help..

    sorry i am a beginner in jsf..
    In the crud Example i saw a code in MyCrudBean.java.i wrote the code like that but the same stage only one row is coming i cant add n items .
    * Department.java
    * Created on Nov 22, 2007, 4:43:12 PM
    package datatable;
    import Item.DeptDatabase;
    import com.sun.rave.web.ui.appbase.AbstractPageBean;
    import com.sun.webui.jsf.component.Body;
    import com.sun.webui.jsf.component.Form;
    import com.sun.webui.jsf.component.Head;
    import com.sun.webui.jsf.component.Html;
    import com.sun.webui.jsf.component.Link;
    import com.sun.webui.jsf.component.Page;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.ArrayList;
    import java.util.List;
    import javax.faces.FacesException;
    import javax.faces.component.html.HtmlDataTable;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.sql.DataSource;
    public class Department extends AbstractPageBean {
    Connection con = null;
    PreparedStatement StmtRateSel = null;
    ResultSet rs = null;
    private List<DeptDatabase> list = new ArrayList();
    private int addCount = 1;
    private HtmlDataTable myDataTable;
    private static final int DEFAULT_TABLE_ROWS = 10;
    // <editor-fold defaultstate="collapsed" desc="Managed Component Definition">
    * <p>Automatically managed component initialization. <strong>WARNING:</strong>
    * This method is automatically generated, so any user-specified code inserted
    * here is subject to being replaced.</p>
    private void _init() throws Exception {
    private Page page1 = new Page();
    public Page getPage1() {
    return page1;
    public void setPage1(Page p) {
    this.page1 = p;
    private Html html1 = new Html();
    public Html getHtml1() {
    return html1;
    public void setHtml1(Html h) {
    this.html1 = h;
    private Head head1 = new Head();
    public Head getHead1() {
    return head1;
    public void setHead1(Head h) {
    this.head1 = h;
    private Link link1 = new Link();
    public Link getLink1() {
    return link1;
    public void setLink1(Link l) {
    this.link1 = l;
    private Body body1 = new Body();
    public Body getBody1() {
    return body1;
    public void setBody1(Body b) {
    this.body1 = b;
    private Form form1 = new Form();
    public Form getForm1() {
    return form1;
    public void setForm1(Form f) {
    this.form1 = f;
    // </editor-fold>
    * <p>Construct a new Page bean instance.</p>
    public Department() {
    public void deptsave() throws SQLException{
    connection();
    StmtRateSel      = con.prepareStatement("execute prcPnsDepartmentIns");
    rs = StmtRateSel.executeQuery();
    con.close();
    @Override
    public void init() {
    // Perform initializations inherited from our superclass
    super.init();
    // Perform application initialization that must complete
    // before managed components are initialized
    // TODO - add your own initialiation code here
    // <editor-fold defaultstate="collapsed" desc="Managed Component Initialization">
    // Initialize automatically managed components
    // Note - this logic should NOT be modified
    try {
    _init();
    } catch (Exception e) {
    log("Department Initialization Failure", e);
    throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
    // </editor-fold>
    // Perform application initialization that must complete
    // after managed components are initialized
    // TODO - add your own initialization code here
    * <p>Callback method that is called after the component tree has been
    * restored, but before any event processing takes place. This method
    * will <strong>only</strong> be called on a postback request that
    * is processing a form submit. Customize this method to allocate
    * resources that will be required in your event handlers.</p>
    @Override
    public void preprocess() {
    * <p>Callback method that is called just before rendering takes place.
    * This method will <strong>only</strong> be called for the page that
    * will actually be rendered (and not, for example, on a page that
    * handled a postback and then navigated to a different page). Customize
    * this method to allocate resources that will be required for rendering
    * this page.</p>
    @Override
    public void prerender() {
    * <p>Callback method that is called after rendering is completed for
    * this request, if <code>init()</code> was called (regardless of whether
    * or not this was the page that was actually rendered). Customize this
    * method to release resources acquired in the <code>init()</code>,
    * <code>preprocess()</code>, or <code>prerender()</code> methods (or
    * acquired during execution of an event handler).</p>
    @Override
    public void destroy() {
    * <p>Return a reference to the scoped data bean.</p>
    * @return reference to the scoped data bean
    protected SessionBean1 getSessionBean1() {
    return (SessionBean1) getBean("SessionBean1");
    * <p>Return a reference to the scoped data bean.</p>
    * @return reference to the scoped data bean
    protected RequestBean1 getRequestBean1() {
    return (RequestBean1) getBean("RequestBean1");
    * <p>Return a reference to the scoped data bean.</p>
    * @return reference to the scoped data bean
    protected ApplicationBean1 getApplicationBean1() {
    return (ApplicationBean1) getBean("ApplicationBean1");
    private void connection() {
    try{
    Context ctx = new InitialContext();
    System.out.println("context"+ctx);
    if(ctx == null )
    throw new Exception("Boom - No Context");
    DataSource ds = (DataSource)ctx.lookup("BiteRiteJNDI");
    if (ds != null) {
    con = ds.getConnection();
    System.out.println("connnn"+con);
    catch(Exception e)
    {System.out.println(e);}
    public void addDataItem() {
    while (addCount-- > 0) {
    DeptDatabase myNewDataItem = new DeptDatabase();
    //myNewDataItem.setEditMode(true);
    list.add(myNewDataItem);
    //log(myDataList);
    // Reset counter and go to last page.
    addCount = 1;
    // log(myDataList);
    // Reset counter and go to last page.
    //addCount = DEFAULT_ADD_COUNT;
    pageLast();
    System.out.println("in add itm");
    // list.add(new DeptDatabase());
    public List getListtt(){
    return list;
    public HtmlDataTable getMyDataTable() {
    if (myDataTable == null) {
    myDataTable = new HtmlDataTable();
    myDataTable.setRows(DEFAULT_TABLE_ROWS);
    return myDataTable;
    private static void log(Object object) {
    System.out.println("bejoy"+new Exception().getStackTrace()[1].getMethodName() + ": " + object);
    public void pageLast() {
    System.out.println("in Page last");
    int count = myDataTable.getRowCount();
    System.out.println("count"+count);
    int rows = myDataTable.getRows();
    System.out.println("rows"+rows);
    if (rows != 0) { // Prevent ArithmeticException: / by zero.
    System.out.println("not equals zero");
    myDataTable.setFirst(count - ((count % rows != 0) ? count % rows : rows));
    log(new Integer(myDataTable.getFirst()));
    public void setListtt(List<DeptDatabase> list) {
    this.list = list;
    * CRUD table: set datatable.
    * @param myDataTable The datatable.
    public void setMyDataTable(HtmlDataTable myDataTable) {
    this.myDataTable = myDataTable;
    jsp
    <?xml version="1.0" encoding="UTF-8"?>
    <!--
    Document : Department
    Created on : Nov 22, 2007, 4:43:11 PM
    Author : Administrator
    -->
    <jsp:root version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:webuijsf="http://www.sun.com/webui/webuijsf">
    <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
    <f:view>
    <webuijsf:page binding="#{Department.page1}" id="page1">
    <webuijsf:html binding="#{Department.html1}" id="html1">
    <webuijsf:head binding="#{Department.head1}" id="head1">
    <webuijsf:link binding="#{Department.link1}" id="link1" url="/resources/stylesheet.css"/>
    </webuijsf:head>
    <webuijsf:body binding="#{Department.body1}" id="body1" style="-rave-layout: grid">
    <webuijsf:form binding="#{Department.form1}" id="form1">
    <h:dataTable binding="#{Department.myDataTable}" id="myDataTable" value="#{Department.listtt}" var="dataItem">
    <h:column>
    <f:facet name="header">
    <h:outputText value="Departments"/>
    </f:facet>
    <h:inputText value="#{dataItem.department}"/>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="StockItem"/>
    </f:facet>
    <h:inputText value="#{dataItem.stockItem}"/>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="StockUnit"/>
    </f:facet>
    <h:inputText value="#{dataItem.stockUnit}"/>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="MaxStock"/>
    </f:facet>
    <h:inputText value="#{dataItem.maxStock}"/>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="MinStock"/>
    </f:facet>
    <h:inputText value="#{dataItem.minStock}"/>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="ReorderLevel"/>
    </f:facet>
    <h:inputText value="#{dataItem.reorderlevel}"/>
    </h:column>
    </h:dataTable>
    <h:commandButton action="#{Department.addDataItem}" value="Add"/>
    </webuijsf:form>
    </webuijsf:body>
    </webuijsf:html>
    </webuijsf:page>
    </f:view>
    </jsp:root>
    i dont know wats the problem??
    pls send a sample code to add n items

  • Dynamic faces and Internet Explorer

    Thanks for taking a second to read my post, i hope you can help. I am almost complete with my web app using Netbeans VWP and Dynamic Faces. I have come across a simple application that i can not get working in Internet Explorer and as simple as it is I am surprised that it is not working. I cant believe that the Dynamic Faces team would just ignore compatability with IE altogether. Basically i am trying to get AJAX interaction going on by adding text into a textbox and adding a new DynaFaces.fireAjaxTransaction(this); to the submit however it does not seem to work. Maybe you can help...
    Here is my page:
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:webuijsf="http://www.sun.com/webui/webuijsf">
        <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
        <f:view>
            <webuijsf:page binding="#{testies.page1}" id="page1">
                <webuijsf:html binding="#{testies.html1}" id="html1">
                    <webuijsf:head binding="#{testies.head1}" debug="true" id="head1">
                        <webuijsf:link binding="#{testies.link1}" id="link1" url="/resources/stylesheet.css"/>
                    </webuijsf:head>
                    <webuijsf:body binding="#{testies.body1}" focus="form1:layoutPanel1:textField1" id="body1" style="-rave-layout: grid">
                        <webuijsf:form binding="#{testies.form1}" id="form1">
                            <webuijsf:button actionExpression="#{testies.button1_action}" binding="#{testies.button1}" id="button1"
                                onClick="new DynaFaces.fireAjaxTransaction(this);" style="left: 144px; top: 110px; position: absolute" text="Button"/>
                            <webuijsf:staticText binding="#{testies.staticText1}" id="staticText1" style="position: absolute; left: 170px; top: 185px"/>
                            <webuijsf:textField binding="#{testies.textField1}" id="textField1" style="position: absolute; left: 75px; top: 55px"/>
                        </webuijsf:form>
                    </webuijsf:body>
                </webuijsf:html>
            </webuijsf:page>
        </f:view>
    </jsp:root>-------------------------------------
    Here is my backing bean:
    * testies.java
    * Created on July 10, 2007, 8:39 PM
    package mypkg;
    import com.sun.rave.web.ui.appbase.AbstractPageBean;
    import com.sun.webui.jsf.component.Body;
    import com.sun.webui.jsf.component.Button;
    import com.sun.webui.jsf.component.Form;
    import com.sun.webui.jsf.component.Head;
    import com.sun.webui.jsf.component.Html;
    import com.sun.webui.jsf.component.Link;
    import com.sun.webui.jsf.component.Page;
    import com.sun.webui.jsf.component.PanelGroup;
    import com.sun.webui.jsf.component.PanelLayout;
    import com.sun.webui.jsf.component.StaticText;
    import com.sun.webui.jsf.component.TextField;
    import javax.faces.FacesException;
    import javax.faces.component.html.HtmlPanelGrid;
    * <p>Page bean that corresponds to a similarly named JSP page.  This
    * class contains component definitions (and initialization code) for
    * all components that you have defined on this page, as well as
    * lifecycle methods and event handlers where you may add behavior
    * to respond to incoming events.</p>
    public class testies extends AbstractPageBean {
        // <editor-fold defaultstate="collapsed" desc="Managed Component Definition">
        private int __placeholder;
         * <p>Automatically managed component initialization.  <strong>WARNING:</strong>
         * This method is automatically generated, so any user-specified code inserted
         * here is subject to being replaced.</p>
        private void _init() throws Exception {
        private Page page1 = new Page();
        public Page getPage1() {
            return page1;
        public void setPage1(Page p) {
            this.page1 = p;
        private Html html1 = new Html();
        public Html getHtml1() {
            return html1;
        public void setHtml1(Html h) {
            this.html1 = h;
        private Head head1 = new Head();
        public Head getHead1() {
            return head1;
        public void setHead1(Head h) {
            this.head1 = h;
        private Link link1 = new Link();
        public Link getLink1() {
            return link1;
        public void setLink1(Link l) {
            this.link1 = l;
        private Body body1 = new Body();
        public Body getBody1() {
            return body1;
        public void setBody1(Body b) {
            this.body1 = b;
        private Form form1 = new Form();
        public Form getForm1() {
            return form1;
        public void setForm1(Form f) {
            this.form1 = f;
        private TextField textField1 = new TextField();
        public TextField getTextField1() {
            return textField1;
        public void setTextField1(TextField tf) {
            this.textField1 = tf;
        private Button button1 = new Button();
        public Button getButton1() {
            return button1;
        public void setButton1(Button b) {
            this.button1 = b;
        private StaticText staticText1 = new StaticText();
        public StaticText getStaticText1() {
            return staticText1;
        public void setStaticText1(StaticText st) {
            this.staticText1 = st;
        // </editor-fold>
         * <p>Construct a new Page bean instance.</p>
        public testies() {
         * <p>Callback method that is called whenever a page is navigated to,
         * either directly via a URL, or indirectly via page navigation.
         * Customize 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.</p>
         * <p>Note that, if the current request is a postback, the property
         * values of the components do <strong>not</strong> represent any
         * values submitted with this request.  Instead, they represent the
         * property values that were saved for this view when it was rendered.</p>
        public void init() {
            // Perform initializations inherited from our superclass
            super.init();
            // Perform application initialization that must complete
            // *before* managed components are initialized
            // TODO - add your own initialiation code here
            // <editor-fold defaultstate="collapsed" desc="Managed Component Initialization">
            // Initialize automatically managed components
            // *Note* - this logic should NOT be modified
            try {
                _init();
            } catch (Exception e) {
                log("testies Initialization Failure", e);
                throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
            // </editor-fold>
            // Perform application initialization that must complete
            // *after* managed components are initialized
            // TODO - add your own initialization code here
         * <p>Callback method that is called after the component tree has been
         * restored, but before any event processing takes place.  This method
         * will <strong>only</strong> be called on a postback request that
         * is processing a form submit.  Customize this method to allocate
         * resources that will be required in your event handlers.</p>
        public void preprocess() {
         * <p>Callback method that is called just before rendering takes place.
         * This method will <strong>only</strong> be called for the page that
         * will actually be rendered (and not, for example, on a page that
         * handled a postback and then navigated to a different page).  Customize
         * this method to allocate resources that will be required for rendering
         * this page.</p>
        public void prerender() {
         * <p>Callback method that is called after rendering is completed for
         * this request, if <code>init()</code> was called (regardless of whether
         * or not this was the page that was actually rendered).  Customize this
         * method to release resources acquired in the <code>init()</code>,
         * <code>preprocess()</code>, or <code>prerender()</code> methods (or
         * acquired during execution of an event handler).</p>
        public void destroy() {
         * <p>Return a reference to the scoped data bean.</p>
        protected ApplicationBean1 getApplicationBean1() {
            return (ApplicationBean1)getBean("ApplicationBean1");
         * <p>Return a reference to the scoped data bean.</p>
        protected RequestBean1 getRequestBean1() {
            return (RequestBean1)getBean("RequestBean1");
         * <p>Return a reference to the scoped data bean.</p>
        protected SessionBean1 getSessionBean1() {
            return (SessionBean1)getBean("SessionBean1");
        // Get the text from the textbox and set it in the staticTextField
        public String button1_action() {
            String str = (String)textField1.getValue();
            staticText1.setText(str);
            return null;
    }Any help is appreciated. thx.
    Message was edited by:
    b12s

    > Hello. I have a problem with a Remote Panel and Internet Explorer. I
    > create a measurement system in LabVIEW. It?s composed of a main front
    > panel and a few subVIs with independent front panels opened from main
    > Front Panel when I press appropriate button.
    I think you have two options. You can open most modal subVI panels
    directly on a remote machine. The popup panels won't be in a web page,
    but it will work with few changes.
    A second approach would be to change the app slightly. The buttons that
    launch the subVIs will turn into URL links. The links will open a web
    page with a different embedded panel.
    Greg McKaskle

  • Calling a method from a UICommand Object

    How do I call an action method from a UICommand object?
    I create a HtmlCommandLink in my backing bean, and I think I should be setting the action, but with what? The method takes a MethodBinding but I can't find much detail on how to get that. I just want to call a method like linkAction1_action() in the example below, but you cannot pass a method.
    public class Page1 extends AbstractPageBean {
      private HtmlPanelGroup panel = new HtmlPanelGroup();
      public HtmlPanelGroup getPanel() {
        return panel;
      public void setPanel(HtmlPanelGroup panel) {
        this.panel = panel;
      public Page1() {
        HtmlCommandLink link = new HtmlCommandLink();
        link.setAction(/* what do I put here */);
        this.panel.getChildren().add(link);
      public String linkAction1_action() {
        return "GoBack";
    }

    OK. A couple days later and I am able to answer my
    own question. Anyway, I will lay it out there for
    anyone interested. This worked for me...
    public class Page1 extends AbstractPageBean {
    private HtmlPanelGroup panel = new HtmlPanelGroup();
    public HtmlPanelGroup getPanel() {
    return panel;
    public void setPanel(HtmlPanelGroup panel) {
    this.panel = panel;
    public Page1() {
    HtmlCommandLink link = new HtmlCommandLink();
    link.setAction(
    FacesContext.getCurrentInstance()
    .getApplication()
    .createMethodBinding("#{Page1.linkAction1_action}",
    new Class[0]));
    this.panel.getChildren().add(link);
    public String linkAction1_action() {
    return "GoBack";
    Since you're setting the action from within the Page1 object, why don't you create a method binding manually? This will be much more performant that using the application to create and EL-based binding.
    Try:
    link.setAction(new MethodBinding()
          public Object invoke(FacesContext facesContext, Object[] objects) throws EvaluationException, MethodNotFoundException
            return linkAction1_action();
          public Class getType(FacesContext facesContext) throws MethodNotFoundException
            return String.class;
    });Note that you also avoid any naming convention - you do not require your Page1 object to be configured as a managed bean "Page1".

  • Calling a TextFields get method from another class as a String

    This is my first post so be kind....
    I'm trying to create a login screen with Java Studio Creator. The Login.jsp has a Text Field for both the username and password. JSC automatically created get and set methods for these.
    public class Login extends AbstractPageBean
    private TextField usernameTF = new TextField();
    public TextField getUsernameTF() {
    return usernameTF;
    public void setUsernameTF(TextField tf) {
    this.usernameTF = tf;
    private PasswordField passwordTF = new PasswordField();
    public PasswordField getPasswordTF() {
    return passwordTF;
    public void setPasswordTF(PasswordField pf) {
    this.passwordTF = pf;
    My problem is in trying to call these methods from another class and return the value as a string.
    Any help on this matter would be greatly appreciated.

    the method returns the textfield, so you just need to get its text
    import java.awt.*;
    class Testing
      public Testing()
        Login login = new Login();
        System.out.println(login.getUsernameTF().getText());//<----
      public static void main(String[] args){new Testing();}
    class Login
    private TextField usernameTF = new TextField("Joe Blow");
    public TextField getUsernameTF() {
        return usernameTF;
    }

  • Error due to drop down menu in the dataTable

    I have a data table which has a drop down menu in one of the table columns. When the drop down menu is disabled, every action in the page works (click on it, and it does what it does). When the drop down menu is enabled, every action (with one exception) in the page does not work (click on it, it refreshes the page, but the action is not fired). I cannot debug the thing because the action is not fired at all.
    The exception is that for buttons that is marked as immediate, it works. I created an inline message, and wire that to the dropdown menu. I do not see any error. Looking into the log file, I do not see anything.
    I was suspecting maybe conversion error. The data value for the drop down menu is integer (I try both setting the convert to integer and nothing). Even there's error in conversion, there should be error message showing up (in the inline message box).
    So, again, how do I diagnos this, and to find out what is going on?
    Thank you very much.
    Vh.

    Thank you for your attention.
    The bug link is:
    https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=51
    I thought I could add attachment afterward, but I couldn't. Please add these for me:
    //////////////////////////////////////////////////// Page3.jsp //////////////////////////////////////////////////////////////////
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page">
        <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
        <f:view>
            <html lang="en-US" xml:lang="en-US">
                <head>
                    <meta content="no-cache" http-equiv="Cache-Control"/>
                    <meta content="no-cache" http-equiv="Pragma"/>
                    <title>Page3 Title</title>
                    <link href="resources/stylesheet.css" rel="stylesheet" type="text/css"/>
                </head>
                <body style="-rave-layout: grid">
                    <h:form binding="#{Page3.form1}" id="form1">
                        <h:dataTable binding="#{Page3.dataTable1}" headerClass="list-header" id="dataTable1" rowClasses="list-row-even,list-row-odd"
                            style="height: 111px; left: 60px; top: 120px; position: absolute" value="#{Page3.dataTable1Model}" var="currentRow" width="360">
                            <h:column binding="#{Page3.column1}" id="column1">
                                <h:outputText binding="#{Page3.outputText1}" id="outputText1" value="#{currentRow.c1}"/>
                                <f:facet name="header">
                                    <h:outputText binding="#{Page3.outputText2}" id="outputText2" value="column1"/>
                                </f:facet>
                            </h:column>
                            <h:column binding="#{Page3.column2}" id="column2">
                                <h:outputText binding="#{Page3.outputText3}" id="outputText3" value="#{currentRow.c2}"/>
                                <f:facet name="header">
                                    <h:outputText binding="#{Page3.outputText4}" id="outputText4" value="column2"/>
                                </f:facet>
                            </h:column>
                            <h:column binding="#{Page3.column3}" id="column3">
                                <f:facet name="header">
                                    <h:outputText binding="#{Page3.outputText6}" id="outputText6" value="column3"/>
                                </f:facet>
                                <h:selectOneMenu binding="#{Page3.dropdown1}" converter="#{Page3.integerConverter1}" id="dropdown1" value="#{currentRow.c3}">
                                    <f:selectItems binding="#{Page3.dropdown1SelectItems}" id="dropdown1SelectItems" value="#{Page3.dropdown1DefaultItems}" />
                                </h:selectOneMenu>
                            </h:column>
                        </h:dataTable>
                        <h:outputText binding="#{Page3.outputMesg}" id="outputMesg" style="height: 32px; left: 240px; top: 50px; position: absolute; width: 180px"/>
                        <h:outputText binding="#{Page3.outputText8}" id="outputText8" style="height: 30px; left: 60px; top: 50px; position: absolute; width: 162px" value="Message:"/>
                        <h:commandButton action="#{Page3.button1_action}" binding="#{Page3.button1}" id="button1"
                            style="height: 25px; left: 300px; top: 260px; position: absolute; width: 109px" value="Say Hello"/>
                        <h:message binding="#{Page3.inlineMessage1}" errorClass="errorMessage" fatalClass="fatalMessage" for="dropdown1" id="inlineMessage1"
                            infoClass="infoMessage" showDetail="false" showSummary="true"
                            style="height: 102px; left: 60px; top: 300px; position: absolute; width: 360px" warnClass="warnMessage"/>
                        <h:outputText binding="#{Page3.outputText5}" id="outputText5" style="height: 30px; left: 60px; top: 260px; position: absolute; width: 120px" value="Error Message:"/>
                    </h:form>
                </body>
            </html>
        </f:view>
    </jsp:root>//////////////////////////////////////////////////// Page3.java //////////////////////////////////////////////////////////////////
    * Page3.java
    * Created on August 10, 2004, 10:35 AM
    * Copyright hovh
    package webapplication1;
    import javax.faces.*;
    import com.sun.jsfcl.app.*;
    import javax.faces.component.html.*;
    import com.sun.jsfcl.data.*;
    import java.util.*;
    import javax.faces.component.*;
    import javax.faces.convert.*;
    public class Page3 extends AbstractPageBean {
        // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Definition">
        private int __placeholder;
        private HtmlForm form1 = new HtmlForm();
        public HtmlForm getForm1() {
            return form1;
        public void setForm1(HtmlForm hf) {
            this.form1 = hf;
        private HtmlDataTable dataTable1 = new HtmlDataTable();
        public HtmlDataTable getDataTable1() {
            return dataTable1;
        public void setDataTable1(HtmlDataTable hdt) {
            this.dataTable1 = hdt;
        private DefaultTableDataModel dataTable1Model = new DefaultTableDataModel();
        public DefaultTableDataModel getDataTable1Model() {
            return dataTable1Model;
        public void setDataTable1Model(DefaultTableDataModel dtdm) {
            this.dataTable1Model = dtdm;
        private UIColumn column1 = new UIColumn();
        public UIColumn getColumn1() {
            return column1;
        public void setColumn1(UIColumn uic) {
            this.column1 = uic;
        private HtmlOutputText outputText1 = new HtmlOutputText();
        public HtmlOutputText getOutputText1() {
            return outputText1;
        public void setOutputText1(HtmlOutputText hot) {
            this.outputText1 = hot;
        private HtmlOutputText outputText2 = new HtmlOutputText();
        public HtmlOutputText getOutputText2() {
            return outputText2;
        public void setOutputText2(HtmlOutputText hot) {
            this.outputText2 = hot;
        private UIColumn column2 = new UIColumn();
        public UIColumn getColumn2() {
            return column2;
        public void setColumn2(UIColumn uic) {
            this.column2 = uic;
        private HtmlOutputText outputText3 = new HtmlOutputText();
        public HtmlOutputText getOutputText3() {
            return outputText3;
        public void setOutputText3(HtmlOutputText hot) {
            this.outputText3 = hot;
        private HtmlOutputText outputText4 = new HtmlOutputText();
        public HtmlOutputText getOutputText4() {
            return outputText4;
        public void setOutputText4(HtmlOutputText hot) {
            this.outputText4 = hot;
        private UIColumn column3 = new UIColumn();
        public UIColumn getColumn3() {
            return column3;
        public void setColumn3(UIColumn uic) {
            this.column3 = uic;
        private HtmlOutputText outputText6 = new HtmlOutputText();
        public HtmlOutputText getOutputText6() {
            return outputText6;
        public void setOutputText6(HtmlOutputText hot) {
            this.outputText6 = hot;
        private HtmlOutputText outputMesg = new HtmlOutputText();
        public HtmlOutputText getOutputMesg() {
            return outputMesg;
        public void setOutputMesg(HtmlOutputText hot) {
            this.outputMesg = hot;
        private HtmlOutputText outputText8 = new HtmlOutputText();
        public HtmlOutputText getOutputText8() {
            return outputText8;
        public void setOutputText8(HtmlOutputText hot) {
            this.outputText8 = hot;
        private HtmlCommandButton button1 = new HtmlCommandButton();
         * Holds value of property tableData.
        private ArrayList tableData;
        public HtmlCommandButton getButton1() {
            return button1;
        public void setButton1(HtmlCommandButton hcb) {
            this.button1 = hcb;
        private HtmlSelectOneMenu dropdown1 = new HtmlSelectOneMenu();
        public HtmlSelectOneMenu getDropdown1() {
            return dropdown1;
        public void setDropdown1(HtmlSelectOneMenu hsom) {
            this.dropdown1 = hsom;
        private DefaultSelectItemsArray dropdown1DefaultItems = new DefaultSelectItemsArray();
        public DefaultSelectItemsArray getDropdown1DefaultItems() {
            return dropdown1DefaultItems;
        public void setDropdown1DefaultItems(DefaultSelectItemsArray dsia) {
            this.dropdown1DefaultItems = dsia;
        private UISelectItems dropdown1SelectItems = new UISelectItems();
        public UISelectItems getDropdown1SelectItems() {
            return dropdown1SelectItems;
        public void setDropdown1SelectItems(UISelectItems uisi) {
            this.dropdown1SelectItems = uisi;
        private IntegerConverter integerConverter1 = new IntegerConverter();
        public IntegerConverter getIntegerConverter1() {
            return integerConverter1;
        public void setIntegerConverter1(IntegerConverter ic) {
            this.integerConverter1 = ic;
        private HtmlMessage inlineMessage1 = new HtmlMessage();
        public HtmlMessage getInlineMessage1() {
            return inlineMessage1;
        public void setInlineMessage1(HtmlMessage hm) {
            this.inlineMessage1 = hm;
        private HtmlOutputText outputText5 = new HtmlOutputText();
        public HtmlOutputText getOutputText5() {
            return outputText5;
        public void setOutputText5(HtmlOutputText hot) {
            this.outputText5 = hot;
        // </editor-fold>
        public Page3() {
            // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
            try {
                dropdown1DefaultItems.setItems(new String[] {"1", "2", "3"});
            } catch (Exception e) {
                log("Page3 Initialization Failure", e);
                throw e instanceof javax.faces.FacesException ? (FacesException) e : new FacesException(e);
            // </editor-fold>
            // Additional user provided initialization code
            tableData = new ArrayList();
            tableData.add(new webapplication1.TableEntry("c1_1", "c2_1", 1));
            tableData.add(new webapplication1.TableEntry("c1_2", "c2_2", 2));
            tableData.add(new webapplication1.TableEntry("c1_3", "c2_3", 3));
            this.dataTable1Model.setWrappedData(tableData);
        protected webapplication1.ApplicationBean1 getApplicationBean1() {
            return (webapplication1.ApplicationBean1)getBean("ApplicationBean1");
        protected webapplication1.SessionBean1 getSessionBean1() {
            return (webapplication1.SessionBean1)getBean("SessionBean1");
         * Bean cleanup.
        protected void afterRenderResponse() {
         * Getter for property tableData.
         * @return Value of property tableData.
        public ArrayList getTableData() {
            return this.tableData;
         * Setter for property tableData.
         * @param tableData New value of property tableData.
        public void setTableData(ArrayList tableData) {
            this.tableData = tableData;
        public String button1_action() {
            // User event code here...
            this.outputMesg.setValue("Hello world!");
            return null;
    }//////////////////////////////////////////////////// TableEntry.java //////////////////////////////////////////////////////////////////
    * TableEntry.java
    * Created on September 3, 2004, 2:38 PM
    package webapplication1;
    * @author  hovh
    public class TableEntry  {
        String c1;
        String c2;
        int c3;
        String c3Str;
        public TableEntry(String c1, String c2, int c3){
            this.c1 = c1;
            this.c2 = c2;
            this.c3 = c3;
        public String getC1() {
            return c1;
        public void setC1(String c1) {
            this.c1 = c1;
        public int getC3() {
            return c3;
        public void setC3(int c3) {
            this.c3 = c3;
        public String getC2() {
            return c2;
        public void setC2(String c2) {
            this.c2 = c2;
        public java.lang.String getC3Str() {
         return "" + c3;
        public void setC3Str(java.lang.String c3Str) {
         this.c3Str = c3Str;
         try{
             c3 = Integer.parseInt(c3Str);
         }catch(Exception e){

  • Help for a JDBC dummy

    OK I'm new to this and would love someone's help.
    I'm trying to just access a mySQL DB to check a user's name and password after the user enters name and password then clicks on login button. This code generates the page but when you enter the user name and password it blanks the password and doesn't output the text message.
    How do you tie together the WHERE PW = ? with the password entered field? I've tried to do it in the logon_action but it doesn't seem to be the way to do it.
    Any help greatly appreciated.
    RA
    [codepublic class Page1 extends AbstractPageBean {
        // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Definition">
        private int __placeholder;
        private HtmlForm form1 = new HtmlForm();
        public HtmlForm getForm1() {
            return form1;
    public void setForm1(HtmlForm hf) {
    this.form1 = hf;
    private HtmlOutputText userName1 = new HtmlOutputText();
    public HtmlOutputText getUserName1() {
    return userName1;
    public void setUserName1(HtmlOutputText hot) {
    this.userName1 = hot;
    private HtmlInputText user = new HtmlInputText();
    public HtmlInputText getUser() {
    return user;
    public void setUser(HtmlInputText hit) {
    this.user = hit;
    private HtmlOutputText password = new HtmlOutputText();
    public HtmlOutputText getPassword() {
    return password;
    public void setPassword(HtmlOutputText hot) {
    this.password = hot;
    private HtmlInputSecret password1 = new HtmlInputSecret();
    public HtmlInputSecret getPassword1() {
    return password1;
    public void setPassword1(HtmlInputSecret his) {
    this.password1 = his;
    private HtmlGraphicImage image1 = new HtmlGraphicImage();
    public HtmlGraphicImage getImage1() {
    return image1;
    public void setImage1(HtmlGraphicImage hgi) {
    this.image1 = hgi;
    private HtmlOutputText outputText1 = new HtmlOutputText();
    public HtmlOutputText getOutputText1() {
    return outputText1;
    public void setOutputText1(HtmlOutputText hot) {
    this.outputText1 = hot;
    private HtmlCommandButton logon = new HtmlCommandButton();
    public HtmlCommandButton getLogon() {
    return logon;
    public void setLogon(HtmlCommandButton hcb) {
    this.logon = hcb;
    private JdbcRowSetXImpl usersRowSet = new JdbcRowSetXImpl();
    public JdbcRowSetXImpl getUsersRowSet() {
    return usersRowSet;
    public void setUsersRowSet(JdbcRowSetXImpl jrsxi) {
    this.usersRowSet = jrsxi;
    private HtmlOutputText outputText2 = new HtmlOutputText();
    public HtmlOutputText getOutputText2() {
    return outputText2;
    public void setOutputText2(HtmlOutputText hot) {
    this.outputText2 = hot;
    private HtmlMessage inlineMessage1 = new HtmlMessage();
    public HtmlMessage getInlineMessage1() {
    return inlineMessage1;
    public void setInlineMessage1(HtmlMessage hm) {
    this.inlineMessage1 = hm;
    private HtmlMessages messageList1 = new HtmlMessages();
    public HtmlMessages getMessageList1() {
    return messageList1;
    public void setMessageList1(HtmlMessages hm) {
    this.messageList1 = hm;
    // </editor-fold>
    public Page1() {
    // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
    try {
    usersRowSet.setDataSourceName("java:comp/env/jdbc/api");
    usersRowSet.setCommand("SELECT ALL users.User_Name, users.PW FROM users WHERE users.User_Name=?");
    } catch (Exception e) {
    log("Page1 Initialization Failure", e);
    throw e instanceof javax.faces.FacesException ? (FacesException) e : new FacesException(e);
    // </editor-fold>
    // Additional user provided initialization code
    protected serviceact.SessionBean1 getSessionBean1() {
    return (serviceact.SessionBean1)getBean("SessionBean1");
    protected serviceact.ApplicationBean1 getApplicationBean1() {
    return (serviceact.ApplicationBean1)getBean("ApplicationBean1");
    * Bean cleanup.
    protected void afterRenderResponse() {
    usersRowSet.close();
    public void user_processValueChange(ValueChangeEvent vce) {
    // User event code here...
    public String logon_action() {
    // User event code here...
    String msg = "";
    String username = (String) user.getValue();
    String pw = (String) password1.getValue();
    String getPW = "";
    try {
    usersRowSet.setCommand("SELECT User_Name,PW FROM users WHERE User_Name ="+username);
    usersRowSet.execute();
    usersRowSet.next();
    outputText2.setValue("What the hell is going on?");
    if (usersRowSet.isAfterLast()) {
    msg = "User not found!";
    else {
    getPW = usersRowSet.getString("PW");
    if (getPW != pw) msg= "Password invalid!";
    else msg="User Logged On!";
    msg = username+" "+msg;
    catch (java.sql.SQLException ex) {
    log("Failed to execute logon method " + ex);
    } catch (Exception e) {
    error("Update Exception: " + e);
    //outputText2.setValue(msg);
    return null;
    ]

    Hi,
    The "Using Databound Components to Access Databases" tutorial will be of immense help to solve your problem. For steps on how to pass a parameter you will find the answer on page 6. Kindly go through this tutorial completely.
    You could also go through the code of the AppModel sample application.
    Hope this helps you.
    Cheers :-)

  • Data Table will not bind to Dropdown List selection

    I get the following error when I try to use my own database tables (As in the "Using Databound Components to Access Databases" tutorial). It is a Oracle9i database. The Table (Vehicle)I use to populate the Dropdown List has around 450 000 rows, and the ComponentRowset returns 362 000 rows when run without a parameter.
    Exception Details: javax.faces.el.EvaluationException
    java.lang.NullPointerException
    Possible Source of Error:
    Class Name: com.sun.faces.el.ValueBindingImpl
    File Name: ValueBindingImpl.java
    Method Name: getValue
    Line Number: 206
    Please help! What am I doing wrong? As far as I can see the code is identical to the "Using Databound Components to Access Databases" tutorial.
    Here is the code:
    * Page1.java
    * Created on 12 October 2004, 05:56
    * Copyright jgenis
    package ucodapp;
    import javax.faces.*;
    import com.sun.jsfcl.app.*;
    import javax.faces.component.html.*;
    import com.sun.jsfcl.data.*;
    import javax.faces.component.*;
    import com.sun.sql.rowset.*;
    import javax.faces.event.*;
    import javax.faces.convert.*;
    public class Page1 extends AbstractPageBean {
        // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Definition">
        private int __placeholder;
        private HtmlForm form1 = new HtmlForm();
        public HtmlForm getForm1() {
            return form1;
        public void setForm1(HtmlForm hf) {
            this.form1 = hf;
        private HtmlDataTable dataTable1 = new HtmlDataTable();
        public HtmlDataTable getDataTable1() {
            return dataTable1;
        public void setDataTable1(HtmlDataTable hdt) {
            this.dataTable1 = hdt;
        private JdbcRowSetXImpl componentRowSet = new JdbcRowSetXImpl();
        public JdbcRowSetXImpl getComponentRowSet() {
            return componentRowSet;
        public void setComponentRowSet(JdbcRowSetXImpl jrsxi) {
            this.componentRowSet = jrsxi;
        private HtmlOutputLabel componentLabel1 = new HtmlOutputLabel();
        public HtmlOutputLabel getComponentLabel1() {
            return componentLabel1;
        public void setComponentLabel1(HtmlOutputLabel hol) {
            this.componentLabel1 = hol;
        private HtmlOutputText componentLabel1Text = new HtmlOutputText();
        public HtmlOutputText getComponentLabel1Text() {
            return componentLabel1Text;
        public void setComponentLabel1Text(HtmlOutputText hot) {
            this.componentLabel1Text = hot;
        private UIColumn column1 = new UIColumn();
        public UIColumn getColumn1() {
            return column1;
        public void setColumn1(UIColumn uic) {
            this.column1 = uic;
        private HtmlOutputText outputText1 = new HtmlOutputText();
        public HtmlOutputText getOutputText1() {
            return outputText1;
        public void setOutputText1(HtmlOutputText hot) {
            this.outputText1 = hot;
        private HtmlOutputText outputText2 = new HtmlOutputText();
        public HtmlOutputText getOutputText2() {
            return outputText2;
        public void setOutputText2(HtmlOutputText hot) {
            this.outputText2 = hot;
        private UIColumn column2 = new UIColumn();
        public UIColumn getColumn2() {
            return column2;
        public void setColumn2(UIColumn uic) {
            this.column2 = uic;
        private HtmlOutputText outputText3 = new HtmlOutputText();
        public HtmlOutputText getOutputText3() {
            return outputText3;
        public void setOutputText3(HtmlOutputText hot) {
            this.outputText3 = hot;
        private HtmlOutputText outputText4 = new HtmlOutputText();
        public HtmlOutputText getOutputText4() {
            return outputText4;
        public void setOutputText4(HtmlOutputText hot) {
            this.outputText4 = hot;
        private UIColumn column3 = new UIColumn();
        public UIColumn getColumn3() {
            return column3;
        public void setColumn3(UIColumn uic) {
            this.column3 = uic;
        private HtmlOutputText outputText5 = new HtmlOutputText();
        public HtmlOutputText getOutputText5() {
            return outputText5;
        public void setOutputText5(HtmlOutputText hot) {
            this.outputText5 = hot;
        private HtmlOutputText outputText6 = new HtmlOutputText();
        public HtmlOutputText getOutputText6() {
            return outputText6;
        public void setOutputText6(HtmlOutputText hot) {
            this.outputText6 = hot;
        private UIColumn column4 = new UIColumn();
        public UIColumn getColumn4() {
            return column4;
        public void setColumn4(UIColumn uic) {
            this.column4 = uic;
        private HtmlOutputText outputText7 = new HtmlOutputText();
        public HtmlOutputText getOutputText7() {
            return outputText7;
        public void setOutputText7(HtmlOutputText hot) {
            this.outputText7 = hot;
        private HtmlOutputText outputText8 = new HtmlOutputText();
        public HtmlOutputText getOutputText8() {
            return outputText8;
        public void setOutputText8(HtmlOutputText hot) {
            this.outputText8 = hot;
        private UIColumn column5 = new UIColumn();
        public UIColumn getColumn5() {
            return column5;
        public void setColumn5(UIColumn uic) {
            this.column5 = uic;
        private HtmlOutputText outputText9 = new HtmlOutputText();
        public HtmlOutputText getOutputText9() {
            return outputText9;
        public void setOutputText9(HtmlOutputText hot) {
            this.outputText9 = hot;
        private HtmlOutputText outputText10 = new HtmlOutputText();
        public HtmlOutputText getOutputText10() {
            return outputText10;
        public void setOutputText10(HtmlOutputText hot) {
            this.outputText10 = hot;
        private UIColumn column6 = new UIColumn();
        public UIColumn getColumn6() {
            return column6;
        public void setColumn6(UIColumn uic) {
            this.column6 = uic;
        private HtmlOutputText outputText11 = new HtmlOutputText();
        public HtmlOutputText getOutputText11() {
            return outputText11;
        public void setOutputText11(HtmlOutputText hot) {
            this.outputText11 = hot;
        private HtmlOutputText outputText12 = new HtmlOutputText();
        public HtmlOutputText getOutputText12() {
            return outputText12;
        public void setOutputText12(HtmlOutputText hot) {
            this.outputText12 = hot;
        private UIColumn column7 = new UIColumn();
        public UIColumn getColumn7() {
            return column7;
        public void setColumn7(UIColumn uic) {
            this.column7 = uic;
        private HtmlOutputText outputText13 = new HtmlOutputText();
        public HtmlOutputText getOutputText13() {
            return outputText13;
        public void setOutputText13(HtmlOutputText hot) {
            this.outputText13 = hot;
        private HtmlOutputText outputText14 = new HtmlOutputText();
        public HtmlOutputText getOutputText14() {
            return outputText14;
        public void setOutputText14(HtmlOutputText hot) {
            this.outputText14 = hot;
        private RowSetDataModel dataTable1Model = new RowSetDataModel();
        public RowSetDataModel getDataTable1Model() {
            return dataTable1Model;
        public void setDataTable1Model(RowSetDataModel rsdm) {
            this.dataTable1Model = rsdm;
        private HtmlSelectOneMenu dropdown1 = new HtmlSelectOneMenu();
        public HtmlSelectOneMenu getDropdown1() {
            return dropdown1;
        public void setDropdown1(HtmlSelectOneMenu hsom) {
            this.dropdown1 = hsom;
        private UISelectItems dropdown1SelectItems = new UISelectItems();
        public UISelectItems getDropdown1SelectItems() {
            return dropdown1SelectItems;
        public void setDropdown1SelectItems(UISelectItems uisi) {
            this.dropdown1SelectItems = uisi;
        private JdbcRowSetXImpl vehicleRowSet = new JdbcRowSetXImpl();
        public JdbcRowSetXImpl getVehicleRowSet() {
            return vehicleRowSet;
        public void setVehicleRowSet(JdbcRowSetXImpl jrsxi) {
            this.vehicleRowSet = jrsxi;
        private BigDecimalConverter dropdown1Converter = new BigDecimalConverter();
        public BigDecimalConverter getDropdown1Converter() {
            return dropdown1Converter;
        public void setDropdown1Converter(BigDecimalConverter bdc) {
            this.dropdown1Converter = bdc;
        // </editor-fold>
        public Page1() {
            // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
            try {
                componentRowSet.setDataSourceName("java:comp/env/jdbc/CDS");
                componentRowSet.setCommand("SELECT ALL TRACKER.COMPONENT.PINNO, TRACKER.COMPONENT.UNITCODE, TRACKER.COMPONENT.INSTALLEDDATE, TRACKER.COMPONENT.INSTALLREPORTNO, TRACKER.COMPONENT.TNUSERIALNO, TRACKER.VEHICLE.REGNO, TRACKER.VEHICLE.VINNO, TRACKER.VEHICLE.VEHICLEID, TRACKER.TRACKERAGREEMENT.TAID, TRACKER.TAPRODUCT.TAPRODUCTID, TRACKER.COMPONENT.COMPONENTID, TRACKER.COMPONENT.TAPRODUCTID, TRACKER.COMPONENT.COMPONENTTYPEID, TRACKER.COMPONENT.INSTALLERID, TRACKER.TAPRODUCT.TAID, TRACKER.TAPRODUCT.PRODUCTTYPEID, TRACKER.TAPRODUCT.TAPRODUCTSTATUSID, TRACKER.TAPRODUCT.PRORATANRDAYS, TRACKER.TAPRODUCT.CONTRACTPERIOD, TRACKER.TAPRODUCT.BILLINGFREQUENCYID, TRACKER.TAPRODUCT.CANCELLATIONDATE, TRACKER.TAPRODUCT.STARTDATE, TRACKER.TAPRODUCT.SOURCEID, TRACKER.TAPRODUCT.PRICINGDATE, TRACKER.TAPRODUCT.DEALTYPEID, TRACKER.TAPRODUCT.ACTIONTYPEID, TRACKER.TAPRODUCT.ISSTANDARDBATTERY, TRACKER.TAPRODUCT.AUDITUSERID, TRACKER.TAPRODUCT.AUDITSRID, TRACKER.COMPONENT.SERIALNUMBER, TRACKER.COMPONENT.RECEIVEDDATE, TRACKER.COMPONENT.RESPONSECODE, TRACKER.COMPONENT.REPLYCODE, TRACKER.COMPONENT.ACTIVATIONCODE, TRACKER.COMPONENT.ALERT, TRACKER.COMPONENT.ALTDEACTIVATIONCODE, TRACKER.COMPONENT.INSTALLEDLOCATION, TRACKER.COMPONENT.VERSION, TRACKER.COMPONENT.SOFTWAREVERSION, TRACKER.COMPONENT.CANACTIVATE, TRACKER.COMPONENT.COMPONENTSTATUSID, TRACKER.COMPONENT.SIMNO, TRACKER.COMPONENT.LOCATECELLNO, TRACKER.COMPONENT.AUDITDT, TRACKER.COMPONENT.THEFTNO, TRACKER.TAPRODUCT.STATUSBEFORECANCELLATION, TRACKER.TAPRODUCT.AUDITDT, TRACKER.TRACKERAGREEMENT.VEHICLEID, TRACKER.TRACKERAGREEMENT.CUSTOMERID, TRACKER.TRACKERAGREEMENT.TASTATUSDATE, TRACKER.TRACKERAGREEMENT.TASTATUSID, TRACKER.TRACKERAGREEMENT.AUDITUSERID, TRACKER.TRACKERAGREEMENT.AUDITSRID, TRACKER.TRACKERAGREEMENT.AUDITDT, TRACKER.VEHICLE.MAKEMODELID, TRACKER.VEHICLE.VEHICLECOLOURID, TRACKER.VEHICLE.COLOURSHADEID, TRACKER.VEHICLE.BATTERYID, TRACKER.VEHICLE.INSURERID, TRACKER.VEHICLE.ENGINENO, TRACKER.VEHICLE.CHASSISNO, TRACKER.VEHICLE.POLICYNO, TRACKER.VEHICLE.YEARMODEL, TRACKER.VEHICLE.JOINDATE, TRACKER.VEHICLE.POLICYCOMMENCEDATE, TRACKER.VEHICLE.DESCRIPTION, TRACKER.VEHICLE.ACTIVE, TRACKER.VEHICLE.METALLICIND, TRACKER.VEHICLE.TEMPREGNO, TRACKER.VEHICLE.ORDERNUMBER, TRACKER.VEHICLE.POLICYSEQUENCENO, TRACKER.VEHICLE.AUDITUSERID, TRACKER.VEHICLE.AUDITSRID, TRACKER.VEHICLE.AUDITDT, TRACKER.VEHICLE.THEFTNO  FROM TRACKER.COMPONENT INNER JOIN TRACKER.TAPRODUCT ON TRACKER.COMPONENT.TAPRODUCTID=TRACKER.TAPRODUCT.TAPRODUCTID INNER JOIN TRACKER.TRACKERAGREEMENT ON TRACKER.TAPRODUCT.TAID=TRACKER.TRACKERAGREEMENT.TAID INNER JOIN TRACKER.VEHICLE ON TRACKER.TRACKERAGREEMENT.VEHICLEID=TRACKER.VEHICLE.VEHICLEID WHERE TRACKER.VEHICLE.VEHICLEID=?");
                dataTable1Model.setDataCacheKey("com.sun.datacache.Page1.componentRowSet");
                dataTable1Model.setRowSet(componentRowSet);
                dataTable1Model.setSchemaName("");
                dataTable1Model.setTableName("");
                vehicleRowSet.setDataSourceName("java:comp/env/jdbc/CDS");
                vehicleRowSet.setCommand("SELECT ALL TRACKER.VEHICLE.VEHICLEID, TRACKER.VEHICLE.REGNO  FROM TRACKER.VEHICLE");
                vehicleRowSet.setFetchSize(1000);
            } catch (Exception e) {
                log("Page1 Initialization Failure", e);
                throw e instanceof javax.faces.FacesException ? (FacesException) e : new FacesException(e);
            // </editor-fold>
            // Additional user provided initialization code
            // Initialization Code
            // Part of the Using Databound Components to Access Databases Tutorial
            // You can find this tutorial on the web -- use the link on the Welcome page
            try {
                vehicleRowSet.execute();
                vehicleRowSet.next();
                dataTable1Model.setObject(1, vehicleRowSet.getObject("VEHICLEID"));
            } catch (Exception ex) {
                throw new FacesException(ex);
            } // end try catch
        protected ucodapp.ApplicationBean1 getApplicationBean1() {
            return (ucodapp.ApplicationBean1)getBean("ApplicationBean1");
        protected ucodapp.SessionBean1 getSessionBean1() {
            return (ucodapp.SessionBean1)getBean("SessionBean1");
         * Bean cleanup.
        protected void afterRenderResponse() {
            vehicleRowSet.close();
            vehicleRowSet.close();
            componentRowSet.close();
        public void dropdown1_processValueChange(ValueChangeEvent vce) {
            // Dropdown List Event Code
            // Part of the Using Databound Components to Access Databases Tutorial
            // You can find this tutorial on the web -- use the link on the Welcome page
            try {
                dataTable1Model.setObject(1, dropdown1.getValue());
                dataTable1Model.execute();
            } catch (Exception e) {
                log("vehicle id change exception", e);
                error("Exception changing Vehicle Id: " + e);
            } // end try catch
            // User event code here...

    Take a look at the Page1 constructor.
    It appears that you're trying to bind the datatable to 2
    different rowsets. I suggest to clean up this
    constructor to make sure you're using the right
    rowset.
    Your value binding expressions on each column
    of the datatable may not be set to the right column.
    John
    JSC QA

  • Problem with Non JSF Request to JSF Page

    Hi All,
    I am working on dynamic controls generation based on the request come from non jsf page
    For the first request, pageworks perfectly. but when we go for second request, it is not rendering and I am getting same old page.
    What I have identified is if I have 2 pages as JSF, application is not giving any problem.
    For this I have written small test application contains both JSF pages only.
    page1 contains 3 submit buttons.
    When submit buttons are clicked based on the request, I get, am able to see the dynamic controls.
    SO there is no problem with JSF PAGE to JSF Page Communication
    Now I have done some changes in First JSF page. Instead of submitting directly I am submitting the page through JavaScript which is nonb JSF request. There I am facing the problem and based on requested qaction I am not able to see correct rendered page based on the requested action.
    Any Idea why it is giving problem for non JSF requests??
    Thanks
    Sudhakar

    For Your Convenience in understanding the problem
    I am pasting entire test code
    Page 1 -- (here page2 is Page1 and Page1 is page2 - some naming convention errors :) )
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page">
        <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
        <jsp:text><![CDATA[
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    ]]></jsp:text>
        <f:view>
            <html lang="en-US" xml:lang="en-US">
                <head>
                    <meta content="no-cache" http-equiv="Cache-Control"/>
                    <meta content="no-cache" http-equiv="Pragma"/>
                    <title>Page2 Title</title>
                    <link href="resources/stylesheet.css" rel="stylesheet" type="text/css"/>
                </head>
                <body style="-rave-layout: grid">
                    <h:form binding="#{Page2.form1}" id="form1">
    <!-- Non JSF REquests -->
                        <h:commandButton action="#{Page2.button1_action}" binding="#{Page2.button1}" id="button1" style="left: 48px; top: 48px; position: absolute" value="Submit" onclick="document.forms['form1'].action='faces/Page2.jsp?id=1'; document.forms['form1'].submit(); return false;"/>
                        <h:commandButton action="#{Page2.button2_action}" binding="#{Page2.button2}" id="button2" style="left: 48px; top: 96px; position: absolute" value="Submit" onclick="document.forms['form1'].action='faces/Page2.jsp?id=2'; document.forms['form1'].submit(); return false;"/>
                        <h:commandButton action="#{Page2.button3_action}" binding="#{Page2.button3}" id="button3" style="left: 48px; top: 144px; position: absolute" value="Submit" onclick="document.forms['form1'].action='faces/Page2.jsp?id=3'; document.forms['form1'].submit(); return false;"/>
    <!-- this  is JSF request -->
                        <!--
                        <h:commandButton action="#{Page2.button1_action}" binding="#{Page2.button1}" id="button1" style="left: 48px; top: 48px; position: absolute" value="Submit" />
                        <h:commandButton action="#{Page2.button2_action}" binding="#{Page2.button2}" id="button2" style="left: 48px; top: 96px; position: absolute" value="Submit" />
                        <h:commandButton action="#{Page2.button3_action}" binding="#{Page2.button3}" id="button3" style="left: 48px; top: 144px; position: absolute" value="Submit" />-->
                    </h:form>
                </body>
            </html>
        </f:view>
    </jsp:root>Page1 Bean
    * Page2.java
    * Created on June 25, 2005, 11:08 AM
    * Copyright user
    package webapplication8;
    import javax.faces.*;
    import com.sun.jsfcl.app.*;
    import javax.faces.component.html.*;
    import javax.faces.context.ExternalContext;
    import javax.faces.context.FacesContext;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    public class Page2 extends AbstractPageBean {
        // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Definition">
        private int __placeholder;
        private HtmlForm form1 = new HtmlForm();
        public HtmlForm getForm1() {
            return form1;
        public void setForm1(HtmlForm hf) {
            this.form1 = hf;
        private HtmlCommandButton button1 = new HtmlCommandButton();
        public HtmlCommandButton getButton1() {
            return button1;
        public void setButton1(HtmlCommandButton hcb) {
            this.button1 = hcb;
        private HtmlCommandButton button2 = new HtmlCommandButton();
        public HtmlCommandButton getButton2() {
            return button2;
        public void setButton2(HtmlCommandButton hcb) {
            this.button2 = hcb;
        private HtmlCommandButton button3 = new HtmlCommandButton();
        public HtmlCommandButton getButton3() {
            return button3;
        public void setButton3(HtmlCommandButton hcb) {
            this.button3 = hcb;
        // </editor-fold>
        public Page2() {
            // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
            try {
            } catch (Exception e) {
                log("Page2 Initialization Failure", e);
                throw e instanceof javax.faces.FacesException ? (FacesException) e: new FacesException(e);
            // </editor-fold>
            // Additional user provided initialization code
        protected webapplication8.ApplicationBean1 getApplicationBean1() {
            return (webapplication8.ApplicationBean1)getBean("ApplicationBean1");
        protected webapplication8.SessionBean1 getSessionBean1() {
            return (webapplication8.SessionBean1)getBean("SessionBean1");
         * Bean cleanup.
        protected void afterRenderResponse() {
        public String button1_action()  throws Exception{
            // TODO Following code was replaced by static navigation
           getSessionBean1().setId(1);       
          /* ExternalContext ctx=(ExternalContext)FacesContext.getCurrentInstance().getExternalContext();
           HttpServletRequest req=(HttpServletRequest)ctx.getRequest();
           HttpServletResponse res=(HttpServletResponse)ctx.getResponse();
           res.sendRedirect("http://localhost:18080/webapplication8/faces/Page2.jsp");
           return null;*/
            return "case1";
        public String button2_action()  throws Exception{
            // TODO Following code was replaced by static navigation
                getSessionBean1().setId(2);
          /*  ExternalContext ctx=(ExternalContext)FacesContext.getCurrentInstance().getExternalContext();
           HttpServletRequest req=(HttpServletRequest)ctx.getRequest();
           HttpServletResponse res=(HttpServletResponse)ctx.getResponse();
           res.sendRedirect("http://localhost:18080/webapplication8/faces/Page2.jsp");
           return null;*/
            return "case2";
        public String button3_action() throws Exception{
            // TODO Following code was replaced by static navigation
                getSessionBean1().setId(3);
            /*    ExternalContext ctx=(ExternalContext)FacesContext.getCurrentInstance().getExternalContext();
           HttpServletRequest req=(HttpServletRequest)ctx.getRequest();
           HttpServletResponse res=(HttpServletResponse)ctx.getResponse();
           res.sendRedirect("http://localhost:18080/webapplication8/faces/Page2.jsp");
            return null;*/
            return "case3";
    }page 2
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page">
        <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
        <jsp:text><![CDATA[
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    ]]></jsp:text>
        <f:view>
            <html lang="en-US" xml:lang="en-US">
                <head>
                    <meta content="no-cache" http-equiv="Cache-Control"/>
                    <meta content="no-cache" http-equiv="Pragma"/>
                    <title>Page1 Title</title>
                    <link href="resources/stylesheet.css" rel="stylesheet" type="text/css"/>
                </head>
                <body style="-rave-layout: grid">
                    <h:form binding="#{Page1.form1}" id="form1">
                        <h:panelGrid binding="#{Page1.gridPanel1}" id="gridPanel1" style="left: 96px; top: 48px; position: absolute"/>
                        <f:selectItems binding="#{Page1.radioButtonList1SelectItems1}" id="radioButtonList1SelectItems1"/>
                        <h:commandButton action="#{Page1.button1_action}" binding="#{Page1.button1}" id="button1"
                            style="left: 384px; top: 120px; position: absolute" value="Submit"/>
                        <h:commandButton action="#{Page1.button1_action}" binding="#{Page1.button1}" id="button1" style="left: 384px; top: 72px; position: absolute" value="Submit"/>
                        <h:outputLink binding="#{Page1.hyperlink1}" id="hyperlink1" style="left: 480px; top: 216px; position: absolute" value="http://www.sun.com/jscreator">
                            <h:outputText binding="#{Page1.hyperlink1Text}" id="hyperlink1Text" value="Hyperlink"/>
                        </h:outputLink>
                        <h:commandLink binding="#{Page1.linkAction1}" id="linkAction1" style="left: 456px; top: 264px; position: absolute">
                            <h:outputText binding="#{Page1.linkAction1Text}" id="linkAction1Text" value="Link Action"/>
                        </h:commandLink>
                    </h:form>
                </body>
            </html>
        </f:view>
    </jsp:root>page2 bean
    * Page1.java
    * Created on June 25, 2005, 10:52 AM
    * Copyright user
    package webapplication8;
    import javax.faces.*;
    import com.sun.jsfcl.app.*;
    import com.sun.jsfcl.data.DefaultSelectItemsArray;
    import java.util.Vector;
    import javax.faces.component.UIComponent;
    import javax.faces.component.UISelectItems;
    import javax.faces.component.html.*;
    import javax.faces.context.ExternalContext;
    import javax.faces.context.FacesContext;
    import javax.faces.el.ValueBinding;
    import javax.faces.model.SelectItem;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class Page1 extends AbstractPageBean {
        // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Definition">
        private int __placeholder;
        private HtmlForm form1 = new HtmlForm();
        public HtmlForm getForm1() {
            return form1;
        public void setForm1(HtmlForm hf) {
            this.form1 = hf;
        private HtmlPanelGrid gridPanel1 = new HtmlPanelGrid();
        public HtmlPanelGrid getGridPanel1() {
            return gridPanel1;
        public void setGridPanel1(HtmlPanelGrid hpg) {
            this.gridPanel1 = hpg;
        private HtmlCommandButton button1 = new HtmlCommandButton();
        public HtmlCommandButton getButton1() {
            return button1;
        public void setButton1(HtmlCommandButton hcb) {
            this.button1 = hcb;
        private HtmlOutputLink hyperlink1 = new HtmlOutputLink();
        public HtmlOutputLink getHyperlink1() {
            return hyperlink1;
        public void setHyperlink1(HtmlOutputLink hol) {
            this.hyperlink1 = hol;
        private HtmlOutputText hyperlink1Text = new HtmlOutputText();
        public HtmlOutputText getHyperlink1Text() {
            return hyperlink1Text;
        public void setHyperlink1Text(HtmlOutputText hot) {
            this.hyperlink1Text = hot;
        private HtmlCommandLink linkAction1 = new HtmlCommandLink();
        public HtmlCommandLink getLinkAction1() {
            return linkAction1;
        public void setLinkAction1(HtmlCommandLink hcl) {
            this.linkAction1 = hcl;
        private HtmlOutputText linkAction1Text = new HtmlOutputText();
        public HtmlOutputText getLinkAction1Text() {
            return linkAction1Text;
        public void setLinkAction1Text(HtmlOutputText hot) {
            this.linkAction1Text = hot;
        // </editor-fold>
        public Page1() {
            // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
            try {
                ExternalContext ctx=(ExternalContext)FacesContext.getCurrentInstance().getExternalContext();
                HttpServletRequest req=(HttpServletRequest)ctx.getRequest();
                HttpServletResponse res=(HttpServletResponse)ctx.getResponse();
                String id=req.getParameter("id");
                if(id!=null)
                    getSessionBean1().setId(Integer.parseInt(id));
                if (getSessionBean1().getId()==1) {
                    addTextBox();
                else if (getSessionBean1().getId()==2) {
                    addCheckBox();
                    addRadio();
                else if (getSessionBean1().getId()==3) {
                    addRadio();
                   // addCheckBox();
            } catch (Exception e) {
                log("Page1 Initialization Failure", e);
                throw e instanceof javax.faces.FacesException ? (FacesException) e: new FacesException(e);
            // </editor-fold>
            // Additional user provided initialization code
        protected webapplication8.ApplicationBean1 getApplicationBean1() {
            return (webapplication8.ApplicationBean1)getBean("ApplicationBean1");
        protected webapplication8.SessionBean1 getSessionBean1() {
            return (webapplication8.SessionBean1)getBean("SessionBean1");
         * Bean cleanup.
        protected void afterRenderResponse() {
        private void addRadio() {
            HtmlPanelGrid gridPanel = new HtmlPanelGrid();
            UIComponent parent = gridPanel1;
            HtmlOutputText outputText = new HtmlOutputText();
            outputText.setValue("Some Desc");
            outputText.setId("somedesc2");
            HtmlSelectOneRadio checkBox = new HtmlSelectOneRadio();
            checkBox.setBorder(0);
            checkBox.setLayout("pageDirection");
            checkBox.setId("a3");
            UISelectItems items = new UISelectItems();
            DefaultSelectItemsArray objArray =new DefaultSelectItemsArray();
            vectDefaultSelectItemsArray.add(objArray);
            arrays=(DefaultSelectItemsArray[])vectDefaultSelectItemsArray.toArray(new DefaultSelectItemsArray[vectDefaultSelectItemsArray.size()]);
            int size =arrays.length;
            arrays[size - 1].clear();
            for (int i =0;i<10;i++) {
                arrays[size - 1].add(new SelectItem(""+i+"",""+i));
            // array.setItems(new String[] {"Yes","No" });
            items.setValueBinding("value",getValueBinding("#{Page1.arrays["+(size-1)+"]}"));
            checkBox.getChildren().add(items);
            gridPanel.getChildren().add(outputText);
            gridPanel.getChildren().add(checkBox);
            parent.getChildren().add(gridPanel);
        private void addCheckBox() {
            HtmlPanelGrid gridPanel = new HtmlPanelGrid();
            UIComponent parent = gridPanel1;
            HtmlOutputText outputText = new HtmlOutputText();
            outputText.setValue("Some Desc");
            outputText.setId("somedesc1");
            HtmlSelectManyCheckbox checkBox = new HtmlSelectManyCheckbox();
            checkBox.setBorder(0);
            checkBox.setLayout("pageDirection");
            checkBox.setId("a2");
            UISelectItems items = new UISelectItems();
            DefaultSelectItemsArray objArray =new DefaultSelectItemsArray();
            vectDefaultSelectItemsArray.add(objArray);
            arrays=(DefaultSelectItemsArray[])vectDefaultSelectItemsArray.toArray(new DefaultSelectItemsArray[vectDefaultSelectItemsArray.size()]);
            int size =arrays.length;
            arrays[size - 1].clear();
            for (int i =0;i<10;i++) {
                arrays[size - 1].add(new SelectItem(""+i+"",""+i));
            // array.setItems(new String[] {"Yes","No" });
            items.setValueBinding("value",getValueBinding("#{Page1.arrays["+(size-1)+"]}"));
            checkBox.getChildren().add(items);
            gridPanel.getChildren().add(outputText);
            gridPanel.getChildren().add(checkBox);
            parent.getChildren().add(gridPanel);
        private void addTextBox() {
            HtmlPanelGrid gridPanel = new HtmlPanelGrid();
            UIComponent parent = gridPanel1;
            HtmlOutputText outputText = new HtmlOutputText();
            outputText.setValue("Some Description for Control Text Box");
            outputText.setId("somedesc");
            HtmlInputText textField = new HtmlInputText();
            //  textField.setId("textField_"+control.getId());
            textField.setId("a1");
            HtmlOutputText outputText1 = new HtmlOutputText();
            hyperlink1Text.setValue(" ");
            hyperlink1Text.setStyleClass("bodyText");
            textField.setStyleClass("frmObjects");
            gridPanel.setColumns(3);
            gridPanel.getChildren().add(outputText);
            gridPanel.getChildren().add(hyperlink1Text);
            gridPanel.getChildren().add(textField);
            parent.getChildren().add(gridPanel);
        private DefaultSelectItemsArray array = new DefaultSelectItemsArray();
        public DefaultSelectItemsArray getArray() {
            return array;
        public void setArray(DefaultSelectItemsArray dsia) {
            this.array = dsia;
        private Vector vectDefaultSelectItemsArray = new Vector();
        private DefaultSelectItemsArray[] arrays = new DefaultSelectItemsArray[10];
        public DefaultSelectItemsArray[] getArrays() {
            return arrays;
        public void setArrays(DefaultSelectItemsArray[]dsia) {
            this.arrays = dsia;
        private UISelectItems radioButtonList1SelectItems1 = new UISelectItems();
        public UISelectItems getRadioButtonList1SelectItems1() {
            return radioButtonList1SelectItems1;
        public void setRadioButtonList1SelectItems1(UISelectItems uisi) {
            this.radioButtonList1SelectItems1 = uisi;
        private ValueBinding getValueBinding(String expression) {
            return     FacesContext.getCurrentInstance().getApplication().createValueBinding(expression);
        public String button1_action() {
            // TODO Replace with your code
            return "case1";
    }my navigation.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
                                  "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
    <faces-config>
        <navigation-rule>
            <from-view-id>/Page2.jsp</from-view-id>
            <navigation-case>
                <from-outcome>case1</from-outcome>
                <to-view-id>/Page1.jsp</to-view-id>
            </navigation-case>
            <navigation-case>
                <from-outcome>case2</from-outcome>
                <to-view-id>/Page1.jsp</to-view-id>
            </navigation-case>
            <navigation-case>
                <from-outcome>case3</from-outcome>
                <to-view-id>/Page1.jsp</to-view-id>
            </navigation-case>
        </navigation-rule>
        <navigation-rule>
            <from-view-id>/Page1.jsp</from-view-id>
            <navigation-case>
                <from-outcome>case1</from-outcome>
                <to-view-id>/Page2.jsp</to-view-id>
            </navigation-case>
        </navigation-rule>
    </faces-config>my managed beans xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
                                  "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
    <faces-config>
        <managed-bean>
            <managed-bean-name>Page1</managed-bean-name>
            <managed-bean-class>webapplication8.Page1</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        <managed-bean>
            <managed-bean-name>SessionBean1</managed-bean-name>
            <managed-bean-class>webapplication8.SessionBean1</managed-bean-class>
            <managed-bean-scope>session</managed-bean-scope>
        </managed-bean>
        <managed-bean>
            <managed-bean-name>ApplicationBean1</managed-bean-name>
            <managed-bean-class>webapplication8.ApplicationBean1</managed-bean-class>
            <managed-bean-scope>application</managed-bean-scope>
        </managed-bean>
        <managed-bean>
            <managed-bean-name>Page2</managed-bean-name>
            <managed-bean-class>webapplication8.Page2</managed-bean-class>
            <managed-bean-scope>request</managed-bean-scope>
        </managed-bean>
        <managed-bean>
    </faces-config>

  • Problem with some actions of a page in the ie

    the page is built on Studio Creator 2.1 in Fedora 4, when i run in ff work's fine. But, in the ie, some actions doesn't work well: what happens is that all the actions are redirected to another page's application!
    i think that it could be javascript incopatibility, for example i have a table component in the page, and when i click on the button(header table) for order rowgroup, i'm redirected to another page.
    ie version - 6.0
    windows 2000 server
    i don't know what to do.

    JSP Code
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:ui="http://www.sun.com/web/ui">
        <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
        <f:view>
            <ui:page binding="#{tarefa.page1}" id="page1">
                <ui:html binding="#{tarefa.html1}" id="html1">
                    <ui:head binding="#{tarefa.head1}" id="head1">
                        <ui:link binding="#{tarefa.link1}" id="link1" url="/resources/stylesheet.css"/>
                    </ui:head>
                    <ui:body binding="#{tarefa.body1}" id="body1" style="-rave-layout: grid">
                        <ui:form binding="#{tarefa.form1}" id="form1" target="_self">
                            <div style="height: 126px; left: 72px; top: 24px; position: absolute; width: 702px">
                                <jsp:directive.include file="cabecalho.jspf"/>
                            </div>
                            <div style="left: 72px; top: 558px; position: absolute">
                                <jsp:directive.include file="rodape.jspf"/>
                            </div>
                            <div style="height: 306px; left: 72px; top: 144px; position: absolute; width: 144px">
                                <jsp:directive.include file="menu1.jspf"/>
                            </div>
                            <ui:label binding="#{tarefa.label1}" id="label1" style="left: 220px; top: 150px; position: absolute" text="Cadastro/Manutencao de Tarefas"/>
                            <ui:staticText binding="#{tarefa.staticText1}" id="staticText1" style="left: 240px; top: 170px; position: absolute" text="Data:"/>
                            <ui:staticText binding="#{tarefa.staticText2}" id="staticText2" style="left: 240px; top: 210px; position: absolute" text="S�rie:"/>
                            <ui:staticText binding="#{tarefa.staticText3}" id="staticText3" style="left: 240px; top: 230px; position: absolute" text="Disciplina:"/>
                            <ui:staticText binding="#{tarefa.staticText4}" id="staticText4" style="left: 240px; top: 250px; position: absolute" text="Descricao:"/>
                            <ui:calendar binding="#{tarefa.dtTarefa}" dateFormatPattern="yyyy-MM-dd" id="dtTarefa" style="height: 18px; left: 300px; top: 170px; position: absolute; width: 108px"/>
                            <ui:dropDown binding="#{tarefa.cmbSerie}" converter="#{tarefa.integerConverter1}" id="cmbSerie"
                                items="#{tarefa.serieDataProvider.options['serie.id,serie.serie']}" style="height: 18px; left: 300px; top: 210px; position: absolute; width: 198px"/>
                            <ui:dropDown binding="#{tarefa.cmbDisciplina}" converter="#{tarefa.integerConverter2}" id="cmbDisciplina"
                                items="#{tarefa.disciplinaDataProvider.options['disciplina.id,disciplina.disciplina']}" style="height: 18px; left: 300px; top: 230px; position: absolute; width: 198px"/>
                            <ui:textArea binding="#{tarefa.txtDesc}" id="txtDesc" style="height: 36px; left: 300px; top: 250px; position: absolute; width: 200px"/>
                            <ui:button action="#{tarefa.btnNovo_action}" binding="#{tarefa.btnNovo}" id="btnNovo"
                                style="left: 239px; top: 290px; position: absolute" text="Novo"/>
                            <ui:button action="#{tarefa.btnEditar_action}" binding="#{tarefa.btnEditar}" id="btnEditar"
                                style="left: 299px; top: 290px; position: absolute" text="Editar"/>
                            <ui:button action="#{tarefa.btnAtualizar_action}" binding="#{tarefa.btnAtualizar}" id="btnAtualizar"
                                style="left: 359px; top: 290px; position: absolute" text="Atualizar"/>
                            <ui:button action="#{tarefa.btnCancelar_action}" binding="#{tarefa.btnCancelar}" id="btnCancelar"
                                style="left: 439px; top: 290px; position: absolute" text="Cancelar"/>
                            <ui:messageGroup binding="#{tarefa.messageGroup1}" id="messageGroup1" style="height: 88px; left: 522px; top: 180px; position: absolute; width: 250px"/>
                            <ui:hiddenField binding="#{tarefa.op}" id="op"/>
                            <ui:hiddenField binding="#{tarefa.id}" id="id"/>
                            <ui:table augmentTitle="false" binding="#{tarefa.table1}" id="table1" lite="true" paginationControls="true"
                                style="height: 126px; left: 234px; top: 324px; position: absolute" width="540">
                                <script language="javascript1.2" type="text/javascript"><![CDATA[
    /* ----- Functions for Table Preferences Panel ----- */
    * Toggle the table preferences panel open or closed
    function togglePreferencesPanel() {
      var table = document.getElementById("form1:table1");
      table.toggleTblePreferencesPanel();
    /* ----- Functions for Filter Panel ----- */
    * Return true if the filter menu has actually changed,
    * so the corresponding event should be allowed to continue.
    function filterMenuChanged() {
      var table = document.getElementById("form1:table1");
      return table.filterMenuChanged();
    * Toggle the custom filter panel (if any) open or closed.
    function toggleFilterPanel() {
      var table = document.getElementById("form1:table1");
      return table.toggleTableFilterPanel();
    /* ----- Functions for Table Actions ----- */
    * Initialize all rows of the table when the state
    * of selected rows changes.
    function initAllRows() {
      var table = document.getElementById("form1:table1");
      table.initAllRows();
    * Set the selected state for the given row groups
    * displayed in the table.  This functionality requires
    * the 'selectId' of the tableColumn to be set.
    * @param rowGroupId HTML element id of the tableRowGroup component
    * @param selected Flag indicating whether components should be selected
    function selectGroupRows(rowGroupId, selected) {
      var table = document.getElementById("form1:table1");
      table.selectGroupRows(rowGroupId, selected);
    * Disable all table actions if no rows have been selected.
    function disableActions() {
      // Determine whether any rows are currently selected
      var table = document.getElementById("form1:table1");
      var disabled = (table.getAllSelectedRowsCount() > 0) ? false : true;
      // Set disabled state for top actions
      document.getElementById("form1:table1:tableActionsTop:deleteTop").setDisabled(disabled);
      // Set disabled state for bottom actions
      document.getElementById("form1:table1:tableActionsBottom:deleteBottom").setDisabled(disabled);
    }]]></script>
                                <ui:tableRowGroup binding="#{tarefa.tableRowGroup1}" id="tableRowGroup1" rows="3" sourceData="#{tarefa.tarefaDataProvider1}" sourceVar="currentRow">
                                    <ui:tableColumn binding="#{tarefa.tableColumn1}" id="tableColumn1" width="53">
                                        <ui:button action="#{tarefa.button1_action}" binding="#{tarefa.button1}" id="button1" text="#{currentRow.value['tarefa.id']}"/>
                                    </ui:tableColumn>
                                    <ui:tableColumn binding="#{tarefa.tableColumn2}" headerText="Data" id="tableColumn2" sort="tarefa.data" width="177">
                                        <ui:staticText binding="#{tarefa.staticText6}" id="staticText6" text="#{currentRow.value['tarefa.data']}"/>
                                    </ui:tableColumn>
                                    <ui:tableColumn binding="#{tarefa.tableColumn5}" headerText="Descricao" id="tableColumn5" sort="tarefa.descricao" width="189">
                                        <ui:staticText binding="#{tarefa.staticText9}" id="staticText9" text="#{currentRow.value['tarefa.descricao']}"/>
                                    </ui:tableColumn>
                                    <ui:tableColumn binding="#{tarefa.tableColumn6}" headerText="Serie" id="tableColumn6" sort="serie.serie">
                                        <ui:staticText binding="#{tarefa.staticText10}" id="staticText10" text="#{currentRow.value['serie.serie']}"/>
                                    </ui:tableColumn>
                                    <ui:tableColumn binding="#{tarefa.tableColumn7}" headerText="Disciplina" id="tableColumn7" sort="disciplina.disciplina">
                                        <ui:staticText binding="#{tarefa.staticText11}" id="staticText11" text="#{currentRow.value['disciplina.disciplina']}"/>
                                    </ui:tableColumn>
                                    <ui:tableColumn binding="#{tarefa.tableColumn8}" id="tableColumn8">
                                        <ui:button action="#{tarefa.button2_action}" binding="#{tarefa.button2}" id="button2" text="Delete"/>
                                    </ui:tableColumn>
                                </ui:tableRowGroup>
                            </ui:table>
                        </ui:form>
                    </ui:body>
                </ui:html>
            </ui:page>
        </f:view>
    </jsp:root>java code
    package cmsgeracao;
    import com.sun.data.provider.RowKey;
    import com.sun.rave.web.ui.appbase.AbstractPageBean;
    import com.sun.rave.web.ui.component.Body;
    import com.sun.rave.web.ui.component.Form;
    import com.sun.rave.web.ui.component.Head;
    import com.sun.rave.web.ui.component.Html;
    import com.sun.rave.web.ui.component.Link;
    import com.sun.rave.web.ui.component.Page;
    import javax.faces.FacesException;
    import com.sun.rave.web.ui.component.Label;
    import com.sun.rave.web.ui.component.StaticText;
    import com.sun.rave.web.ui.component.Calendar;
    import com.sun.rave.web.ui.component.DropDown;
    import com.sun.rave.web.ui.component.TextArea;
    import com.sun.rave.web.ui.component.Button;
    import com.sun.rave.web.ui.component.Table;
    import com.sun.rave.web.ui.component.TableRowGroup;
    import com.sun.rave.web.ui.component.TableColumn;
    import com.sun.data.provider.impl.CachedRowSetDataProvider;
    import javax.faces.convert.IntegerConverter;
    import com.sun.rave.web.ui.component.MessageGroup;
    import com.sun.rave.web.ui.component.HiddenField;
    import java.util.Date;
    import java.util.GregorianCalendar;
    import com.sun.rave.web.ui.model.DefaultTableDataProvider;
    * <p>Page bean that corresponds to a similarly named JSP page.  This
    * class contains component definitions (and initialization code) for
    * all components that you have defined on this page, as well as
    * lifecycle methods and event handlers where you may add behavior
    * to respond to incoming events.</p>
    public class tarefa extends AbstractPageBean {
        // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Definition">
        private int __placeholder;
         * <p>Automatically managed component initialization.  <strong>WARNING:</strong>
         * This method is automatically generated, so any user-specified code inserted
         * here is subject to being replaced.</p>
        private void _init() throws Exception {
            disciplinaDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet)getValue("#{SessionBean1.disciplinaRowSet}"));
            serieDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet)getValue("#{SessionBean1.serieRowSet}"));
            tarefaDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet)getValue("#{SessionBean1.tarefaRowSet}"));
            tarefaDataProvider1.setCachedRowSet((javax.sql.rowset.CachedRowSet)getValue("#{SessionBean1.tarefaRowSet}"));
        private Page page1 = new Page();
        public Page getPage1() {
            return page1;
        public void setPage1(Page p) {
            this.page1 = p;
        private Html html1 = new Html();
        public Html getHtml1() {
            return html1;
        public void setHtml1(Html h) {
            this.html1 = h;
        private Head head1 = new Head();
        public Head getHead1() {
            return head1;
        public void setHead1(Head h) {
            this.head1 = h;
        private Link link1 = new Link();
        public Link getLink1() {
            return link1;
        public void setLink1(Link l) {
            this.link1 = l;
        private Body body1 = new Body();
        public Body getBody1() {
            return body1;
        public void setBody1(Body b) {
            this.body1 = b;
        private Form form1 = new Form();
        public Form getForm1() {
            return form1;
        public void setForm1(Form f) {
            this.form1 = f;
        private Label label1 = new Label();
        public Label getLabel1() {
            return label1;
        public void setLabel1(Label l) {
            this.label1 = l;
        private StaticText staticText1 = new StaticText();
        public StaticText getStaticText1() {
            return staticText1;
        public void setStaticText1(StaticText st) {
            this.staticText1 = st;
        private StaticText staticText2 = new StaticText();
        public StaticText getStaticText2() {
            return staticText2;
        public void setStaticText2(StaticText st) {
            this.staticText2 = st;
        private StaticText staticText3 = new StaticText();
        public StaticText getStaticText3() {
            return staticText3;
        public void setStaticText3(StaticText st) {
            this.staticText3 = st;
        private StaticText staticText4 = new StaticText();
        public StaticText getStaticText4() {
            return staticText4;
        public void setStaticText4(StaticText st) {
            this.staticText4 = st;
        private Calendar dtTarefa = new Calendar();
        public Calendar getDtTarefa() {
            return dtTarefa;
        public void setDtTarefa(Calendar c) {
            this.dtTarefa = c;
        private DropDown cmbSerie = new DropDown();
        public DropDown getCmbSerie() {
            return cmbSerie;
        public void setCmbSerie(DropDown dd) {
            this.cmbSerie = dd;
        private DropDown cmbDisciplina = new DropDown();
        public DropDown getCmbDisciplina() {
            return cmbDisciplina;
        public void setCmbDisciplina(DropDown dd) {
            this.cmbDisciplina = dd;
        private TextArea txtDesc = new TextArea();
        public TextArea getTxtDesc() {
            return txtDesc;
        public void setTxtDesc(TextArea ta) {
            this.txtDesc = ta;
        private Button btnNovo = new Button();
        public Button getBtnNovo() {
            return btnNovo;
        public void setBtnNovo(Button b) {
            this.btnNovo = b;
        private Button btnEditar = new Button();
        public Button getBtnEditar() {
            return btnEditar;
        public void setBtnEditar(Button b) {
            this.btnEditar = b;
        private Button btnAtualizar = new Button();
        public Button getBtnAtualizar() {
            return btnAtualizar;
        public void setBtnAtualizar(Button b) {
            this.btnAtualizar = b;
        private Button btnCancelar = new Button();
        public Button getBtnCancelar() {
            return btnCancelar;
        public void setBtnCancelar(Button b) {
            this.btnCancelar = b;
        private CachedRowSetDataProvider disciplinaDataProvider = new CachedRowSetDataProvider();
        public CachedRowSetDataProvider getDisciplinaDataProvider() {
            return disciplinaDataProvider;
        public void setDisciplinaDataProvider(CachedRowSetDataProvider crsdp) {
            this.disciplinaDataProvider = crsdp;
        private IntegerConverter cmbDisciplinaConverter = new IntegerConverter();
        public IntegerConverter getCmbDisciplinaConverter() {
            return cmbDisciplinaConverter;
        public void setCmbDisciplinaConverter(IntegerConverter ic) {
            this.cmbDisciplinaConverter = ic;
        private CachedRowSetDataProvider serieDataProvider = new CachedRowSetDataProvider();
        public CachedRowSetDataProvider getSerieDataProvider() {
            return serieDataProvider;
        public void setSerieDataProvider(CachedRowSetDataProvider crsdp) {
            this.serieDataProvider = crsdp;
        private IntegerConverter cmbSerieConverter = new IntegerConverter();
        public IntegerConverter getCmbSerieConverter() {
            return cmbSerieConverter;
        public void setCmbSerieConverter(IntegerConverter ic) {
            this.cmbSerieConverter = ic;
        private IntegerConverter integerConverter2 = new IntegerConverter();
        public IntegerConverter getIntegerConverter2() {
            return integerConverter2;
        public void setIntegerConverter2(IntegerConverter ic) {
            this.integerConverter2 = ic;
        private CachedRowSetDataProvider tarefaDataProvider = new CachedRowSetDataProvider();
        public CachedRowSetDataProvider getTarefaDataProvider() {
            return tarefaDataProvider;
        public void setTarefaDataProvider(CachedRowSetDataProvider crsdp) {
            this.tarefaDataProvider = crsdp;
        private MessageGroup messageGroup1 = new MessageGroup();
        public MessageGroup getMessageGroup1() {
            return messageGroup1;
        public void setMessageGroup1(MessageGroup mg) {
            this.messageGroup1 = mg;
        private IntegerConverter integerConverter1 = new IntegerConverter();
        public IntegerConverter getIntegerConverter1() {
            return integerConverter1;
        public void setIntegerConverter1(IntegerConverter ic) {
            this.integerConverter1 = ic;
        private HiddenField op = new HiddenField();
        public HiddenField getOp() {
            return op;
        public void setOp(HiddenField hf) {
            this.op = hf;
        private HiddenField id = new HiddenField();
        public HiddenField getId() {
            return id;
        public void setId(HiddenField hf) {
            this.id = hf;
        private Table table1 = new Table();
        public Table getTable1() {
            return table1;
        public void setTable1(Table t) {
            this.table1 = t;
        private TableRowGroup tableRowGroup1 = new TableRowGroup();
        public TableRowGroup getTableRowGroup1() {
            return tableRowGroup1;
        public void setTableRowGroup1(TableRowGroup trg) {
            this.tableRowGroup1 = trg;
        private CachedRowSetDataProvider tarefaDataProvider1 = new CachedRowSetDataProvider();
        public CachedRowSetDataProvider getTarefaDataProvider1() {
            return tarefaDataProvider1;
        public void setTarefaDataProvider1(CachedRowSetDataProvider crsdp) {
            this.tarefaDataProvider1 = crsdp;
        private TableColumn tableColumn1 = new TableColumn();
        public TableColumn getTableColumn1() {
            return tableColumn1;
        public void setTableColumn1(TableColumn tc) {
            this.tableColumn1 = tc;
        private TableColumn tableColumn2 = new TableColumn();
        public TableColumn getTableColumn2() {
            return tableColumn2;
        public void setTableColumn2(TableColumn tc) {
            this.tableColumn2 = tc;
        private StaticText staticText6 = new StaticText();
        public StaticText getStaticText6() {
            return staticText6;
        public void setStaticText6(StaticText st) {
            this.staticText6 = st;
        private TableColumn tableColumn5 = new TableColumn();
        public TableColumn getTableColumn5() {
            return tableColumn5;
        public void setTableColumn5(TableColumn tc) {
            this.tableColumn5 = tc;
        private StaticText staticText9 = new StaticText();
        public StaticText getStaticText9() {
            return staticText9;
        public void setStaticText9(StaticText st) {
            this.staticText9 = st;
        private TableColumn tableColumn6 = new TableColumn();
        public TableColumn getTableColumn6() {
            return tableColumn6;
        public void setTableColumn6(TableColumn tc) {
            this.tableColumn6 = tc;
        private StaticText staticText10 = new StaticText();
        public StaticText getStaticText10() {
            return staticText10;
        public void setStaticText10(StaticText st) {
            this.staticText10 = st;
        private TableColumn tableColumn7 = new TableColumn();
        public TableColumn getTableColumn7() {
            return tableColumn7;
        public void setTableColumn7(TableColumn tc) {
            this.tableColumn7 = tc;
        private StaticText staticText11 = new StaticText();
        public StaticText getStaticText11() {
            return staticText11;
        public void setStaticText11(StaticText st) {
            this.staticText11 = st;
        private Button button1 = new Button();
        public Button getButton1() {
            return button1;
        public void setButton1(Button b) {
            this.button1 = b;
        private TableColumn tableColumn8 = new TableColumn();
        public TableColumn getTableColumn8() {
            return tableColumn8;
        public void setTableColumn8(TableColumn tc) {
            this.tableColumn8 = tc;
        private Button button2 = new Button();
        public Button getButton2() {
            return button2;
        public void setButton2(Button b) {
            this.button2 = b;
        // </editor-fold>
         * <p>Construct a new Page bean instance.</p>
        public tarefa() {
         * <p>Return a reference to the scoped data bean.</p>
        protected SessionBean1 getSessionBean1() {
            return (SessionBean1)getBean("SessionBean1");
         * <p>Return a reference to the scoped data bean.</p>
        protected ApplicationBean1 getApplicationBean1() {
            return (ApplicationBean1)getBean("ApplicationBean1");
         * <p>Return a reference to the scoped data bean.</p>
        protected RequestBean1 getRequestBean1() {
            return (RequestBean1)getBean("RequestBean1");
         * <p>Callback method that is called whenever a page is navigated to,
         * either directly via a URL, or indirectly via page navigation.
         * Customize 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.</p>
         * <p>Note that, if the current request is a postback, the property
         * values of the components do <strong>not</strong> represent any
         * values submitted with this request.  Instead, they represent the
         * property values that were saved for this view when it was rendered.</p>
        public void init() {
            // Perform initializations inherited from our superclass
            super.init();
            // Perform application initialization that must complete
            // *before* managed components are initialized
            // TODO - add your own initialiation code here
            // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
            // Initialize automatically managed components
            // *Note* - this logic should NOT be modified
            try {
                _init();
            } catch (Exception e) {
                log("tarefa Initialization Failure", e);
                throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
            // </editor-fold>
            // Perform application initialization that must complete
            // *after* managed components are initialized
            // TODO - add your own initialization code here
            initialForm();
         * <p>Callback method that is called after the component tree has been
         * restored, but before any event processing takes place.  This method
         * will <strong>only</strong> be called on a postback request that
         * is processing a form submit.  Customize this method to allocate
         * resources that will be required in your event handlers.</p>
        public void preprocess() {
         * <p>Callback method that is called just before rendering takes place.
         * This method will <strong>only</strong> be called for the page that
         * will actually be rendered (and not, for example, on a page that
         * handled a postback and then navigated to a different page).  Customize
         * this method to allocate resources that will be required for rendering
         * this page.</p>
        public void prerender() {
         * <p>Callback method that is called after rendering is completed for
         * this request, if <code>init()</code> was called (regardless of whether
         * or not this was the page that was actually rendered).  Customize this
         * method to release resources acquired in the <code>init()</code>,
         * <code>preprocess()</code>, or <code>prerender()</code> methods (or
         * acquired during execution of an event handler).</p>
        public void destroy() {
            tarefaDataProvider1.close();
            tarefaDataProvider.close();
            serieDataProvider.close();
            disciplinaDataProvider.close();
         public void lockForm(){
            dtTarefa.setDisabled(true);
            cmbSerie.setDisabled(true);
            cmbDisciplina.setDisabled(true);
            txtDesc.setDisabled(true);       
        public void unlockForm(){
            dtTarefa.setDisabled(false);
            cmbSerie.setDisabled(false);
            cmbDisciplina.setDisabled(false);
            txtDesc.setDisabled(false);    
        public void initialForm(){
            lockForm();
            java.util.Calendar cal = new GregorianCalendar(2006,1,1);
            Date dt = new Date();
            dt.setTime(cal.getTimeInMillis());
            dtTarefa.setMinDate(dt);
            btnNovo.setDisabled(false);
            btnEditar.setDisabled(true);
            btnAtualizar.setDisabled(true);
            btnCancelar.setDisabled(true);     
        public void novoTarefa(){
            unlockForm();
            btnAtualizar.setDisabled(false);
            btnNovo.setDisabled(true);
            btnEditar.setDisabled(true);
            btnCancelar.setDisabled(false);               
        public String button1_action() {
            try{
                RowKey rk = tableRowGroup1.getRowKey();
                if(rk!=null){
                    tarefaDataProvider.removeRow(rk);
                    tarefaDataProvider.commitChanges();
                    tarefaDataProvider.refresh();
            }catch(Exception e){
                log("Erro ao deletar", e);
                error(e.getMessage());
            try{
            this.getExternalContext().redirect("tarefa.jsp");
            }catch(Exception e){
                log("Erro ao deletar");
            return null;
        public String btnNovo_action() {
            op.setText("1");  
            novaTarefa();
            try{
            this.getExternalContext().redirect("tarefa.jsp");
            }catch(Exception e){
                log("Erro ao clicar em NOVO");
            return null;
         public void novaTarefa(){
            unlockForm();
            btnAtualizar.setDisabled(false);
            btnNovo.setDisabled(true);
            btnEditar.setDisabled(true);
            btnCancelar.setDisabled(false);       
        public String btnEditar_action() {
            unlockForm();
            op.setText("2");
            btnEditar.setDisabled(true);
            btnAtualizar.setDisabled(false);
            try{
            this.getExternalContext().redirect("tarefa.jsp");
            }catch(Exception e){
                log("Erro ao clicar em NOVO");
            return null;
        public String button2_action() {
            try{
                RowKey rk = tableRowGroup1.getRowKey();
                if(rk!=null){
                    tarefaDataProvider.setCursorRow(rk);
                    id.setText(tarefaDataProvider.getValue("tarefa.id"));
                    dtTarefa.setValue(tarefaDataProvider.getValue("tarefa.data"));
                    cmbSerie.setSelected(tarefaDataProvider.getValue("tarefa.idserie"));
                    cmbDisciplina.setSelected(tarefaDataProvider.getValue("tarefa.iddisciplina"));
                    txtDesc.setText(tarefaDataProvider.getValue("tarefa.descricao"));
                    lockForm();
                    btnEditar.setDisabled(false);
                    btnNovo.setDisabled(true);
                    btnAtualizar.setDisabled(true);
            }catch(Exception e){
                log("Erro ao deletar", e);
                error(e.getMessage());
            try{
            this.getExternalContext().redirect("tarefa.jsp");
            }catch(Exception e){
                log("Erro ao setar FORM");
            return null;
        public void novoRegistro(){
            Integer id=new Integer(0);
            try {
                RowKey rk = tarefaDataProvider.appendRow();
                tarefaDataProvider.setCursorRow(rk);
                tarefaDataProvider.setValue("tarefa.data",dtTarefa.getSelectedDate());
                tarefaDataProvider.setValue("tarefa.idserie",cmbSerie.getSelected());
                tarefaDataProvider.setValue("tarefa.iddisciplina",cmbDisciplina.getSelected());
                tarefaDataProvider.setValue("tarefa.descricao",txtDesc.getText());
                tarefaDataProvider.commitChanges();
                tarefaDataProvider.refresh();
            } catch (Exception ex) {
                log("Error Description", ex);
                error(ex.getMessage());
        public void atualizaRegistro(){
            try{
                RowKey rk = tarefaDataProvider.findFirst("tarefa.id",id.getText());
                tarefaDataProvider.setCursorRow(rk);
                tarefaDataProvider.setValue("tarefa.data",dtTarefa.getSelectedDate());
                tarefaDataProvider.setValue("tarefa.idserie",cmbSerie.getSelected());
                tarefaDataProvider.setValue("tarefa.iddisciplina",cmbDisciplina.getSelected());
                tarefaDataProvider.setValue("tarefa.descricao",txtDesc.getText());
                tarefaDataProvider.commitChanges();
                tarefaDataProvider.refresh();
            }catch(Exception ex){
                log("Error ao atualizar Noticia",ex);
                error(ex.getMessage());
        public String btnAtualizar_action() {
            if(op.get                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

  • Another JSP Fragment bug (or JSF flaw?)

    My application has a search box and go button in a JSPF fragment. But data content is rendered in a JSP. To demonstrate the problem I am going to slightly modify the Person/Trip tutorial sample:
    1. Create a new project
    2. Add Trip rowset to page1
    3. Set criteria perseonid = ?
    4. Add data table and bind it to trip rowset
    5. Add Integer PersonID property to the session bean
    6. Add PersonID initialization code:
    personID = new Integer(1);
    5. Add Page1 initialization:
    try {
    dataTable1Model.setObject(1, getSessionBean1().getPersonID());
    dataTable1Model.execute();
    } catch (Exception e) {
    throw new FacesException(e);
    5. Add a new JSP Fragment above the table and name it Test.jspf
    6. Place an edit field (Search) and a button to submit the search
    7. Add process value change event to the edit box:
    getSessionBean1().setPersonID(new Integer((String)vce.getNewValue()));
    8. Add action handler to the button but keep it empty for now since we do not have inter-page navigation here really
    Now start project and enter 2 into search field click on the button and see the table did not update. Enter 3 and see that the table now shows the records for the person id 2.
    So why do tutorial samples work and this JSPF does not? The problem is that JSPF fragment does not have any knowledge about the table data model on the Page1.jsp so it cannot synchronize it in the value change event!!! However, tutorial samples do update data model because value change event is in the same Java class. In this case JSPF is a completely different class.
    Now please tell me what am I supposed to do? Don't suggest me to access Page1.tableDataModel from the Test.jspf since my JSPF can be included in different pages.
    My current workaround again is using this call in the button action event:
    try { getExternalContext().redirect("Page1.jsp"); } catch (Exception e) {};
    Now, you have to pay me something for all that hard QA work I have to do for your entire QA department. ;-)
    Here is the codes: (just in case)
    Page1.java:
    * Page1.java
    * Created on December 19, 2004, 10:59 AM
    * Copyright ybaykshtis
    package test9;
    import javax.faces.*;
    import com.sun.jsfcl.app.*;
    import javax.faces.component.html.*;
    import com.sun.sql.rowset.*;
    import com.sun.jsfcl.data.*;
    import javax.faces.component.*;
    public class Page1 extends AbstractPageBean {
    // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Definition">
    private int __placeholder;
    private HtmlForm form1 = new HtmlForm();
    public HtmlForm getForm1() {
    return form1;
    public void setForm1(HtmlForm hf) {
    this.form1 = hf;
    private JdbcRowSetXImpl tripRowSet = new JdbcRowSetXImpl();
    public JdbcRowSetXImpl getTripRowSet() {
    return tripRowSet;
    public void setTripRowSet(JdbcRowSetXImpl jrsxi) {
    this.tripRowSet = jrsxi;
    private HtmlDataTable dataTable1 = new HtmlDataTable();
    public HtmlDataTable getDataTable1() {
    return dataTable1;
    public void setDataTable1(HtmlDataTable hdt) {
    this.dataTable1 = hdt;
    private UIColumn column1 = new UIColumn();
    public UIColumn getColumn1() {
    return column1;
    public void setColumn1(UIColumn uic) {
    this.column1 = uic;
    private HtmlOutputText outputText1 = new HtmlOutputText();
    public HtmlOutputText getOutputText1() {
    return outputText1;
    public void setOutputText1(HtmlOutputText hot) {
    this.outputText1 = hot;
    private HtmlOutputText outputText2 = new HtmlOutputText();
    public HtmlOutputText getOutputText2() {
    return outputText2;
    public void setOutputText2(HtmlOutputText hot) {
    this.outputText2 = hot;
    private UIColumn column2 = new UIColumn();
    public UIColumn getColumn2() {
    return column2;
    public void setColumn2(UIColumn uic) {
    this.column2 = uic;
    private HtmlOutputText outputText3 = new HtmlOutputText();
    public HtmlOutputText getOutputText3() {
    return outputText3;
    public void setOutputText3(HtmlOutputText hot) {
    this.outputText3 = hot;
    private HtmlOutputText outputText4 = new HtmlOutputText();
    public HtmlOutputText getOutputText4() {
    return outputText4;
    public void setOutputText4(HtmlOutputText hot) {
    this.outputText4 = hot;
    private UIColumn column3 = new UIColumn();
    public UIColumn getColumn3() {
    return column3;
    public void setColumn3(UIColumn uic) {
    this.column3 = uic;
    private HtmlOutputText outputText5 = new HtmlOutputText();
    public HtmlOutputText getOutputText5() {
    return outputText5;
    public void setOutputText5(HtmlOutputText hot) {
    this.outputText5 = hot;
    private HtmlOutputText outputText6 = new HtmlOutputText();
    public HtmlOutputText getOutputText6() {
    return outputText6;
    public void setOutputText6(HtmlOutputText hot) {
    this.outputText6 = hot;
    private UIColumn column4 = new UIColumn();
    public UIColumn getColumn4() {
    return column4;
    public void setColumn4(UIColumn uic) {
    this.column4 = uic;
    private HtmlOutputText outputText7 = new HtmlOutputText();
    public HtmlOutputText getOutputText7() {
    return outputText7;
    public void setOutputText7(HtmlOutputText hot) {
    this.outputText7 = hot;
    private HtmlOutputText outputText8 = new HtmlOutputText();
    public HtmlOutputText getOutputText8() {
    return outputText8;
    public void setOutputText8(HtmlOutputText hot) {
    this.outputText8 = hot;
    private UIColumn column5 = new UIColumn();
    public UIColumn getColumn5() {
    return column5;
    public void setColumn5(UIColumn uic) {
    this.column5 = uic;
    private HtmlOutputText outputText9 = new HtmlOutputText();
    public HtmlOutputText getOutputText9() {
    return outputText9;
    public void setOutputText9(HtmlOutputText hot) {
    this.outputText9 = hot;
    private HtmlOutputText outputText10 = new HtmlOutputText();
    public HtmlOutputText getOutputText10() {
    return outputText10;
    public void setOutputText10(HtmlOutputText hot) {
    this.outputText10 = hot;
    private UIColumn column6 = new UIColumn();
    public UIColumn getColumn6() {
    return column6;
    public void setColumn6(UIColumn uic) {
    this.column6 = uic;
    private HtmlOutputText outputText11 = new HtmlOutputText();
    public HtmlOutputText getOutputText11() {
    return outputText11;
    public void setOutputText11(HtmlOutputText hot) {
    this.outputText11 = hot;
    private HtmlOutputText outputText12 = new HtmlOutputText();
    public HtmlOutputText getOutputText12() {
    return outputText12;
    public void setOutputText12(HtmlOutputText hot) {
    this.outputText12 = hot;
    private RowSetDataModel dataTable1Model = new RowSetDataModel();
    public RowSetDataModel getDataTable1Model() {
    return dataTable1Model;
    public void setDataTable1Model(RowSetDataModel rsdm) {
    this.dataTable1Model = rsdm;
    // </editor-fold>
    public Page1() {
    // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
    try {
    tripRowSet.setDataSourceName("java:comp/env/jdbc/Travel");
    tripRowSet.setCommand("SELECT ALL TRAVEL.TRIP.TRIPID, TRAVEL.TRIP.PERSONID, TRAVEL.TRIP.DEPDATE, TRAVEL.TRIP.DEPCITY, TRAVEL.TRIP.DESTCITY, TRAVEL.TRIP.TRIPTYPEID FROM TRAVEL.TRIP WHERE TRAVEL.TRIP.PERSONID=?");
    dataTable1Model.setDataCacheKey("com.sun.datacache.Page1.tripRowSet");
    dataTable1Model.setRowSet(tripRowSet);
    dataTable1Model.setSchemaName("TRAVEL");
    dataTable1Model.setTableName("TRIP");
    } catch (Exception e) {
    log("Page1 Initialization Failure", e);
    throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
    // </editor-fold>
    // Additional user provided initialization code
    try {
    dataTable1Model.setObject(1, getSessionBean1().getPersonID());
    dataTable1Model.execute();
    } catch (Exception e) {
    throw new FacesException(e);
    protected test9.ApplicationBean1 getApplicationBean1() {
    return (test9.ApplicationBean1)getBean("ApplicationBean1");
    protected test9.SessionBean1 getSessionBean1() {
    return (test9.SessionBean1)getBean("SessionBean1");
    * Bean cleanup.
    protected void afterRenderResponse() {
    tripRowSet.close();
    Page1.jsp
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page">
    <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
    <f:view><![CDATA[
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    ]]><html
    lang="en-US" xml:lang="en-US">
    <head>
    <meta content="no-cache" http-equiv="Cache-Control"/>
    <meta content="no-cache" http-equiv="Pragma"/>
    <title>Page1 Title</title>
    <link href="resources/stylesheet.css" rel="stylesheet" type="text/css"/>
    </head>
    <body style="-rave-layout: grid">
    <h:form binding="#{Page1.form1}" id="form1">
    <h:dataTable binding="#{Page1.dataTable1}" headerClass="list-header" id="dataTable1" rowClasses="list-row-even,list-row-odd"
    style="left: 24px; top: 168px; position: absolute" value="#{Page1.dataTable1Model}" var="currentRow">
    <h:column binding="#{Page1.column1}" id="column1">
    <h:outputText binding="#{Page1.outputText1}" id="outputText1" value="#{currentRow['TRIPID']}"/>
    <f:facet name="header">
    <h:outputText binding="#{Page1.outputText2}" id="outputText2" value="TRIPID"/>
    </f:facet>
    </h:column>
    <h:column binding="#{Page1.column2}" id="column2">
    <h:outputText binding="#{Page1.outputText3}" id="outputText3" value="#{currentRow['PERSONID']}"/>
    <f:facet name="header">
    <h:outputText binding="#{Page1.outputText4}" id="outputText4" value="PERSONID"/>
    </f:facet>
    </h:column>
    <h:column binding="#{Page1.column3}" id="column3">
    <h:outputText binding="#{Page1.outputText5}" id="outputText5" value="#{currentRow['DEPDATE']}"/>
    <f:facet name="header">
    <h:outputText binding="#{Page1.outputText6}" id="outputText6" value="DEPDATE"/>
    </f:facet>
    </h:column>
    <h:column binding="#{Page1.column4}" id="column4">
    <h:outputText binding="#{Page1.outputText7}" id="outputText7" value="#{currentRow['DEPCITY']}"/>
    <f:facet name="header">
    <h:outputText binding="#{Page1.outputText8}" id="outputText8" value="DEPCITY"/>
    </f:facet>
    </h:column>
    <h:column binding="#{Page1.column5}" id="column5">
    <h:outputText binding="#{Page1.outputText9}" id="outputText9" value="#{currentRow['DESTCITY']}"/>
    <f:facet name="header">
    <h:outputText binding="#{Page1.outputText10}" id="outputText10" value="DESTCITY"/>
    </f:facet>
    </h:column>
    <h:column binding="#{Page1.column6}" id="column6">
    <h:outputText binding="#{Page1.outputText11}" id="outputText11" value="#{currentRow['TRIPTYPEID']}"/>
    <f:facet name="header">
    <h:outputText binding="#{Page1.outputText12}" id="outputText12" value="TRIPTYPEID"/>
    </f:facet>
    </h:column>
    </h:dataTable>
    <div style="left: 48px; top: 72px; position: absolute">
    <jsp:directive.include file="Test.jspf"/>
    </div>
    </h:form>
    </body>
    </html>
    </f:view>
    </jsp:root>
    Test.java
    * Test.java
    * Created on December 19, 2004, 11:01 AM
    * Copyright ybaykshtis
    package test9;
    import javax.faces.*;
    import com.sun.jsfcl.app.*;
    import javax.faces.component.html.*;
    import com.sun.jsfcl.data.*;
    import javax.faces.component.*;
    import com.sun.sql.rowset.*;
    import javax.faces.convert.*;
    import javax.faces.event.*;
    public class Test extends AbstractPageBean {
    // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Definition">
    private int __placeholder;
    private JdbcRowSetXImpl personRowSet = new JdbcRowSetXImpl();
    public JdbcRowSetXImpl getPersonRowSet() {
    return personRowSet;
    public void setPersonRowSet(JdbcRowSetXImpl jrsxi) {
    this.personRowSet = jrsxi;
    private HtmlInputText textField1 = new HtmlInputText();
    public HtmlInputText getTextField1() {
    return textField1;
    public void setTextField1(HtmlInputText hit) {
    this.textField1 = hit;
    private HtmlCommandButton button1 = new HtmlCommandButton();
    public HtmlCommandButton getButton1() {
    return button1;
    public void setButton1(HtmlCommandButton hcb) {
    this.button1 = hcb;
    // </editor-fold>
    public Test() {
    // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
    try {
    personRowSet.setDataSourceName("java:comp/env/jdbc/Travel");
    personRowSet.setCommand("SELECT * FROM TRAVEL.PERSON");
    } catch (Exception e) {
    log("Test Initialization Failure", e);
    throw e instanceof javax.faces.FacesException ? (FacesException) e: new FacesException(e);
    // </editor-fold>
    // Additional user provided initialization code
    protected test9.ApplicationBean1 getApplicationBean1() {
    return (test9.ApplicationBean1)getBean("ApplicationBean1");
    protected test9.SessionBean1 getSessionBean1() {
    return (test9.SessionBean1)getBean("SessionBean1");
    * Bean cleanup.
    protected void afterRenderResponse() {
    personRowSet.close();
    public String button1_action() {
    // User event code here...
    //try { getExternalContext().redirect("Page1.jsp"); } catch (Exception e) {};
    return null;
    public void textField1_processValueChange(ValueChangeEvent vce) {
    // User event code here...
    getSessionBean1().setPersonID(new Integer((String)vce.getNewValue()));
    Test.jspf
    <?xml version="1.0" encoding="UTF-8"?>
    <div style="-rave-layout: grid" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">
    <p>Included Content Here</p>
    <h:inputText binding="#{Test.textField1}" id="textField1" style="left: 48px; top: 48px; position: absolute" valueChangeListener="#{Test.textField1_processValueChange}"/>
    <h:commandButton action="#{Test.button1_action}" binding="#{Test.button1}" id="button1" style="left: 240px; top: 48px; position: absolute" value="Submit"/>
    </div>

    Hi ,
    Thanks for your valuable observations and feedback. I could observe that the workaround seems to be working fine. Thanks for providing the workaround.
    The problem you are facing without the workaround is a known issue and our engineers are currently working on it.
    Regards.
    Creator Team.

  • Store and Display Image from Database

    Now that MySQL is working (woo hoo!) with JSC, I have a couple of questions for any experts out there...
    1. How would I perform an image or other file upload from a browser?
    2. How would I retrieve and display an image from a db on a jsp page?
    Thanks for any help.

    Craig, I think I have a simpler way to load an image on the page, although for the time being I'm not retrieving from a database, but from the file system. The problem is that I'm not getting the pages to load continuously with new images. At some point it apears that the session gets clogges and can not load new pictures. I'll try to include the page bean code just below. This time I'm not adding the "code" tags because I haven't being successful with that. If you have problems , please, contact me at [email protected].
    The core of the code is in a couple of button_action methods.
    If you need, I can give access to the http server where this is running.
    Luiz
    package untitled;
    import javax.faces.*;
    import com.sun.jsfcl.app.*;
    import javax.faces.component.html.*;
    import com.sun.jsfcl.std.*;
    import javax.faces.component.*;
    import javax.swing.filechooser.*;
    import javax.swing.*;
    import java.io.*;
    * Creator-managed class.
    * Your code should be placed at the end.
    public class Page1 extends AbstractPageBean {
    private HtmlForm form1 = new HtmlForm();
    private FileSystemView filesystem = FileSystemView.getFileSystemView();
    private File path = new File("C:/Documents and Settings/Luiz Costa/My Documents/Creator/Projects/PictureAlbum/build/images/Isadora\'s Wedding");
    private File[] fileslist = filesystem.getFiles(path, false);
    private int counter = 1;
    private int iw = 0;
    private int ih = 0;
    private Integer aiw = new Integer("1");
    private float aar = 0;
    private float ar = 0;
    private ImageIcon ii = null;
    public HtmlForm getForm1() {
    return form1;
    public void setForm1(HtmlForm hf) {
    this.form1 = hf;
    private HtmlGraphicImage image1 = new HtmlGraphicImage();
    public HtmlGraphicImage getImage1() {
    return image1;
    public void setImage1(HtmlGraphicImage hgi) {
    this.image1 = hgi;
    private HtmlCommandButton button1 = new HtmlCommandButton();
    public HtmlCommandButton getButton1() {
    return button1;
    public void setButton1(HtmlCommandButton hcb) {
    this.button1 = hcb;
    private HtmlCommandButton button2 = new HtmlCommandButton();
    public HtmlCommandButton getButton2() {
    return button2;
    public void setButton2(HtmlCommandButton hcb) {
    this.button2 = hcb;
    private HtmlGraphicImage image2 = new HtmlGraphicImage();
    public HtmlGraphicImage getImage2() {
    return image2;
    public void setImage2(HtmlGraphicImage hgi) {
    this.image2 = hgi;
    private HtmlOutputText outputText1 = new HtmlOutputText();
    public HtmlOutputText getOutputText1() {
    return outputText1;
    public void setOutputText1(HtmlOutputText hot) {
    this.outputText1 = hot;
    * This constructor contains Creator-managed initialization code.
    * Your initialization code can be placed at the end,
    * but, this code will be invoked only the first time the page is rendered,
    * and any properties set in the .jsp file will override settings here.
    public Page1() {
    // Creator-managed initialization code
    try {
    catch ( Exception e) {
    log("Page1 Initialization Failure", e);
    throw new FacesException(e);
    // User provided initialization code
    public String button1_action() {
    // Add your event code here...
    outputText1.setValue(fileslist[counter].getAbsoluteFile().getPath()+fileslist.length+"left"+counter);
    ii = new ImageIcon("images/Isadora\'s Wedding/"+fileslist[counter].getName());
    ar = (float)ii.getIconHeight()/(float)ii.getIconWidth();
    // aiw = new Integer(image1.getWidth());
    aiw = new Integer(ii.getIconHeight());
    aar = ar*aiw.intValue();
    image1.setHeight(""+(int)aar);
    outputText1.setValue(image1.getHeight());
    image1.setUrl("images/Isadora\'s Wedding/"+fileslist[counter].getName());
    ii = new ImageIcon("images/Isadora\'s Wedding/"+fileslist[(counter + 1 + fileslist.length) % fileslist.length].getName());
    ar = (float)ii.getIconHeight()/(float)ii.getIconWidth();
    // aiw = new Integer(image2.getWidth());
    aiw = new Integer(ii.getIconHeight());
    aar = ar*aiw.intValue();
    image2.setHeight(""+(int)aar);
    outputText1.setValue(image2.getHeight());
    image2.setUrl("images/Isadora\'s Wedding/"+fileslist[(counter + 1 + fileslist.length) % fileslist.length].getName());
    counter = (counter-1+fileslist.length) % fileslist.length;
    return null;
    public String button2_action() {
    // Add your event code here...
    outputText1.setValue(fileslist[counter].getAbsoluteFile().getPath()+fileslist.length+"right"+counter);
    ii = new ImageIcon("images/Isadora\'s Wedding/"+fileslist[counter].getName());
    ar = (float)ii.getIconHeight()/(float)ii.getIconWidth();
    // aiw = new Integer(image1.getWidth());
    aiw = new Integer(ii.getIconHeight());
    aar = ar*aiw.intValue();
    image1.setHeight(""+(int)aar);
    outputText1.setValue(image1.getHeight());
    image1.setUrl("images/Isadora\'s Wedding/"+fileslist[counter].getName());
    ii = new ImageIcon("images/Isadora\'s Wedding/"+fileslist[(counter + 1 + fileslist.length) % fileslist.length].getName());
    ar = (float)ii.getIconHeight()/(float)ii.getIconWidth();
    // aiw = new Integer(image2.getWidth());
    aiw = new Integer(ii.getIconHeight());
    aar = ar*aiw.intValue();
    image2.setHeight(""+(int)aar);
    outputText1.setValue(image2.getHeight());
    image2.setUrl("images/Isadora\'s Wedding/"+fileslist[(counter + 1 + fileslist.length) % fileslist.length].getName());
    counter = (counter+1+fileslist.length) % fileslist.length;
    return null;
    }

  • Rowset parameter that depends on Component value

    Hello All,
    Suppose you have a list that is filled from the database, and you want to bind a textArea to a rowset that needs the list.getValue() as a parameter.
    The list.getValue() is populated during "Process Validation" phase (or "Apply Request Values" if "immediate").
    If the rowset is not filled with parameters, "java.sql.SQLException: execute() never called" is thrown during the earliest "Render Resposne" phase.
    Even after putting a hardcoded value in the constructor, trying to set and execute the rowset at later stages (after "Process Validation" or "Apply Request Values"), will not update the textArea.
    Is there any way to make this?
    Followed is the sample page
    Many thanks.
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page">
        <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
        <jsp:text><![CDATA[
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    ]]></jsp:text>
        <f:view>
            <html lang="en-US" xml:lang="en-US">
                <head>
                    <meta content="no-cache" http-equiv="Cache-Control"/>
                    <meta content="no-cache" http-equiv="Pragma"/>
                    <title>test Title</title>
                    <link href="resources/stylesheet.css" rel="stylesheet" type="text/css"/>
                </head>
                <body>
                    <h:form binding="#{test.mainForm}" id="mainForm">
                        <h:selectOneMenu binding="#{test.dropDown}" id="dropDown" immediate="true">
                            <f:selectItems binding="#{test.dropdownSelectItems}" id="dropdownSelectItems" value="#{test.allTypesRowSet.selectItems['COMMAND_TYPE_ID']}"/>
                        </h:selectOneMenu>
                        <h:inputTextarea binding="#{test.textArea1}" id="textArea1" value="#{test.commandTypeRowSet.currentRow['DESCRIPTION']}"/>
                        <br/>
                        <h:commandButton binding="#{test.button1}" id="button1" value="Submit"/>
                    </h:form>
                </body>
            </html>
        </f:view>
    </jsp:root>
    package monitor;
    import javax.faces.*;
    import com.sun.jsfcl.app.*;
    import javax.faces.component.html.*;
    import com.sun.jsfcl.data.*;
    import javax.faces.component.*;
    import com.sun.sql.rowset.*;
    import javax.faces.event.PhaseEvent;
    public class test extends AbstractPageBean {
        // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Definition">
        private int __placeholder;
        private HtmlForm mainForm = new HtmlForm();
        public HtmlForm getMainForm() {
            return mainForm;
        public void setMainForm(HtmlForm hf) {
            this.mainForm = hf;
        private HtmlSelectOneMenu dropDown = new HtmlSelectOneMenu();
        public HtmlSelectOneMenu getDropDown() {
            return dropDown;
        public void setDropDown(HtmlSelectOneMenu hsom) {
            this.dropDown = hsom;
        private DefaultSelectItemsArray dropdown1DefaultItems = new DefaultSelectItemsArray();
        public DefaultSelectItemsArray getDropdown1DefaultItems() {
            return dropdown1DefaultItems;
        public void setDropdown1DefaultItems(DefaultSelectItemsArray dsia) {
            this.dropdown1DefaultItems = dsia;
        private UISelectItems dropdownSelectItems = new UISelectItems();
        public UISelectItems getDropdownSelectItems() {
            return dropdownSelectItems;
        public void setDropdownSelectItems(UISelectItems uisi) {
            this.dropdownSelectItems = uisi;
        private HtmlInputTextarea textArea1 = new HtmlInputTextarea();
        public HtmlInputTextarea getTextArea1() {
            return textArea1;
        public void setTextArea1(HtmlInputTextarea hit) {
            this.textArea1 = hit;
        private JdbcRowSetXImpl allTypesRowSet = new JdbcRowSetXImpl();
        public JdbcRowSetXImpl getAllTypesRowSet() {
            return allTypesRowSet;
        public void setAllTypesRowSet(JdbcRowSetXImpl jrsxi) {
            this.allTypesRowSet = jrsxi;
        private JdbcRowSetXImpl commandTypeRowSet = new JdbcRowSetXImpl();
        public JdbcRowSetXImpl getCommandTypeRowSet() {
            return commandTypeRowSet;
        public void setCommandTypeRowSet(JdbcRowSetXImpl jrsxi) {
            this.commandTypeRowSet = jrsxi;
        private HtmlCommandButton button1 = new HtmlCommandButton();
        public HtmlCommandButton getButton1() {
            return button1;
        public void setButton1(HtmlCommandButton hcb) {
            this.button1 = hcb;
        // </editor-fold>
        public test() {
            // <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
            try {
                allTypesRowSet.setDataSourceName("java:comp/env/jdbc/Monitor");
                allTypesRowSet.setCommand("SELECT * FROM COMMAND_TYPE");
                commandTypeRowSet.setDataSourceName("java:comp/env/jdbc/Monitor");
                commandTypeRowSet.setCommand("SELECT * FROM COMMAND_TYPE where COMMAND_TYPE_ID=?");
                 //commandTypeRowSet.setString( 1, "A valid hardcoded value" );
            } catch (Exception e) {
                log("test Initialization Failure", e);
                throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
            // </editor-fold>
            // Additional user provided initialization code
        public void beforeApplyRequestValues() {
            try {
            commandTypeRowSet.setString( 1, dropDown.getValue().toString() );
            commandTypeRowSet.execute();
            } catch( Exception e ) {
                log( "beforeApplyRequestValues(): ", e );
        protected void afterRenderResponse() {
            commandTypeRowSet.close();
            allTypesRowSet.close();
        public void beforePhase(PhaseEvent event) {
            log( "BeforePhase 1 " + event.getPhaseId() + " with value " + dropDown.getValue() );
            super.beforePhase( event );
            log( "BeforePhase 2 " + event.getPhaseId() + " with value " + dropDown.getValue() );
        public void afterPhase( PhaseEvent event ) {
            log( "AfterPhase 1 " + event.getPhaseId() + " with value " + dropDown.getValue() );
            super.afterPhase( event );
            log( "AfterPhase 2 " + event.getPhaseId() + " with value " + dropDown.getValue() );
    }

    Phew, I found the reason, that is textArea is not readonly, so its value is overwritten during "ApplyRequestValues".

Maybe you are looking for

  • Configure HS talk to mysql through ODBC

    Hello Running 10g rel2 on Linux 64bit. Need to dblink to mysql 5. Configured: /etc/odbc.ini [myodbc] Driver = /usr/lib64/libmyodbc.so Description = MyODBC 2.50 Driver DSN SERVER = 209.71.254.40 PORT = 3306 USER = posman Password = posman Database = p

  • Non-ASCI character Support in OAM 11g

    Hi, I have a requirement to test the user authentication with Oracle Access Manager 11g. I am using Active Directory as the user repository and able to create a user with the user id containing non-ASCI value (say Äuser1) and AD allows for it creatio

  • Doc.saveAs() and filenames with commas

    Using Acrobat 9,  I have convinced myself that commas confuse the innards of the doc.saveAs() function. For example, from the console, the following throws an error: this.saveAs("john, jimmy.pdf"); the error: "UnsupportedValueError: Value is unsuppor

  • How to make visible Time Sheet link

    Hi, I want to know how to make visible Time Sheet link on portal for a particular Personnel Area so that employees of this PA can fill their Time Sheet from the portal.

  • H.264 blu-ray 720P60 sync problem

    I'm not able to maintain sync between sound and video when encoding 720P59.94 sequences (avi or mov) to 720P 59.94 h.264 Blu-ray (standard PrPro export settings). The sync is lost gradually, and at the end of a 42 minute clip, is off by more than a s