Execute ViewObject with Parameters at JSF Page Load?  JSF/ADF/BC 10.1.3

This 'should' be a simple problem, but I'm not seeing an answer, no doubt because I'm not searching for the right thing.
I have a page that has a grid populated by a view object that has a couple of named parameters. I have the values stored for the parameters based upon actions the user has already taken before they navigate to this page. I need to pass the parameters to the view object and open the query up without any user intervention, preferable before (or at) page load.
I see I can drag an 'ExecWithParams' from the data control pallette, but it looks like it would default to having the user enter the parameter values, which is what I'd like to avoid.
In a previous life I had events available like 'OnCreate' where I'd put code like this, but I'm still learning to think in JSF/Java.

Ok, now I see how it's supposed to work. Pretty straightforward if you know where to look. It raises another question for me though...
In my process, I've got the user logging in, at which point a series of user preferences are extracted from the database. My first thought was to store them somehow in the users' session, but I didn't see a way to do that, so I created my own implementation of it with a bunch of getter/setter methods, inside the data model of the project. Unfortunately, I can't see a way to surface them without putting them in the ApplicationModule and adding them to the client interface. In the interim, I came across some utilities methods (written by Steve Muench and Duncan Mills) called ADFJSFUtils and JSFUtils. In the JSFUtils there's this method:
void storeOnSession(String key, Object object) {
FacesContext ctx = getFacesContext();
Map sessionState = ctx.getExternalContext().getSessionMap();
sessionState.put(key, object);
I assume it's designed to work in the ViewController project (since I haven't been able to call it from my Model project) .
This has been a long way to ask: What's the best/recommended way to store variable values for the users' session is a way that I can access them for binding to view objects (as you described above)? I'd love to just implement the storeOnSession right in my appplication module, but it lacks the context, apparently.

