Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Work-a-round: The session Id is changing on Firefox and Chrome when the servlet is called from the applet, for some reason. I ended up storing the session ID and setting it on the HttpURLConnection connection to the servlet, which forces the servlet to get the correct backing bean.</p> <p>In the productSelection backing bean:</p> <pre><code>private String sessionID = ""; // With getter . . . FacesContext facesContext = FacesContext.getCurrentInstance(); HttpSession session = (HttpSession) facesContext.getExternalContext().getSession(false); sessionID = session.getId(); </code></pre> <p>On the web page containing the applet I am using a javascript function to wait until the applet is fully loaded before telling it to load a criteria file, which will be modified by the user and then sent back to the backing bean for processing. I have simply passed the session ID along with the criteria file to the applet:</p> <pre><code>&lt;SCRIPT language="javascript"&gt; function waitUntilLoaded() { if (document.criteriaApplet.isActive()) { var object = document.getElementById ("criteriaApplet"); criteriaApplet.loadCriteriaFile((object.codeBase + "#{productSelection.productUsage.searchCriteriaObjectUrl}"), "#{productSelection.sessionID}"); } else { settimeout(waitUntilLoaded(),500) } } &lt;/SCRIPT&gt; </code></pre> <p>In the applet button code, to submit the modified criteria file back to the backing bean via the servelet, I added the session ID to the HttpURLConnection connection:</p> <pre><code>HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoInput(true); connection.setDoOutput(true); connection.setUseCaches(false); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/x-java-serialized-object"); connection.setRequestProperty("Cookie","JSESSIONID=" + sessionID); ObjectOutputStream out = new ObjectOutputStream(connection.getOutputStream()); out.writeObject(searchSubmitObject); out.flush(); out.close(); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload