Dynamic jnlp browser

Hi,
I have a web page processing a servlet which produces a jnlp file dynamically, when pressing a button on the page. Servlet is working and loading, then opening a new web browser displaying the result of the work(by using BasicService showDocument() method). But the old page, which loaded servlet, remains open. I want to close the old browser when java web start application finishes its work and opens a new page.
Thank you for replies..

  /** Reference to the root frame hosting this JWS applet */
  Frame root = null;
  public void init() {
    Component parent = getParent();
    while(parent.getParent()!=null) {
      parent = parent.getParent();
    if (parent instanceof Frame) {
      root = (Frame)parent;
    System.out.println(root);
    System.out.println(root.getBounds());
I searched the web and this forum for a
few days now but couldn't find any hint.Maybe you were looking in the wrong place..
http://groups.google.com/group/comp.lang.java.programmer/msg/afa0008361dcce3c
As an aside, the easiest thing to do for an
applet that does not require a full applet
context (paramaters, codebase, getimage etc.)
is to
- construct it.
- call init() and stat() on the instance, then
- add it to the CENTER of your own frame.
- call the frame as an application (from a main())

Similar Messages

  • How to run the dynamic jnlp generate by jsp, but cache one is not dynamic?

    Hi Web Start expert,
    I need some urgent help on this issue. I want to pass some session info from my protal web app to my java app through web start. I have tried to use a servlet or jsp to generate a dynamic JNLP which will include all the necessary properties. It works fine if I don't include a href attribute in my jnlp tag. but I won't be able to launch the application off line. So I include the href to point to a static jnlp file resides in the same directory where jars are installed. This time when web start launches, my Java application does not seem to recognize all the login properties I passed through web application, and launch the Login Dialog. What I want to do is, if I come from the portal, since I had signed on to the portal, I don't need to login again to the java app. but when next time I click on the offline shortcut on my desktop for my Java app, I need to sign on to launch my Java app that was cached on the client machine. What is the best way to do this? Please help!
    Thanks in advance.
    Jenny

    The problem here is, when you acess the servlet from the browser, the servlet generates the jnlp file with the properties based on the full reference to the servelt (ie: http://myhost.com/servlet?arguments=xxx;yyy).
    If you put the href in the jnlp file:
    <jnlp codebase="http://myhost.com" href="servlet">, When Java Web Start is invoked, it will re-download the jnlp file using just "http://myhost.com/servlet", This will cause the servlet to generate jnlp file w/o the propertys that were based on the arguments and parameters to the url.
    On the other hand, if you try to add the arguments and parameters to the href wirh <jnlp codebase="http://myhost.com" href="servlet?arguments=xxx;yyy"> two problems occur.
    1.) java web start (all versions thru 1.4.2) will generate the cache directory based on the whole string "servlet?arguments=xxx;yyy" this means that every invocation is a seperately cached app, and you will get lots of entries in the download applications page in the Application Manager.
    2.) on some platforms, generating cache directory with "?" or ";" can cause IOExceptions.
    These problems will be addressed in 1.5:
    1 - the cache directory will be based only on the string up to the first "?" or ";".
    2 - jnlp files w/o href, will still be shown in the downloaded applications, and can be launched offline (if offline-allowed)
    In the mean time the only work around I have heard, is someone tried modifying the servlet, to first download the jnlp file with the correct parameters and args but with href="servlet", but caching the jnlp file generated, and then when java web start requested the servlet with no args, a few seconds later, sending it back the cached version.
    /Dietz

  • Why jws doesn't start when i use jsp as dynamic jnlp?

    hello everyone,
    i use a jsp as dynamic jnlp to resolve the relative codebase problem,but jws can not start. while i use jnlp, there is no problem.i check the http head the jsp reterned,it seems no problem (it returns "application/x-java-jnlp-file" content type), but jws does not start and the browser opens it as a plan text. below is the http head the jsp and jnlp returned, i can not see any obvious difference that prevent jws start. hope somobody can help me, thanks.
    the jsp http head:
    HTTP/1.1 200 OK
    Content-Type: application/x-java-jnlp-file
    Date: Wed, 07 Aug 2002 02:52:31 GMT
    Server: Apache Tomcat/4.0.2 (HTTP/1.1 Connector)
    Connection: close
    Set-Cookie: JSESSIONID=EDAB1A3175B3D319BA33AE090EB973BF;Path=/webims
    the jnlp http head:
    HTTP/1.1 200 OK
    Content-Type: application/x-java-jnlp-file
    Content-Length: 372
    Date: Wed, 07 Aug 2002 02:49:58 GMT
    Server: Apache Tomcat/4.0.2 (HTTP/1.1 Connector)
    Connection: close
    Last-Modified: Wed, 07 Aug 2002 02:35:19 GMT
    ETag: "372-1028687719000"
    the response body is same. here is part of the jsp file:
    <%@ page contentType="application/x-java-jnlp-file"%>
    <%
    StringBuffer codebaseBuffer = new StringBuffer();
    codebaseBuffer.append(!request.isSecure() ? "http://" : "https://");
    codebaseBuffer.append(request.getServerName());
    if (request.getServerPort() != (!request.isSecure() ? 80 : 443))
    codebaseBuffer.append(':');
    codebaseBuffer.append(request.getServerPort());
    codebaseBuffer.append(request.getContextPath());
    %>
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp codebase="<%=codebaseBuffer.toString()%>" href="<%=request.getRequestURI()%>">

    I get the same problem since I moved to Tomcat 4.1.18.
    The difference is that when I look at a jnlp, I get
    Date: Tue, 18 Mar 2003 10:58:25 GMT
    Server: Apache/1.3.26 (Unix) mod_jk/1.2.0 mod_ssl/2.8.10 OpenSSL/0.9.6b PHP/4.2.3 FrontPage/5.0.2.2510
    Content-Length: 1355
    Content-Type: application/x-java-jnlp-file
    Last-Modified: Mon, 17 Mar 2003 15:58:46 GMT
    Client-Date: Tue, 18 Mar 2003 10:58:25 GMT
    Client-Peer: 192.197.110.222:80
    and at a jsp:
    Date: Tue, 18 Mar 2003 11:06:10 GMT
    Server: Apache/1.3.26 (Unix) mod_jk/1.2.0 mod_ssl/2.8.10 OpenSSL/0.9.6b PHP/4.2.3 FrontPage/5.0.2.2510
    Content-Type: application/x-java-jnlp-file;charset=ISO-8859-1
    Client-Date: Tue, 18 Mar 2003 11:06:10 GMT
    Client-Peer: 192.197.110.222:80
    Set-Cookie: JSESSIONID=026BF3209EC094A4045F1D37C2A0E98B;Path=/
    Could the difference be ;charset=ISO-8859-1
    How to remove that, in my jsp I just have :
    <% response.setContentType("application/x-java-jnlp-file"); %>
    Help
    Benoit

  • Dynamic JNLP causes exception on 1st run after java install

    I have a dynamic JNLP file (php) which runs my software. It works just fine, except for the 1st time it is run after a user has installed Java.
    I get the exception; "The following field was missing from the jnlp file: <jnlp>". When I look at the jnlp code in JWS in the "Launch File" tab of the error message, I see that the JNLP is not there - but the page the user would see if he was not logged into the system (as if JWS has cached the file or something).
    If I close it down, press F5 to refresh, and run it again everything works fine.
    I'm running the dyanmic.jnlp?dummy=randomnumber943934 to prevent caching. In addition, these headers are sent: (php code)
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    // HTTP/1.1
    header("Cache-Control: no-store, no-cache, must-revalidate");
    header("Cache-Control: post-check=0, pre-check=0", false);
    // HTTP/1.0
    header("Pragma: no-cache");.. so nothing should be cached. But I'm not sure that's where the problem is - cause it only happens the first time after a java install.
    Any clues?

    I think you're dynamicallt created jnlp is invalid in someway; I can use the following without any problems:
    <?php
    header("Content-type: application/x-java-jnlp-file");
    echo "<?xml version=\"1.0\" ?>\n";
    $codebase = trim(stripslashes(urldecode($_REQUEST["codebase"])));
    $href = trim(stripslashes(urldecode($_REQUEST["href"])));
    echo "<jnlp spec=\"1.0+\" codebase=\"$codebase\" href=\"$href\">\n";
    ?>
    </jnlp>
    you should try and test the output of your generated code, something like this should work:
    test.php
    <html>
    <body>
    <textarea rows=20 cols=70>
    <?php
    include 'mydynamicscript.php';
    ?>
    </textarea>
    </body>
    </html>
    The first time a jnlp is called it is downloaded into the browser cache and javaws.exe is executed on it from that location, this in turn downloads the jnlp again from the passed codebase & href attributes into the jws cache. Subsequent calls the jnlp are extracted from the copy in the webstart cache, and often downloaded from the codebase & href attributes when it detects possible changes. In your case these jnlp files seem to differ.
    - Richard

  • Dynamic JNLP - displaying using java web start

    Hi,
    I am creating a dynamic JNLP in a servlet at the server side. Please see below.
    String someJnlpString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n" +
                                                "<jnlp .....    >    </jnlp>";       
            String attachment = "inline; filename=\"launch.jnlp";           
            String ct = "application/x-java-jnlp-file";
            OutputStreamWriter out = new OutputStreamWriter(response.getOutputStream());
            response.setContentType(ct);
            response.setHeader("Cache-Control", "max-age=30");
            response.setHeader("Content-disposition", attachment);
            out.write(someJnlpString);{code}
      Then in my JSP, I am trying to open this JNLP  by using the following code
    {code}        window.open('servlet/DisplayImage?arg=first-arg");The exception that I am getting is JNLParseException could not parse launch file. Error at line 0. If I open the downloaded file then its working.
    Can somebody please advise me how can I directly open that JNLP from the servlet by using java web start?
    Thanks a ton,
    Subhash

    I am able to run it now after clearing the java cache

  • Dynamic JNLP and JWS Application Manager

    All,
    I have a Swing application that communicates to the server via Servlets. I have packaged the entire application into a WAR file and I am using JWS to distribute to the users.
    The "main" method of my application accepts two parameters, one of which is dynamic based on information from the web server. To be able to calculate the value of that parameter, I decided to dynamically create and serve my JNLP file through a servlet. The parameter is then passed into the application via the <argument> tag in the served JNLP file.
    That part works great. However, once the application is installed, it doesn't show up in JWS Application Manager. My best guess is because there is not a "physical" JNLP file for reference.
    Can anyone out there confirm or deny my guess? And, more importantly, can anyone give me an idea on how to keep the dynamic JNLP file and get it to install in the JWS Application Manager?
    Thanks!

    Got it fixed. Apparently, the JWS Application Manager "view" setting wasn't correct. Once it was working, the application was showing up fine.

  • Serving dynamic JNLP gotchas

    I'm planning on providing a means by which users will, upon hitting a certain URL, be served with a JNLP file that is appropriate to their environment. For example, if the user (authenticated in our case via an enhanced version of the MOD_NTLM Apache module) is in a group that should be performing beta testing, he/she could potentially be presented with a JNLP file that enables the testing of the beta version of the application.
    There have been many concerns raised on this forum regarding the dynamic generation of JNLP files. One of particular concern to me was: http://forum.java.sun.com/thread.jsp?forum=38&thread=476755 I'm not quite sure, though, which of these issues are truly still issues with the latest 1.4.x of Web Start [1.5 won't be an option for us until it is officially released].
    Can anyone provide a summary of the known issues with dynamically serving up JNLP files and their known work-arounds? If there is an FAQ (by Sun or anyone else) that captures these issues, I'd greatly appreciate it if anyone could point me to it.
    Also, if you have any advice on which dynamic mechanism (servlet, servlet filter, JSP, other?) seems to work best or cause the least amount of issues, I'd appreciate the feedback.
    Thanks in advance,
    Mike

    You might wonna try to post your questions about serving dynamic JNLP gotchas to the Java Developers group. You can find it online @ http://groups.yahoo.com/group/webstart
    - Gerald

  • Jnlpdownloadservlet and dynamic jnlp file

    Problem: we want the version handling (+ jardiff) of JnlpDownLoadServlet, but we also need to construct the jnlp file dynamically (for example: a .jsp file). It seems to me there are two solutions, neither of them good: a) hack the JnlpDownloadServlet (or roll our own), intercepting the jnlp-file-reading code to forward to the jsp page that generates the jnlp xml data and use the generated response as the file contents.
    b) generate each jnlp file dynamically and then store it in a temporary location for the JnlpDownloadServlet to pick up. This entails aging the temporary jnlp files and deleting them so the server doesn't get clogged with dead jnlp files.
    Is there a third possibility? Or something in the pipe for the near future?
    (Note: Web Start Services is not a solution for this task since WSS doesn't support jar versioning, and since the $$properties mechanism does not appear to be ideal for passing a lot of dynamic jnlp information.)
    Thanks in advance for any advice.

    My jsp page actually generates the list of jars for the application. It also passes some info specific to the user session by means of the jnlp file. Since we are doing games, the list of applications keeps growing. By generating the resource elements dynamically for a game, we can reduce maintenance (as opposed to having a large number of jnlp files with mostly duplicate code) -- especially when a version is updated.
    Till we can move to 1.5, I plan to use the temporary file creation method.
    Thanks, --John                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Problem of Dynamic JNLP

    I pass parameters to jsp with request and use jsp to create jnlp with the parameters.
    i use
    http://www.exam.com:8001/csec/Start.jsp?name=aaa
    to pass name to jnlp
    the first time i can get the parameter!
    But when the jsp is reloaded,jnlp will lose the parameter,it will be null
    i can't slove the problem,
    who can help me ,thanks
    Start.jsp
    outj.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
    outj.println("<jnlp spec=\"1.0+\" codebase=\"http://www.exam.com:8001/csec"
    + "\"" + " href=\"Start.jsp\">");
    String para = request.getParameter("name");
    null

    Hello Akihabara,
    I am contacting you because you had the same issue before.
    I am having a Application.jar which has 3 different versions. I have created a version.xml to specify about the version of the application.jar.
    Now, I want my user to choose which version he wants to download.
    for example: if he has the application_1.1.jar then he should be given a text box (in a JSP page) to enter which version he wants to download. if he enters 1.2 then that particular version should be downloaded.
    Normally if we want to use versioning then we specify the the version in the JNLP file (EX: <jar href="application.jar" version="1.2" main="true" download="eager" /> )
    I also want the java web start to do "JarDiff" while downloading so that it downloads only the pdated files.
    ( Normally to implement JarDiff we have to mention the "current-version" field in the jnlp file ( Ex: <jar href="application.jar" version="1.2" main="true" download="eager" current-version="1.1" /> )
    I am using JnlpDownloadServlet to process the jnlp file. ( To get dynamic codebase and context path)
    Instead of hard-coding the version field and current version fileld in the JNLP file can i generate a dynamic JNLP which would insert the above values for those fields.
    In a previous post you solved the similar problem using a servlet as you mentioned over there. Did you use JnlpDownloadServlet also? or You had your own servlet?
    Can you guide me regarding this issue.
    Thanks,
    Anjali

  • Dynamic JNLP files?

    I have a number of small, embedded devices running a Cherokee web server, each with their own IP address and hostname. Each of these devices has a standard image that includes a few applets. Is there a way to make a standard JNLP file that could go in the image but would still work? My concern is that the codebase is going to be different for device...

    A way to generate dynamic JNLP's is by using a servlet.
    The servlet path is the JNLP target for the client, and the servlet itself outputs the JNLP contents with the JNLP content-type.
    Jacco

  • Dynamic JNLP

    Hi
    I am new to Java WebStart. I found in a few posts that an application can be launched dynamically from a servlet. Any examples which I can refer to? I have a web portal and I want to prevent users from launching the application by typing the link to the jnlp file in the browser URL. Also I would like the users to avoid login if they have already login to the portal.
    Thanks
    Steven

    OK, now I understand it.
    Try this one from your servlet. It works here at least.
    InputStream stream = getServletContext().getResourceAsStream("/<your_app>.jnlp");
    ByteArrayOutputStream out= new ByteArrayOutputStream();
    int b;
    while((b=stream.read())!=-1){
    out.write(b);
    response.setContentType("application/x-java-jnlp-file");
    PrintWriter wr = response.getWriter();
    wr.write(out.toString());
    wr.flush();
    wr.close();

  • Issue with IE and dynamic JNLP (JSP)

    I'm trying to create a JNLP file using JSP to insert a dynamic argument into the webstarted (new word?) program. The link works fine in Firefox and Opera, but IE throws an error and says that it could not download the file. Here's my setup:
    JSP file (JNLP)
    LaunchClient.jsp
    <%@page contentType="application/x-java-jnlp-file"%>
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE jnlp PUBLIC "-//Sun Microsystems, Inc.//DTD JNLP 1.5//EN" "http://www.netbeans.org/jnlp/DTD/jnlp.dtd">
    <%
        String projectRefID = request.getParameter("projectRefID");
    %>
    <jnlp codebase="http://127.0.0.1:8080/tssa/">
      <information>
        <title>AppTest</title>
        <vendor>Company, Inc.</vendor>
        <homepage href="homepage.html"/>
        <description> </description>
        <icon href="default"/>
        <offline-allowed/>
      </information>
      <resources>
        <j2se href="http://java.sun.com/products/autodl/j2se" version="1.4+"/>
      </resources>
      <resources>
        <jar download="eager" href="jars/AppTest.jar" main="false"/>
      </resources>
      <application-desc main-class="apptest.Main">
        <argument><%= projectRefID %></argument>
      </application-desc>
    </jnlp>My link to the above page looks like this:
    <a href="LaunchClient.jsp?projectRefID=<%=currProject.getReferenceIdentifier()%>" >CLICKME</a>I've added the following mime mappings to my web.xml:
        <mime-mapping>
            <extension>jnlp</extension>
            <mime-type>application/x-java-jnlp-file</mime-type>
        </mime-mapping>
        <mime-mapping>
            <extension>jar</extension>
            <mime-type>application/java-archive</mime-type>
        </mime-mapping>I've also tried using a servlet mapping so the link will still have a .jnlp extension as follows:
      <servlet>
        <servlet-name>JnlpMapping</servlet-name>
        <jsp-file>/restricted/LaunchClient.jsp</jsp-file>
      </servlet>
      <servlet-mapping>
        <servlet-name>JnlpMapping</servlet-name>
        <url-pattern>/restricted/myProgram.jnlp</url-pattern>
      </servlet-mapping>My link then points to myProgram.jnlp instead of LaunchClient.jsp. But that has the same results (works in firefox/opera but not in IE). Does anyone see why IE is complaining? Do I have to break down and write a servlet?
    --Also: I'm using Sun Application Server PE 9
    Message was edited by:
    QSilver002

    I had the same problem. The resolution is preety simple. You can't set header Cache-Control to no-cache, becouse IE tries to cache it before running. That's why any java error occurs, just can't find the file error. What supprised me is that you can't even save the file with right click "Save the target as..", which seems to be little strange. Any other page of type type/html with this header make no problem with that.
    Conclusion:
    IE makes some special trick with a file of type application/x-java-jnlp-file. Cache-Control to no-cache couses not only disability of running the ws directly, but also saving it locally, which doesn't happen with text/html type of page.
    Sevage

  • Dynamic jnlp - automatic launch

    I realize there are some posts on this topic, but nothing recent and nothing particularly concrete. Any insight is much appreciated.
    I am dynamically building a jnlp so that I can pass dynamic arguments into my webstart app. I am getting the file download dialog that asks me to either open or save my jnlp file. I am running Tomcat 6. I am using https. I have played with various settings based suggesstions in these forums. My response object looks like this:
    resp.setHeader("Content-disposition", "attachment; filename=supply.jnlp"  );
                resp.setHeader("Cache-Control", null);
                resp.setCharacterEncoding(null);
                resp.setHeader("Set-Cookie", null);
                resp.setHeader("Vary", null);
                resp.setDateHeader("Last-Modified", new Date().getTime()); my web.xml looks like this:
    <servlet>
         <servlet-name>SupplyJNLPServlet</servlet-name>
         <servlet-class>mil.atc.supply.servlet.SupplyJnlpBuilderServlet</servlet-class>
    </servlet>
    <servlet-mapping>
         <servlet-name>SupplyJNLPServlet</servlet-name>
         <url-pattern>/SupplyJNLP</url-pattern>
    </servlet-mapping>
    <servlet>
         <servlet-name>JnlpDownloadServlet</servlet-name>
         <display-name>JnlpDownloadServlet</display-name>
         <servlet-class>jnlp.sample.servlet.JnlpDownloadServlet</servlet-class>
    </servlet>
    <servlet-mapping>
         <servlet-name>JnlpDownloadServlet</servlet-name>
         <url-pattern>*.jnlp</url-pattern>
    </servlet-mapping>
    <mime-mapping>
         <extension>jnlp</extension>
         <mime-type>application/x-java-jnlp-file</mime-type>
    </mime-mapping>
    The jnlp mime type is configured on my IIS server - I am using the Apache ASAPI filters.
    Once again, thanks for any help.

    dcfrank65, or anyone else... did you ever discover a solution to this problem?
    I too have an issue whereby opening a dynamically generated jnlp file over HTTP works fine, but opening it over HTTPS causes IE to prompt whether the file should be opened or saved. As you already discovered, there do seem to be quite a few threads covering this topic, but none with a definitive answer. In my case, the JNLP file is being rendered by ASP.NET code running on IIS.
    For the record, at the risk of becoming immediately unpopular (!), AndrewThompson64's comment about how dcrank65 failed to ask a question seems unnecessarily obtuse, since dcfrank65 did previous say:
    "I don't want to be prompted to open or save, I want my jnlp file to be executed and the webstart application to run with no further action from my user. +So I am asking for ideas to accomplish this+."
    This is a fairly clear and concise request for information, regardless of whether it was phrased as a question. So, dcfrank's response, though a little strong, seems justified.

  • Dynamic jnlp generation

    I have an application in which I dynamically generate my JNLP files. Since they are dynamically created, I leave out the "jnlp href" attribute. I do not have "offline-allowed" set.
    My issue is that when I drop in new jar files, and I dynamically generate my JNLP file, it will not download the new jar files on the first launch if the application has previously been cached. It will download them on the second launch.
    I know that I can set the update check="always" and that this will solve the issue. However, I would prefer to not see the "downloading application" screen everytime the application is launched.
    I am using jre1.6, update 11. My question is, why won't it download them the first launch? Are there any solutions besides setting update check="always" ?
    thanks, dooz

    I wanted it to download on startup without a prompt, so I really didn't want to use the background download.
    However, I think I found the solution.
    When I place my new jar files in, I can get them to download the first time ONLY if I touch my servlet class that dynamically generates the JNLP, to force the servlet to redeploy. If I don't touch the servlet class, the jar files will not be downloaded until the second launch. I am not sure if this is a limitation of my webserver (tomcat) or an actual problem with webstart.

  • ADF dynamic region - Browser is blank

    Hi All,
    I am following a hands-on practice in Oracle JDeveloper 11g Handbook. I have created two bounded task flows named "searchEmployee-flow.xml" and "departmentTee-flow.xml". I want to call these task flows from af:commandLink in a dynamic region. In the Choose Managed Bean for Dynamic Scope dialog I have provided following steps:
    1. Click New (green “+”) to add a managed bean. Set Bean Name as “searchScreenBB,” Class Name as “SearchScreenBean,” and Package as “tuhra.view.backing.” Click OK. Click OK.
    2. I wrote UIManager class to switch page fragments:
    package tuhra.view;
    public class UIManager implements Serializable
    public enum Screen {EMPLOYEE_SEARCH, DEPARTMENT_TREE}
    private Screen searchScreenFocus = Screen.EMPLOYEESEARCH;
    public void setSearchScreenFocus(String focus) {
    this._searchScreenFocus = Screen.valueOf(focus);
    public void setSearchScreenFocus(UIManager.Screen focus){
    this._searchScreenFocus = focus;
    public UIManager.Screen getSearchScreenFocus() {
    return _searchScreenFocus;
    3.
    I opened adfc-config (under Page Flows in the Application Navigator). On the Overview tab, selected Managed Beans and added a bean (using the green “+”) and fill in Name as “uiState,” Class as “tuhra.view.UIManager,” and Scope as “session.”
    4.
    Updated SearchScreenBean.java to read as in the following code listing (without the line numbers).
    package tuhra.view.backing;
    import java.util.HashMap;
    import oracle.adf.controller.TaskFlowId;
    import tuhra.view.UIManager;
    public class SearchScreenBean {
    private static final HashMap<UIManager.Screen,String> REGIONMAP;
    static {
    REGIONMAP = new HashMap<UIManager.Screen,String>(2);
    REGIONMAP.put(UIManager.Screen.EMPLOYEE_SEARCH,
    "/WEB-INF/searchEmployees-flow.xml#searchEmployees-flow");
    REGIONMAP.put(UIManager.Screen.DEPARTMENT_TREE,
    "/WEB-INF/departmentTree-flow.xml#departmentTree-flow");
    private UIManager _uiManager;
    public TaskFlowId getDynamicTaskFlowId(){
    return TaskFlowId.parse(
    REGIONMAP.get(_uiManager.getSearchScreenFocus()));
    public void setUiManager(UIManager _uiManager){
    this._uiManager = _uiManager;
    6.
    To have JSF inject the UI manager value, I switched back to the adfc-config.xml editor and locate the Managed Beans area on the Overview tab and performed folliwing steps as told in book:
    6.1. Select the searchScreenBB bean and then click Add (green “+”) in the Managed Properties: searchScreenBB table. Set the managed property Name to “uiManager” (to match the setUiManager() method in the bean), the Class to tuhra.view.UIManager, and the Value to “#{uiState}.”
    6.2. Now that the logic to switch the screens is in place, you can define how the UI will activate the change in searchScreenFocus values. You could of course use a custom method in SearchScreenBean, but using a af:setPropertyListener is simpler. In the employeeSearch.jspx file, locate the af:commandLink that surrounds the “Search for Employees” image.
    6.3. Drop into the af:commandLink a Set Property Listener (Operations panel). Set From as “#{'EMPLOYEE_SEARCH'},” To as “#{uiState.searchScreenFocus},” and Type as “action.” Click OK.
    6.4. Repeat the preceding step for the “View by Department” link. This time, fill in From as “#{'DEPARTMENT_TREE'}.”
    6.5. Click Save All.
    When I run the form as directed, It is blank and is giving following error messages:
    [Application tuhra2 deployed to Server Instance IntegratedWebLogicServer]
    Target URL -- http://127.0.0.1:7101/tuhra2/faces/employeeSearch.jspx
    Caused by: oracle.adf.controller.ControllerException: ADFC-02001: The ADF Controller cannot find '/WEB-INF/searchEmployees-flow.xml'.
         at oracle.adfinternal.controller.metadata.provider.MdsMetadataResourceProvider.getMetadataObjects(MdsMetadataResourceProvider.java:473)
         at oracle.adfinternal.controller.metadata.provider.MdsMetadataResourceProvider.loadUnmutalbeMetadataResources(MdsMetadataResourceProvider.java:372)
         at oracle.adfinternal.controller.metadata.provider.MdsMetadataResourceProvider.getResources(MdsMetadataResourceProvider.java:183)
         at oracle.adf.controller.internal.metadata.MetadataService.getTaskFlowDefinition(MetadataService.java:239)
         at oracle.adfinternal.controller.activity.TaskFlowCallActivityLogic.findTaskFlowDefinition(TaskFlowCallActivityLogic.java:1072)
         at oracle.adfinternal.controller.activity.TaskFlowCallActivityLogic.invokeTaskFlow(TaskFlowCallActivityLogic.java:224)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.invokeTaskFlow(ControlFlowEngine.java:217)
         ... 82 more
    Caused by: oracle.mds.core.MetadataNotFoundException: MDS-00013: no metadata found for metadata object "/WEB-INF/searchEmployees-flow.xml"
         at oracle.mds.core.MetadataObject.getBaseMO(MetadataObject.java:1279)
         at oracle.mds.core.MDSSession.getBaseMO(MDSSession.java:3040)
         at oracle.mds.core.MDSSession.getMetadataObject(MDSSession.java:1211)
         at oracle.mds.core.MOResolver.getMetadataObjects(MOResolver.java:213)
         at oracle.adfinternal.controller.metadata.provider.MdsMetadataResourceProvider.getMetadataObjects(MdsMetadataResourceProvider.java:421)
         ... 88 more
    <Jul 7, 2011 11:21:14 AM PKT> <Error> <HTTP> <BEA-101020> <[ServletContext@18426608[app:tuhra2 module:tuhra2 path:/tuhra2 spec-version:2.5]] Servlet failed with Exception
    oracle.adf.controller.ControllerException: ADFC-06002: unhandled exception
         at oracle.adfinternal.controller.util.Utils.createAndLogControllerException(Utils.java:208)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.handleException(ControlFlowEngine.java:640)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.invokeTaskFlow(ControlFlowEngine.java:235)
         at oracle.adfinternal.controller.state.ChildViewPortContextImpl.invokeTaskFlow(ChildViewPortContextImpl.java:104)
         at oracle.adfinternal.controller.state.ControllerState.createChildViewPort(ControllerState.java:1380)
         Truncated. see log file for complete stacktrace
    Caused By: oracle.adf.controller.ControllerException: ADFC-02001: The ADF Controller cannot find '/WEB-INF/searchEmployees-flow.xml'.
         at oracle.adfinternal.controller.metadata.provider.MdsMetadataResourceProvider.getMetadataObjects(MdsMetadataResourceProvider.java:473)
         at oracle.adfinternal.controller.metadata.provider.MdsMetadataResourceProvider.loadUnmutalbeMetadataResources(MdsMetadataResourceProvider.java:372)
         at oracle.adfinternal.controller.metadata.provider.MdsMetadataResourceProvider.getResources(MdsMetadataResourceProvider.java:183)
         at oracle.adf.controller.internal.metadata.MetadataService.getTaskFlowDefinition(MetadataService.java:239)
         at oracle.adfinternal.controller.activity.TaskFlowCallActivityLogic.findTaskFlowDefinition(TaskFlowCallActivityLogic.java:1072)
         Truncated. see log file for complete stacktrace
    Caused By: oracle.mds.core.MetadataNotFoundException: MDS-00013: no metadata found for metadata object "/WEB-INF/searchEmployees-flow.xml"
         at oracle.mds.core.MetadataObject.getBaseMO(MetadataObject.java:1279)
         at oracle.mds.core.MDSSession.getBaseMO(MDSSession.java:3040)
         at oracle.mds.core.MDSSession.getMetadataObject(MDSSession.java:1211)
         at oracle.mds.core.MOResolver.getMetadataObjects(MOResolver.java:213)
         at oracle.adfinternal.controller.metadata.provider.MdsMetadataResourceProvider.getMetadataObjects(MdsMetadataResourceProvider.java:421)
         Truncated. see log file for complete stacktrace
    >
    <Jul 7, 2011 11:21:14 AM PKT> <Notice> <Diagnostics> <BEA-320068> <Watch 'UncheckedException' with severity 'Notice' on server 'DefaultServer' has triggered at Jul 7, 2011 11:21:14 AM PKT. Notification details:
    WatchRuleType: Log
    WatchRule: (SEVERITY = 'Error') AND ((MSGID = 'WL-101020') OR (MSGID = 'WL-101017') OR (MSGID = 'WL-000802') OR (MSGID = 'BEA-101020') OR (MSGID = 'BEA-101017') OR (MSGID = 'BEA-000802'))
    WatchData: DATE = Jul 7, 2011 11:21:14 AM PKT SERVER = DefaultServer MESSAGE = [ServletContext@18426608[app:tuhra2 module:tuhra2 path:/tuhra2 spec-version:2.5]] Servlet failed with Exception
    oracle.adf.controller.ControllerException: ADFC-06002: unhandled exception
         at oracle.adfinternal.controller.util.Utils.createAndLogControllerException(Utils.java:208)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.handleException(ControlFlowEngine.java:640)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.invokeTaskFlow(ControlFlowEngine.java:235)
         at oracle.adfinternal.controller.state.ChildViewPortContextImpl.invokeTaskFlow(ChildViewPortContextImpl.java:104)
         at oracle.adf.view.rich.component.fragment.UIXRegion$RegionContextChange.doChangeImpl(UIXRegion.java:1199)
         at jsp_servlet.__employeesearch_jspx._jspService(__employeesearch_jspx.java:65)
         at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:416)
         at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:253)
         at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:410)
         at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:469)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
         at java.security.AccessController.doPrivileged(Native Method)
    Caused By: oracle.adf.controller.ControllerException: ADFC-02001: The ADF Controller cannot find '/WEB-INF/searchEmployees-flow.xml'.
         at oracle.adfinternal.controller.metadata.provider.MdsMetadataResourceProvider.getMetadataObjects(MdsMetadataResourceProvider.java:473)
         at oracle.adfinternal.controller.metadata.provider.MdsMetadataResourceProvider.loadUnmutalbeMetadataResources(MdsMetadataResourceProvider.java:372)
         at oracle.adfinternal.controller.metadata.provider.MdsMetadataResourceProvider.getResources(MdsMetadataResourceProvider.java:183)
         at oracle.adf.controller.internal.metadata.MetadataService.getTaskFlowDefinition(MetadataService.java:239)
         at oracle.adfinternal.controller.activity.TaskFlowCallActivityLogic.findTaskFlowDefinition(TaskFlowCallActivityLogic.java:1072)
         at oracle.adfinternal.controller.activity.TaskFlowCallActivityLogic.invokeTaskFlow(TaskFlowCallActivityLogic.java:224)
         at oracle.adfinternal.controller.engine.ControlFlowEngine.invokeTaskFlow(ControlFlowEngine.java:217)
         at oracle.adfinternal.controller.state.ChildViewPortContextImpl.invokeTaskFlow(ChildViewPortContextImpl.java:104)
         at oracle.adfinternal.controller.state.ControllerState.createChildViewPort(ControllerState.java:1380)
         at oracle.adfinternal.controller.ControllerContextImpl.createChildViewPort(ControllerContextImpl.java:78)
         at oracle.adf.controller.internal.binding.DCTaskFlowBinding.createRegionViewPortContext(DCTaskFlowBinding.java:440)
         at oracle.adf.controller.internal.binding.DCTaskFlowBinding.getViewPort(DCTaskFlowBinding.java:358)
         at oracle.adf.controller.internal.binding.TaskFlowRegionModel.doProcessBeginRegion(TaskFlowRegionModel.java:164)
         at oracle.adf.controller.internal.binding.TaskFlowRegionModel.processBeginRegion(TaskFlowRegionModel.java:112)
         at oracle.adf.view.rich.component.fragment.UIXRegion$RegionContextChange.doChangeImpl(UIXRegion.java:1199)
         at oracle.adf.view.rich.context.DoableContextChange.doChange(DoableContextChange.java:91)
         at oracle.adf.view.rich.component.fragment.UIXRegion._beginInterruptibleRegion(UIXRegion.java:693)
         at oracle.adf.view.rich.component.fragment.UIXRegion.processRegion(UIXRegion.java:498)
         at oracle.adfinternal.view.faces.taglib.region.RegionTag.doStartTag(RegionTag.java:127)
         at jsp_servlet.__employeesearch_jspx._jspx___tag21(__employeesearch_jspx.java:1036)
         at jsp_servlet.__employeesearch_jspx._jspService(__employeesearch_jspx.java:65)
         at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:416)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:326)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183)
    SUBSYSTEM = HTTP USERID = <WLS Kernel> SEVERITY = Error THREAD = [ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)' MSGID = BEA-101020 MACHINE = bilal-PC TXID = CONTEXTID = d87127fb8baddada:4155b820:130fd94af8a:-8000-00000000000006c4 TIMESTAMP = 1310019674635
    WatchAlarmType: AutomaticReset
    WatchAlarmResetPeriod: 30000
    >
    <Jul 7, 2011 11:21:20 AM PKT> <Alert> <Diagnostics> <BEA-320016> <Creating diagnostic image in c:\users\administrator\appdata\roaming\jdeveloper\system11.1.1.5.37.60.13\defaultdomain\servers\defaultserver\adr\diag\ofm\defaultdomain\defaultserver\incident\incdir_16 with a lockout minute period of 1.>
    Any help will be highly appreciated.
    Thanks

    Hi
    This error occurs on account of the scope of backing bean Taskflow id not set up correctly and taskflow id leads to null pointer exception.
    Open EmplloyeeSearch.jspx - go to bindings. click taskflow - dynamic region in binding. Set the property as follows:
    #{backingBeanScope.searchScreenBB.dynamicTaskFlowId}
    This should resolve the issue.
    Edited by: Krithivasan N on Mar 6, 2012 11:52 AM

Maybe you are looking for