Similar Messages

  • ADF how can i execute a query with parameters when the page renders

    i am using ADF web 11g
    i need to execute a query with parameters when the page renders

    I'm a fan of Java code, I really am.
    But when you use ADF, you decided to move to a more declarative environment.
    So why not do it declarative, the adf way?
    In your pagedef insert a action binding.
    This can be anything, a call to the application module, a call on the iterator(Like executeWithparams, etc.)
    Create an invokeAction in your pagedef and set the condition.
    This example refreshes(Action 2 is execute query) the data.
    First the method binding:
        <action IterBinding="PersoonIterator" id="Execute" InstanceName="LSAppModuleDataControl.Persoon"
                DataControl="LSAppModuleDataControl" RequiresUpdateModel="true" Action="2"/>And the invoke action
        <invokeAction Binds="Execute" id="refreshData"/>This always refreshes the data on page entry, but anything is possible, you can set condictions for the invokeAction.
    PS Yes I know that pagedefs become backing beans in the end and yes that is Java code, but if you wanna play the ADF way, the goal is the reduction of Java code and the increased performance of declarative programming.

  • Method call before visual web jsf page loads

    Hi All.....
    I have written a method in a java class that accesses the mysql backend db to check if a process is still running. If the process is still running, a JOptionPane is produced informing the user of this and offers an <ok> option(to check the process status again) and a <cancel> option(to redirect the user to the homepage). If the process is completed, I want the page to just load as normal. I want this method to be called before the visual web jsf page loads. I have the method call in the super_init() method of the page and everything seemed to be working fine, the problem I have run into is that if I set the value in the db to show the process is running, the JOptionPane is produced(like it should be), and then if I set the value to show the process has completed and choose <ok> from the pane, the page loads.....this is what I want. Now, after the page loads, if I set the value in the db to show the process is running again, the JOptionPane is produced again right after I apply the changes to the db edit!!!!. I don't know why this is happening. Should I be calling the method from somewhere other the super_init()????? I have tried the method call in the prerender(), preprocess(), and destroy() methods all with the same results.
    Anyone have any ideas on what the problem could be??
    Thanks in advance.

    The Java part of a JSP/Servlet based webapplication runs physically at the server machine.
    Only the HTML/CSS/JS part which is generated by the webapplication and sent to the client physically runs at the client machine.
    JOptionPane is a Java Swing component which thus runs at the server machine. So you as client would only see it when both the server and the client runs at physically the same machine. Which is often only the case in development environment and doesn´t occur in real life! There is normally means of two physically different machines connected through the network/internet.
    To solve your actual problem, look for Ajax poll techniques. To display an alert or confirm dialogue in the client side, you use Javascript for this.

  • On JSF Page load UI components loading sequence

    Hi All,
    I have some questions about the UI components loading sequence on the JSF page load.
    When a JSF page loads it loads its UI components which have a sequence of getters and setters declared in the backing bean of that jspx page.
    Qustion 1: How these getters and setters in backing bean work in loading the jspx page?
    Question 2: How this backing bean is related to the Page Definition file for the page loading?
    Question 3 (main query): What is the sequence of the getters and setters. Means, if i drop 3 UI components, 1 input text, then a command button and then an output text, then they are accordingly declared in backing bean. On page load first i/p texts getter gets called, then setter, then command button's and theno/p texts, in these sequence.
    But can i manipulate their sequence of loading. If yes then how it can be possible?

    Answer 1: Getters and Setters in bean normally will be bounded to ui component's properties in jspx page, when jspx page loads these getters get called through introspection and setters gets called when a request is submitted.
    Answer 2: Backing bean and page definition are two different entities and they are no way related unless you have a data control for the backing bean and have bindings for those methods in page definition file
    Answer 3: The sequence of getters and setters depends on the order of the components they bounded to in jspx page. components in jsf page gets loaded from top to bottom so the getter bound to the top component gets called first and the getter bound to bottom component gets called last.
    The only way to change the sequence of getter methods getting called is to just change the order of the components they bound to in jspx page.
    Usually, it is not suggested to put business logic inside getters and setters, where you have action and actionlisteners for the same. If you follow that, you don't need to worry of the sequence of getters and setters execution

  • JSF Page Load

    Is there such thing as a JSF Init Page Load? the same thing that .net has with Page_Load? How do i init the code behind bean?

    I had the same problem. What you can do is the following:
    in your Bean you need all your request parameters as properties with getter and setter.
    additionally add a boolan prepare property. Set this to false at the beans constructor : this.prepare = false;
    in your faces config define your bean this way :
        </managed-bean>in your view add such a single line at the beginning ( right under <f:view... > )
    <h:panelGroup rendered="#{myBean.prepare}" />now, tomcat will execute myBean.getPrepare( )
    this method should look like this :
    public boolean getPrepare()
              if (prepare)
                   //do what you want with your request params. they are already set at this point !
              prepare = false;
             return prepare;
         }after loading the view once, the getPrepare Method is executed and the prepare property is set to false.
    I need that, because getPrepare is loaded at any ajax page reload, too. ( I'm using icefaces )
    access your jsf page with : http:localhost:8080/whatever/myPage.iface?requestParam01=hello&requestParam02=World

  • JDev Execute method (with bind variable) before page is displayed

    Hi All,
    I have a view object with a query that uses a bind variable. I drag the data control onto my .jsf page to create a table. I create a query method on a view scope bean. The query method uses the contents of one of the bean's attributes to set the bind variable for the query:
    vo.setNamedWhereClauseParam("CraIdBindVar", sessionBean.getCraId());
    I place a button on the page that invokes the query method and it populates the table. This is fine but I don't want the user to have to click on the 'query' button when they navigate to this page. I have found forums that discuss creating an AMImpl.jave method, creating a binding on the page, creating an executable for the binding. This works in that the method is executed before the page is displayed. However, the AMImpl method cannot call sessionBean.getCraid() to get the necessary data item to populate the bind variable.
    Is there a way to execute my view scope bean method before the page is displayed? Or perhaps a way for the AMImpl.java method to access the view scope variable?
    Thanks, Steve

    you can drag a method call activity onto the task flow. Then select the new method call activity and open the property inspector. Here you select the method from your bean in the method property. Now you first navigate to this method call activity and then to the page.

  • ADF/JSF page loads when any command button is clicked

    Hello All,
    I am lost in the ADF/JSF page flow (using Jdev 10.1.3). Following are the tags (in order) in my page;
    <f:facet name="contextSwitcher">
    <af:panelHorizontal> has a af:commandLink </af:panelHorizontal>
    <f:facet name="messages">
    <h:panelGrid columns="2" cellspacing="14">
    has 2 panelgroups (one group has *2 SelectOneChoice lists (that need to be populated by fetching data from database* and the other group has 2 CommandButtons - 'Go' and 'Cancel") (GO BUTTON SETS THE SHOWPANEL() TO TRUE)
    <h:panelGrid columns="2" cellspacing="14" rendered="#{myBean.showPanel}"> (THIS ONE IS RENDERED WHEN SHOWPANEL() METHOD IS TRUE)
    has 3 inputText fields
    <af:table var="someTable" rendered="#{myBean.showPanel}"> (THIS ONE IS RENDERED WHEN SHOWPANEL() METHOD IS TRUE)
    has a bunch of af:columns
    <af:panelHorizontal rendered="#{myBean.showPanel}"> (THIS ONE IS RENDERED WHEN SHOWPANEL() METHOD IS TRUE)
    has 3 af:commandButtons - submit, save, add row
    <!-- Footer -->
    <jsp:include page="/pages/includes/footer.jspx"/>
    <script type="text/javascript" src="../script/tree.js"></script>
    _*why is it that when the command buttons are clicked, the whole page is loaded? Only the methods associated with the action (action="#{newMapRequestItem.addARow}" ) should be called.*_
    Edited by: user12054715 on Mar 24, 2010 12:00 PM

    Can somebody please address this?

  • How to Auto Select some RadioButton on page load using ADF/JSF

    I am learning ADF and need some help. I have multiple radio buttons and couple of text boxes on my page. How can I make some radio button be selected based on some value from a database table and also populate the text boxes with the corrosponding value when a page loads. Any tips on how it can be done using ADF. Any sample tutorial will be helpful.

    when you e.g. use ADF BC then the radio button should be selected automatically based on the value of the attribute. If the row is new then you can have a default value specified in the ADF BC ViewObject attribute.
    However, if you just dragged the radio button and checkboxes onto the page - not using any ADF binding - then you will have to create a managed bean with a field variable (incl. setter/getter methods) to link the radio button's value property to it using Expression Language

  • I cann't execute javac with parameters. please help !!

    Hi All!!
    I can't understand how to execute application or bat file (javac.exe for example) WITH parameters correctly.
    I can execute javac.exe or bat file - WITHOUT parameters :
    Process p = Runtime.getRuntime().exec(WIN_PATH + " " + WIN_FLAG + " " + "javac.exe");
    But I can't execute correctly the command like:
    "javac.exe -classpath C:\Alex; Test.java"
    I tried to use exec(str,env[]) and exec(cmd[]) methods, but there were different errors as a result :(((
    How can I execute the command "javac.exe -classpath C:\Alex; Test.java" ? Is it possible?
    Please help me by a good idea.
    Thank you.

    right you are! That's why we use "\\" instead "\" :)
    If i try to execute this command -
    cmd=WIN_PATH + " " + WIN_FLAG + " " + "c:/j2sdk1.4.0/deleteMe/javac.exe -classpath C:/WORK/jboss-3.0.3/client/jboss-j2ee.jar;S:/Alexander/jars/sys.jar;S:/Alexander/jars/ejb_conf_dev.jar;S:/Alexander/jars/; C:/j2sdk1.4.0/deleteMe/aaBean.java";
    my OS Windows 2000 returns na error - "Error opening icon..."
    What's wrong?
    Thank you...

  • Modal popup with lightbox effect on page load

    Hi friends,
    I was looking for help for making a windows modal popup with reads a url from xml file and load it into windows modal popup in the centre of the screen on page load. The requirement was also that it will dim the rest of the page. After searching at several places I got hint at:
    Now there are two issues that background page is not getting dim and if any one can help me in telling how to load flash modal popup on pageload. I dont want it to be annoyed so just want to load popup once a session of once a day only on first page, I am trying cookies but I dont know why I it is not reading cookies in production environment. There are lot of examples available in javascript and silverlight but I want in flash.
    Any help shall be highly appreciated.

    Thanks. Unfortunately I'm not sure the code will apply to my
    situation... I'm actually not using a Spry dataset in any way, just
    some Spry effects to enhance my own markup (which comes from a PHP
    page but is static as far as the document is concerned.)
    If I put the Spry effect in the body onload handler, the
    element appears for a second as the page loads, then disappears
    suddenly as the Spry fade in effect kicks in bringing it from 0 to
    Another related question, I would like the Spry effect to to
    fade in with some values ending at the values as set by my CSS
    class... is it possible to have it do so? In other words fade from
    0 to current value? I know there are some ways to retrieve default
    styling of an element but figure Spry might have something built

  • Execute code on UI component during page load

    Hi All,
    I am usng Jdeveloper 11gR2.
    I want to invoke below code snippet to change the properties of input text fields and set them to enable on page load -
            FacesContext facesContext = FacesContext.getCurrentInstance();
            UIViewRoot root = facesContext.getViewRoot();
            RichPanelFormLayout formClass = (RichPanelFormLayout)root.findComponent("id");
            List<UIComponent> uiComponentList = formClass.getChildren();
                  for (UIComponent uiComponent : uiComponentList) {
                      if (uiComponent instanceof RichInputText) {
                          Boolean flag = ((RichInputText)uiComponent).isChanged();
                          System.out.println("flag - " + flag);
    At present the code snippets works well on command component action but I want to execute the same during initial page load without the use of any command component.
    Please advise on how to achieve this.
    Best Regards,
    Ankit Gupta

    Check out https://blogs.oracle.com/adf/entry/an_epic_question_how_to
    Solution 2 (invoke actions) are deprecated in 12c so I wouldn't recommend using it.

  • How to refresh JSFF page only when page loaded using ADF 11g

    I am facing an issue with prepreModel() usage in the .jsff page fragment. I want to invoke executables only when the specific jsff page get's loaded. I tried using 'prepareModel' as a refresh condition, but I can see always executables are getting executed. Does 'prepareModel' behaves differently for .jsff when compared to .jspx ?
    Thanks in Advance

    ADF Regions have a slightly modified lifecycle. However, prepareModel behaves the same. Its marking a specific time in the ADF request lifecycle when the iterators are refreshed. Try prepareModelIfNeeded

  • How to get the initial state of JSF PAGE IN ORACLE ADF

    Hi everybody
    my Jdeveloper version is 12.1.3
    I'm building my JSF pages based on a template that has a navigation pane which contains command navigation items , every one of them (command navigation items) appears as a link at runtime and calls a JSF page , I wish to get the initial state for any page when leaving it then entering such page again , and I would like to know what is the suitable place to write the code to do this task.
    many thanks !

    Clear the cache by adding the following to each jsf page.

  • Problem with JSF Page loading with WAS

    We are using Trindad Faces & the app server is Websphere
    When the server starts up, its gives lots of logs (does not say error or warning) as below.
    11:13:58:881 EST] 00000019 jsf W com.ibm.ws.jsf.configuration.FacesConfigParser parseShared FacesConfigParser.parseShared(): unable to locate : [group]
    [11/10/06 11:13:59:061 EST] 00000019 jsf W com.ibm.ws.jsf.configuration.FacesConfigParser parseShared FacesConfigParser.parseShared(): unable to locate : [property-metadata]
    [11/10/06 11:13:59:231 EST] 00000019 jsf W com.ibm.ws.jsf.configuration.FacesConfigParser parseShared FacesConfigParser.parseShared(): unable to locate : [group]
    [11/10/06 11:13:59:372 EST] 00000019 jsf W com.ibm.ws.jsf.configuration.FacesConfigParser parseShared FacesConfigParser.parseShared(): unable to locate : [property-metadata]
    [11/10/06 11:13:59:532 EST] 00000019 jsf W com.ibm.ws.jsf.configuration.FacesConfigParser parseShared FacesConfigParser.parseShared(): unable to locate : [group]
    [11/10/06 11:13:59:782 EST] 00000019 jsf W com.ibm.ws.jsf.configuration.FacesConfigParser parseShared FacesConfigParser.parseShared(): unable to locate : [property-metadata]
    [11/10/06 11:13:59:942 EST] 00000019 jsf W com.ibm.ws.jsf.configuration.FacesConfigParser parseShared Face
    And, when I try to access the Page, the following error message is shown up and the page is not getting displayed.
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:754)
    at org.apache.myfaces.trinidad.render.RenderUtils.encodeRecursive(RenderUtils.java:66)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:255)
    at org.apache.myfaces.trinidad.render.CoreRenderer.encodeAllChildren(CoreRenderer.java:277)
    at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelPartialRootRenderer.renderContent(PanelPartialRootRenderer.java:70)
    at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.BodyRenderer.renderContent(BodyRenderer.java:134)
    at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PanelPartialRootRenderer.encodeAll(PanelPartialRootRenderer.java:150)
    at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.BodyRenderer.encodeAll(BodyRenderer.java:76)
    at org.apache.myfaces.trinidad.render.CoreRenderer.delegateRenderer(CoreRenderer.java:294)
    Any thoughts on what could be the issue?
    Thanks in advance!!

    Hi Raymond,
    Is it possible to package a JSF implementation with your web application and then use the usual classloading order?
    * Tried that, looks like that wont work. WAS throws all sorts of exceptions :
    java.lang.NoSuchMethodError: javax/servlet/jsp/JspFactory.getJspApplicationContext(Ljavax/servlet/ServletContext;)Ljavax/servlet/jsp/JspApplicationContext;
    +Caused by: org.springframework.binding.expression.EvaluationException: An ELException occurred getting the value for expression 'ehrRequest.savePractice(practice)' on context [class org.springframework.webflow.engine.impl.RequestControlContextImpl]+
    What about hiding the JMS queuing behind an EJB (that way the JMS happens in the EJB container, not the web container, a total hack but what can you do)? Have you tried moving all of your classes and libraries from the WAR and into the application space?
    Thats actually a pretty good idea. I am gonna try that.

  • JSF page loading another JSF in iframe from same domain with diff port

    I was wondering if anyone has experienced this issue. I'm using ADF 11g and weblogic 10.3.2. Here's the scenario
    1. two ADF 11g application, app1 and app2
    2. app1 is deployed on managedserver1 running on port 7001
    3. app2 is deployed on managedserver2 running on port 7002
    4. page1 on app1 loads page2 from app2 inside an iframe.
    5. When a button is clicked on page1 that does a ppr or even a complete postback, the following message from the browser appears:
    Because of inactivity, your session has timed out and is no longer active. The page will automatically be reloaded in 10 seconds; if not, click here.
    When i check the log file on managedserver1 its has the following error:
    SEVERE: Could not find saved view state for token <some token>
    I did some research and came across oracle.adf.view.rich.security.FRAME_BUSTING, but this is not the issue here, the iframe loads fine, but after loading when i tried to do something on page1 it seems that the state of the page is messed up.
    Any idea would be helpful.
    Edited by: user8663354 on Jun 20, 2010 7:05 PM

    chances are that the iframe is not isolated as you think it is and the state management of the two overrides each other. I think its best to file a service request with customer support to ensure this scenarion is supposed to work

Maybe you are looking for

  • How do I sort the photos in the photo pane when making a photo book?

    There's a certain order that I'd like to see the photos I want to use when making a photo book.  But the order that I have it in (which is done manually and not by date) in the album does not appear in the same order when I want to turn some of those

  • Pdf's no longer opening in Acrobat X Pro

    In the last two weeks or so, users have reported that where PDFs in libraries used to open in Acrobat Pro client, now the pdfs only open in browser. We've checked the library and it's still set to Open in client Application.    In Internet options, p

  • How to get database connection in common java class

    hi friendz, plz help me... I am using JDEV version. my problem is I'm writing common java class which can reuse any application. in this case when im create database connection like this, String username = "a"; String password = "b"; Strin

  • Oh Dear, here we go again!

    After cocking my capital one gift up for six weeks, Ovi strikes again. Purchased an album, tried to download it, it wouldn't. £9.99 was taken from my account. Tried again to download but the option to do so is greyed out. Emailed Nokia Care, they tol

  • New apps not working .

    i just bought the new apps for my ipod touch, and theyre not working!! the only thing it downloaded was the gray area around the bottom portion, i didnt get any of the new apps. HELP !!! i dont know what to do, i hope i didnt just waste $20 !