Javascript- Java- DB

Hey all, quick question.
I was looking at using a dynamic tree structure (like the one in http://www.treemenu.com/)
The only problem with this is that I have a massive amount of nodes(many 1000's), so pre-populating the tree would be too time consuming. I was wondering if there was a way to do the following:
- User clicks on a folder to open it
- The folder ID the user clicked on gets sent to a servlet.
- The servlet calls the database, which uses the folderID to get a list of the folders children.
- The database passes the info back to the servlet, which passes it back to the dynamic HTML page.
- The tree opens up with the new info
I know this can be done via applet (I've done this before), but for business reasons, can no longer use an applet. So, I was wondering if doing something like this is possible... Or does each call generate a new page, recreating the existing tree plus the new info.

ok, I made up a quick outline of what I think should be done based on your input.
If anyone knows a better way, feel free to share. If not, then this example will be around for whoever finds this post later on and needs the code.
Master Frame Page
<HTML>
<FRAMESET ROWS="*,0">
  <FRAME SRC="frame1.htm" name="fr1" noresize>
  <FRAME SRC="frame2.htm" name="fr2" noresize>
</FRAMESET>
</HTML>
Frame 1 Tree Menu
<HTML>
<HEAD>
  <script language="JavaScript1.2">
    function callServlet( )
      // when tree is clicked, get nodeID and pass it to getNewNodes() method in "Frame 2 Servlet"
      parent.fr2.getNewNodes( nodeID );
    function updateTree( nodeInfo )
      // Servlet calls this method after the servlet finishes execution
  </script>
</HEAD>
<BODY>
  // This section contains contains the Tree Code
</BODY>
</HTML>
Frame 2 Servlet (Hidden Frame)
<HTML>
<HEAD>
  <script language="JavaScript1.2">
    function callTree( )
      parent.fr1.updateTree( document.newTreeNodes.nodeInfo ); // calls updateTree() method in "Frame 1"
    function getNewNodes( nodeID )
      // submits its form to the servlet, and generates a new
      // page containing the requested tree nodes.
      document.newTreeNodes.nodeID = nodeID;
      document.newTreeNodes.submit();
  </script>
</HEAD>
<BODY onLoad="callTree()">
  <form name="newTreeNodes" action="/myServlet">
   <input name="nodeID" type="hidden" value="">
   <input name="nodeInfo" type="hidden" value="">
   <input name="Submit" type="Submit" value="Submit" onClick="getNewNodes()">
  </form>
</BODY>
</HTML>

Similar Messages

  • FF15 is preventing pages in out of focus tabs from autorefreshing. All Javascript/Java and plugins are prevented from refreshing data when tab is not displayed

    FF15 is preventing pages that contain auto refreshing html commands, Javascripts, Java applettes, and other plugins, from auto reloading or refreshing information on web pages, when the tabs than contain them go out-of-focus.
    While tab has focus (page is fully displayed) all auto refreshing/reload embedded commands/programs work correctly.
    I work with web sites, were information needs to be auto updated constantly, whether the tab is hidden or not, such as stock prices, web server monitoring, biding sites, customer support chat, etc.
    This behavior can cause severe loads in web servers with web pages that contain many data items, when all server side programs that pertain to the data being displayed have to run from scratch at the same time, when the tab is brought back in focus, since the browser issues a full reload.
    This behavior also interferes with "reloading" FireFox addons
    One should be able to stop, and/or disable this behavior, and pretty sure this problem is affecting many users, and or web sites that rely on these commands to work according to html protocols.
    Is not the function of a web browser to interfere in any way with html embedded commands or programs, by stoping functionality, or preventing connection to the internet

    No need to remove Adblock Plus, disabling it should help you discover whether ABP is causing that problem or not.
    I saw a mention of that problem at MozillaZine fora a few days ago, but don't recall the details. But IIRC it has to do with toggling a setting to off.
    Adblock Plus has its own support forum.They should be able to help you get ABP adjusted to avoid that issue. <br />
    http://adblockplus.org/forum/

  • Problem of Java - javascript and javascript - java communicate of same obje

    Hi all,
    I have met a great problem in program an applet! I have tried to communicate between java and javascript and javascript and java in the same page by using jsobject. However, problem occur. It is not a problem to call javascript from java by using jsobject. However, javascript call java by using document.object.function has problem. It cannot find out the object in IE. I have followed the webpage show in java, but the browser still prompt me the object called client not find. Please help!! My html code is shown as follow:
    <HTML>
    <HEAD>
    <TITLE>Alva Final Year Project Demo</TITLE>
    </HEAD>
    <Script language="javaScript">
    function show(html){
    layer.innerHTML = html;
    function getResponse(response){
    alert("response: " + response);
    document.client.getJSCommunicate();
    </Script>
    <BODY>
    <DIV id="layer" style="position:absolute">
    <H2>Secure Server</H2>
    <HR>
    <!--"CONVERTED_APPLET"-->
    <!-- CONVERTER VERSION 1.0 -->
    <OBJECT id="client" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    WIDTH = "800" HEIGHT = "400" codebase="http://java.sun.com/products/plugin/1.1.1/jinstall-111-win32.cab#Version=1,1,1,0">
    <PARAM NAME = CODE VALUE = "ClientPart.class" >
    <PARAM NAME="SCRIPTABLE" VALUE="true">
    <PARAM NAME="MAYSCRIPT" VALUE="true">
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.1">
    <COMMENT>
    <EMBED type="application/x-java-applet;version=1.1" java_CODE = "ClientPart.class" NAME = "client" WIDTH = "800" HEIGHT = "400" pluginspage="http://java.sun.com/products/plugin/1.1.1/plugin-install.html"><NOEMBED></COMMENT>
    </NOEMBED></EMBED>
    </OBJECT>
    <!--
    <APPLET CODE = "ClientPart.class" WIDTH = "800" HEIGHT = "400" NAME = "clientPart" >
    </APPLET>
    -->
    <!--"END_CONVERTED_APPLET"-->
    </DIV>
    </BODY>
    </HTML>
    Thanks your kindly help.
    Alva

    Everthing looks fine to me from here, you should be able to just call the java function direct such as
    document.myAppletObj.doMethod();
    I think your problem could be that your object is called "client". IE can get funny about names, it didn't like me calling a method delete()!!
    Try adding something else to the name such as "my_client", and see if this works any better.
    Chris

  • Security Issues with Javascript, Java Applet interaction

    First the main idea of the project. I have a system where I need to use an applet to process an image and display it on a web page.
    I have written the applet that does the image processing and it saves the finished image on the users disc. It then uses the showDocument(url) method to pass the URL of the local file to a java script function on the html page.
    This is where the problem occurs. Firefox won't display that image and complains about a security error because the remote page is linking to a local file. Interestingly enough IE6 on windows has no issue displaying the generated image.
    I really have two questions.
    1)Is there a quick/dirty fix that just simply gets around the security barrier Firefox has?
    2)Is there some other, more elegant, way of getting an image from an applet to the webpage. It doesn't matter if it requires writing to disc or not.
    Thanks! Any suggestions out there will help me.

    First the main idea of the project. I have a system where I need to use an applet to process an image and display it on a web page.
    I have written the applet that does the image processing and it saves the finished image on the users disc. It then uses the showDocument(url) method to pass the URL of the local file to a java script function on the html page.
    This is where the problem occurs. Firefox won't display that image and complains about a security error because the remote page is linking to a local file. Interestingly enough IE6 on windows has no issue displaying the generated image.
    I really have two questions.
    1)Is there a quick/dirty fix that just simply gets around the security barrier Firefox has?
    2)Is there some other, more elegant, way of getting an image from an applet to the webpage. It doesn't matter if it requires writing to disc or not.
    Thanks! Any suggestions out there will help me.

  • Assigning javascript variables to java variables in JSP

    Does anyone know if it possible to assign a javascript value to a java variable in a javascript function? I want to be able to use the javascript value in a PreparedStatement call, but I can't assign the value of the javascript variable to a java variable. I know the opposite can be done using hidden variables in the form, but I need:
    javascript -> java variable in a JSP scriptlet.
    Any help would be much appreciated,
    Thanks,
    -Dave

    Can't do that.
    html/javascript is in the client side.
    jsp is in the server side.
    In order to put html/javascript values (client side) into jsp (server side) it must be submitted.
    Try remoting. Using an iframe with a jsp as the source of it and the html target pointing at it.
    -------------

  • Detecting Java Version using Javascript??

    Hi,
    This is a Javascript & Java question really. The problem i have is i want to detect what version of Java a user has.
    So using Javascript i can find if java is enabled like so:
    navigator.javaEnabled();
    but i want to know what version as well.
    I tried:
    var version = java.lang.System.getProperty("java.version");
    but had not luck. does anyone know if this is possible and if so how?
    thanks,
    Chris.

    Because Sun chooses to use a weird format for their version numbers, and since Internet Explorer uses ActiveX objects instead of normal plug-ins, you'd have to write a script that could skim through the Windows registry to dig up what the latest version of the Java Plug-in is.
    Scanning through the registry isn't a problem, so much as the non-conventional versioning system that Sun has in place. With Netscape, Opera, and other non-ActiveX browsers, it's a piece of cake.

  • Dynamically adding JRE for IE, Java Security Warnings, & Next Gen Plugin.

    I wrote an portal application to control the environment for a third party application, the portal uses a JRE version that I supply with it, this was to ensure that users are using the same JRE so any issues can be limited to one version of Java. The only piece of the application that I could not specify the JRE version and path was for Internet Explorer. Please keep in mind that I do not control when the system JRE is updated or not, this is pushed to our systems and the latest JRE would be enabled automatically. I wanted to be able to dynamically add and enable the version of the JRE that Microsoft Internet Explorer uses for applets. So I was digging around recently and if I have the next-generation plugin enabled I could programmatically update the deployment.properties file prior to launching Internet Explorer(assuming I have closed all prior instances of IE that were running) to add and enable a version of the JRE which I choose to use. When I launch IE and run an applet I see that it is using the JRE I had dynamically supplied. However everytime I run the applet a Java security warning comes up saying "The application requires an earlier version of Java", I wanted to suppress this message but after research I tried adding 'deployment.security.mixcode=HIDE_RUN' to the deployment.properties, that did not work. I tried disabling the Next Generation Plugin, that worked to suppress the message however internet explorer was no longer using my dynamically supplied JRE for applets in IE, so that was not going to work for my purposes. My questions are:
    1. Is there a reliable way(not using ssvagent) to programmatically enable and disable Java's Next Generation Plugin option? (I want to make sure it is enabled when launching third party application from the portal)
    2. Is there a programmatic way to suppress the Java Security Warning "The application requires an earlier version of Java", without disabling Java's Next Generation Plugin option?
    deployment.properties entries after addition of my jre entry:
    #deployment.properties
    #Fri Sep 28 14:09:24 PDT 2012
    deployment.javapi.lifecycle.exception=true
    deployment.trace=true
    deployment.javaws.viewer.bounds=323,144,720,360
    deployment.javaws.autodownload=NEVER
    deployment.version=6.0
    deployment.browser.path=C\:\\Program Files (x86)\\Internet Explorer\\iexplore.exe
    deployment.security.mixcode=HIDE_RUN
    deployment.log=true
    deployment.console.startup.mode=SHOW
    deployment.capture.mime.types=true
    #Java Deployment jre's
    #Fri Sep 28 14:09:24 PDT 2012
    deployment.javaws.jre.0.registered=true
    deployment.javaws.jre.0.platform=1.6
    deployment.javaws.jre.0.osname=Windows
    deployment.javaws.jre.0.path=C\:\\Program Files (x86)\\Java\\jre6\\bin\\javaw.exe
    deployment.javaws.jre.0.product=1.6.0_33
    deployment.javaws.jre.0.osarch=x86
    deployment.javaws.jre.0.location=http\://java.sun.com/products/autodl/j2se
    deployment.javaws.jre.0.enabled=false
    deployment.javaws.jre.0.args=
    deployment.javaws.jre.1.enabled=true
    deployment.javaws.jre.1.registered=true
    deployment.javaws.jre.1.osname=Windows
    deployment.javaws.jre.1.location=http\\\://java.sun.com/products/autodl/j2se
    deployment.javaws.jre.1.osarch=x86
    deployment.javaws.jre.1.path=C\:\\Portal\\dist\\java\\jre6\\bin\\javaw.exe
    deployment.javaws.jre.1.platform=1.6
    deployment.javaws.jre.1.product=1.6.0_29
    Note: The reason not to use most recent version of Java is the necessity to test the third party application prior to deployment of a new Java version and since I do not control when a new version of Java is deployed and enabled to our machines, I am required to find an transparent solution. I understand the security issues by doing so, but the time between testing and acceptance of a new Java version for our application is within an acceptable timeframe. On exiting the application, I would restore the JRE settings and restore previous settings, to minimize the exposure of a potential security risk. Also any manual configurations are trying to be avoided as to maintain transparency to the user.

    I'm having a similar problem and I think it is related with this.
    If, after a Java--->Javascript call, a Javascript--->Java call isn't made soon after the first, it works. But, if the Java--->Javascript call triggers a Javascript--->Java call, any Java--->Javascript call that is made after that doesn't reach Javascript :/
    I have a method that handles the Java--->Javascript calls and goes something like this:
    System.out.println("Calling Javascript...");
    JSObject win = JSObject.getWindow(this);
    win.call(jsEventHandler, new Object[] { json.toString() });
    System.out.println("Done.");I further found out that, after looking at the Java debug console in the scenario where a Java--->Javascript call triggers a Javascript--->Java call, only after this last method returns is the "Done" message printed, even though the respective Javascript call was already invoked.
    Could you explain in more detail the queue based solution you found? Any other ideas?
    Regards,
    Andr&eacute; Tavares.

  • How to create a class using java script..

    Hi all,
    Iam new to java script and I tried out the following program but its not working..I basically created a class just like a java prog' but Iam not getting any output or error.Iam attaching the code below.
    If I created one function inside the script and create one object its working fine but what should I do when I have a lot of function??so I created a class and put all the function and created an object but its not working..
    Do let me know what changes should I do..Iam attaching the code which I had written. or give me an example of how to create a class with couple of functions using JAVASCRIPT
    Thanks
    Avis_su
    <html>
    <head><title>JSP Page</title></head>
    <body>
    <SCRIPT language = "JavaScript">
    <!--
    //Created classes
    class book
    var title: String;
    var author:String;
    function author()
    doucument.write("Author is " +this.author);
    function tile()
    doucument.write("Title is " +this.title);
    function printall()
    var counter = 0;
    function author();
    function title();
    var chapters = Array[String];
    for(chapter in this chapters)
    counter++;
    document.write("Chapter" counter" :"+this.chapters[chapter]+"<br>");
    var thisbook = new book()
    thisbook.author = "Sivagami";
    thisbook.title = "MS in CS giude";
    thisbook.chapters = new Array[10];
    thisbook[0] = "Prepare to Excell in all ";
    thisbook[1] = "Learn to be happy";
    thisbook[2] = "Learn to be healthy mentally emotionally physically";
    thisbook[3] = "Siva and Subbu along with kidssssss will be successful in future";
    thisbook.printall();
    //-->
    </script>
    </body>
    </html>

    Run this program to get your answer:
    public class AnswerToYourPost {
    public static void main(String args[]) {
    System.out.println("TRUE/FALSE: This question
    ion belongs on a Java forum.\n"
    + "ANSWER: " + ("Javascript" == "Java"));
    }Since when do we compare objects for equality using operator == ?

  • Need java script 6.26 to use banking software keep getting "the connection was reset" error Java appears on addon blocked list

    I am trying to use Team One Credit Unions CU@home to access my accounts. Their support team tells me I need Java script 6.26. I show that on my add on list but it also states Java is blocked on the blocked software list. How do I get Java script running so I can do my home banking or at least test it to be sure that is the issue. I have tried running this program with Java enabled and disabled with the same results.

    To avoid confusion: http://kb.mozillazine.org/JavaScript_is_not_Java
    See:
    * http://kb.mozillazine.org/Java
    * http://kb.mozillazine.org/JavaScript
    Java 6 U26 is about the Java plugin.
    You can see in "Tools > Add-ons > Plugins" if the Java plugin is installed and also on the about:plugins page via the location bar.
    * http://www.java.com/en/download/help/testvm.xml - How do I test whether Java is working on my computer? - 1.4.2_xx, 1.5.0, 6.0

  • Pages not loading, suddenly today, status bar at bottom of page has red "J" for Java and I cannot figure out why or what to do

    After using Firefox successfully for months, it started not loading full pages today, but showing "done" in the status bar at the bottom. I also noticed icons for Javascript, Java, Silverlight, etc., on the right side of status bar, JAVA one is red, but I don't know what that means.

    See View > [X] Status Bar

  • Java 7 u45 Web Start application won't launch

    I maintain an Eclipse RCP application launched with WebStart. Java 7 u45 made some security changes, and now my application crashes on startup.
    I've added to the manifest:
    Permissions: all-permissions
    Codebase: *
    Trusted-Library: true
    This removed all of the warning messages from the Control Panel. But I still have a classloader issue when trying to load the first necessary class from my jar.  This is new to update 45. To add to the complication, my application uses Eclipse RCP, so the classloading is through OSGi.

    This likely won't answer your question, but this update has messed up quite a bit with the way applet security is handled.
    There are a laundry list of "known issues" in the release notes and they don't make sense.
    For example, I use JavaScript to communicate to my applet and I have several trusted signed jars on it's class path. To permit JavaScript calls, a new parameter "Caller-Allowable-Codebase: http://*.mysite.etc" must be provided.  To permit my applet to communicate with other jars I had previously used "Trusted-Library: true", but that setting now displays a false warning.  Here's the KNOWN ISSUE from Oracle:
    KNOWN ISSUE
    Area: Deployment/Plugin
    Synopsis: Caller-Allowable-Codebase may be ignored when used with Trusted-Library.
    If a trusted, signed JAR file is using the Caller-Allowable-Codebase manifest attribute along with Trusted-Library then the Caller-Allowable-Codebase manifest entry will be ignored and, as a result, a JavaScript -> Java call will show the native LiveConnect warning. The workaround is to remove the Trusted-Library manifest entry.
    Next, I generally test my applet by running a sample.html from my desktop.  With Java 7 u45, this fails with an InvocationTargetException.
    java.lang.RuntimeException: java.lang.reflect.InvocationTargetException ...
    Caused by: java.lang.NullPointerException
      at sun.plugin2.applet.Plugin2ClassLoader.loadAllowedCodebases(Unknown Source)
    Is this a KNOWN ISSUE too?  Hard to tell.. here's the snippet from the release notes...
    KNOWN ISSUE
    Area: Deployment/Plugin
    Synopsis: Applet could fail to load by throwing NPE if pack compression is used with deployment caching disabled.
    If a JAR file is using pack compression with manifest entries Permissions and Caller-Allowable-Codebase while deployment caching is disabled, then:
    The Permissions manifest entry will be ignored. (This can be seen from the fact that yellow warning is there on security dialog even though the Permissions attribute is there.) This only happens if Caller-Allowable-Codebase attribute is present along with the Permissionsattribute.
    The Caller-Allowable-Codebase attribute will cause the applet to fail to load by throwing ajava.lang.NullPointerException.
    I don't use deployment caching because it started causing problems with Java 7 u21.  Adding the cache_jar parameter back in doesn't fix this.  But the irony is this exception is only raised with the Trusted Godaddy Certificate and only when being launched from file:/// url.  The Self-Signed version actually works (although some dialogs appear, but no NPE).  This doesn't make any sense. Furthermore, when the trusted-signed version is launched from http:// it works fine.   Should I turn off compression (and why would anyone do this?)
    But what's worse than all of this listed above is when I finally choose the right combination of settings that permits the applet to load, it completely fails on older versions such as Java 7 u40 and Java 7 u21.  My applet is compiled using JDK 5 for backwards compatibility with Mac PPC Java 1.5 and Mac Intel Java 1.6 (the sun one has compatibility issues on Mac only), but now does every client need to update to Java 7 u45?  What about the scenarios where the upgrade isn't possible due to compatibility or availability?  I wish I could answer this.
    I'm struggling with this and so is my open source project.  Any expert insight advice is appreciated.  I'd happily compensate someone for assistance.
    -Tres Finocchiaro

  • ADF - MyFaces, HttpUnit testing problem with Javascript.

    Dear all
    Does anybody know how to test ADF Faces. Any tool would be of interest to me although Opensource and Free Software is prefered?
    My task is to write a set of unit tests to test an Oracle ADF and Apache MyFaces application. I have attempted to use both Cactus and HttpUnit. However I am struggling with a simple test case which should simulate a login.
    The problem I have is that ADF Faces produces the following dynamic javascript file (I am guessing it is dynamic because I can not find this in either adf-faces-impl-10_1_3_0_4.jar or adf-faces-api-10_1_3_0_4.jar which are the two jars am implementing in my project.):
    Common10_1_3_0_4.js
    Which when parsed by js.jar (Rhino javascript engine) I get the following error:
    com.meterware.httpunit.ScriptException: Event 'submitForm('maincontent:loginForm',1, {source:'maincontent:submit'});return false;' failed: org.mozilla.javascript.EcmaError: TypeError: Cannot call method "split" of undefined at
    com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.handleScriptException (JavaScript.java:202)
    (This file Common10_1_3_0_4.js is over 5000 lines long and so I do not want to post it as this posting is already quite long).
    Downloading the file directly after it has been built and modifying it and fixing the error by ensuring the split function is called on a strongly typed String variable, then commenting out from the web.xml below I tried the HttpUnit test again.
         <servlet>
              <servlet-name>resources</servlet-name>
              <servlet-class>oracle.adf.view.faces.webapp.ResourceServlet</servlet-class>
         </servlet>
         <!-- servlet-mapping>
              <servlet-name>resources</servlet-name>
              <url-pattern>/adf/*</url-pattern>
         </servlet-mapping -->
    This time I get no error, but the original login page simply gets served again.
    login.jsp (which is called as login.jsf)
    <%@ page contentType="text/html; charset=UTF-8" %>
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
    <%@ taglib uri="http://xmlns.oracle.com/adf/faces/html" prefix="afh"%>
    <%@ taglib uri="http://xmlns.oracle.com/adf/faces" prefix="af"%>
    <!-- Content -->
    <af:objectSeparator />
    <af:panelBox text="#{msg['login.info.loginHeader']}" width="100%" background="transparent">
         <af:form id="loginForm">
                   <af:objectSpacer height="10px" />
                   <af:panelGroup layout="vertical">
                        <af:panelForm labelWidth="5%">
                             <!--User Name-->
                             <af:panelLabelAndMessage for="username">
                                  <af:inputText label="User Name:"
                                       id="username"
                             columns="25"
                             required="yes"
                             secret="false"
                             value="#{userBean.userName}"
                             shortDesc="#{msg['global.user.userName']}" />
                             </af:panelLabelAndMessage>
                             <af:panelLabelAndMessage for="password">
                                  <af:inputText label="Password:"
                                       id="password"
                             columns="25"
                             required="yes"
                             secret="true"
                             value="#{userBean.password}"
                             shortDesc="#{msg['global.user.password']}" />
                             </af:panelLabelAndMessage>
                   <af:objectSpacer height="10px" />
                        <!--Login Button-->
                        <af:commandButton id="submit"
                                  textAndAccessKey="#{msg['global.button.login']}"
                                  action="#{userBean.login}" />
                        </af:panelForm>
                   </af:panelGroup>
         </af:form>
    </af:panelBox>
    TestCase LoginTest.java:
    package com.siemens.pse.wmstesting;
    import java.io.IOException;
    import junit.framework.TestCase;
    import junit.framework.TestSuite;
    import com.meterware.httpunit.GetMethodWebRequest;
    import com.meterware.httpunit.WebConversation;
    import com.meterware.httpunit.WebForm;
    import com.meterware.httpunit.WebLink;
    import com.meterware.httpunit.WebRequest;
    import com.meterware.httpunit.WebResponse;
    public class LoginTest extends TestCase {
         * The URL of the Login page for all login tests
         public static final String URL = new String( "http://localhost/WMS/pages/login.jsf" );
    public static void main( String args[] ) {
    junit.textui.TestRunner.run( suite() );
    public static TestSuite suite() {
    return new TestSuite( LoginTest.class );
    public LoginTest( String s ) {
    super( s );
    public void testGetLogin() throws Exception {
         response = new WebConversation( ).getResponse( request );
    // Test the result
    assertContains( response, "Login Management" );
    public void testLoginSuccess() throws Exception {
         response = new WebConversation( ).getResponse( request );
    WebForm form = response.getFormWithID( "maincontent:loginForm" );
    assertNotNull( "No form found with ID 'maincontent:loginForm'", form );
    form.setParameter( "maincontent:username", "admin" );
    form.setParameter( "maincontent:password", "pass" );
    WebLink submit = response.getLinkWithID("maincontent:submit");
    response = submit.click();
    System.out.println( response.getText());
    // Test the result
    assertContains( response, "Welcome to the Temperature Measurement System" );
    * Convenience function that asserts that a substring can be found in
    * the returned HTTP response body.
    * @param theResponse the response from the server side.
    * @param s the substring to look for
    public void assertContains( WebResponse response, String s ) {
         String target = new String("");
         try {
                   target = response.getText(); }
         catch (IOException e) {
              e.printStackTrace(); }
         if ( target.indexOf( s ) < 0 ) {
              // Error showing which string was NOT found
              fail( "Response did not contain the substring: [" + s + "]" );
    private WebRequest request = new GetMethodWebRequest( LoginTest.URL );
    private WebResponse response;
    }

    Dear All
    Well I found the solution to my testing requirements. HtmlUnit is able to deal with the dynamic Javascript that is generated by the ADF Faces application. The strange part is that HtmlUnit uses the Rhino Javascript engine just as HttpUnit and Cactus, however these two could not deal with the javascript whereas HtmlUnit could.
    I include a snippet of a test case that I wrote that now works.
    public void testLoginSuccess() throws Exception {
    final WebClient webClient = new WebClient( BrowserVersion.INTERNET_EXPLORER_6_0 );
    final URL url = new URL("http://localhost/WMS/pages/login.jsf");
    final HtmlPage page = (HtmlPage)webClient.getPage(url);
    // Get the form that we are dealing with and within that form,
    // find the submit button and the field that we want to change.
    final HtmlForm form = page.getFormByName("maincontent:loginForm");
    final HtmlTextInput usernameField = (HtmlTextInput) form.getInputByName("maincontent:username");
    final HtmlPasswordInput passwordField = (HtmlPasswordInput) form.getInputByName("maincontent assword");
    final ClickableElement button = (ClickableElement) form.getHtmlElementById("maincontent:submit");
    // Change the value of the text field
    usernameField.setValueAttribute("admin");
    passwordField.setValueAttribute("pass");
    // Get the submitted form
    final HtmlPage welcomePage = (HtmlPage) button.click();
    assertEquals( "Temperature Measurement System", welcomePage.getTitleText() );
    }

  • What're the differences between JSP, Java Script, and Java Applet?

    I am confused by the concepts: JSP (Java Server Page), Java Script, and Java Applet? What are their main differences?

    I don't know about differences, but one of their main similarities is that each of them has a page in Wikipedia.
    JSP
    JavaScript
    [Java applet|http://en.wikipedia.org/wiki/Java_applet]
    There. That should give you enough information.

  • How to convert pl/sql code into java/j2ee

    Hi,
    We have a PL/SQL Oracle App server application that we will support if we can convert in j2ee/java. But when i did take a look at the code, these pl/sql contains all HTML and java code inside the stored procedures.
    And iam looking to explore some tools and mechanisms that can convert these pl/sql in a JAVA application so that i can deploy this new app into my BEA81 environment.
    Does any body has any idea:
    a) How to convert from pl/sql > java ?
    b) Any plugins or tools of BEA that can run these pl/sql (the way thay are currently...i.e w/o converting) in BEA 81 container ?
    thanks, sangita

    these pl/sql contains all HTML and java code insideJava or JavaScript. They are not the same. I wouldn't expect to see Java inside html, whereas JavaScript would be intermixed. On the other hand you might have a java stored proc (Oracle 9/10) which is generating HTML.
    >
    Does any body has any idea:Refactor.
    I doubt it just has html and JavaScript/Java. So what you have is a mess that mixes several things that should have been seperate in the first place.

  • How to return PL/SQL tables to JAVA

    Can we return tables from PL/SQL stored procedures to JAVA?
    I know that we could use REF CURSOR in PL/SQL, but regarding the performance I heard that its not that good.
    This is the PL/SQL code I need to execute. I need to execute this in Java.
    package table_type_pkg AS
    TYPE t_select_rec_type IS RECORD
    ( state_id fnd_flex_values.flex_value_id%TYPE
    ,state_code fnd_flex_values.flex_value%TYPE
    ,state_desc fnd_flex_values_tl.description%TYPE
    TYPE table_type IS table of t_select_rec_type INDEX BY BINARY_INTEGER;
    table_type_rec table_type;
    empty_table table_type;
    -- get_state_details procedure used to get the details of the state
    PROCEDURE get_state_details(v_table_type OUT table_type_pkg.table_type);
    -- get_records_out procedure to check how the table is intialized in above procedure and what are the values in that table
    PROCEDURE get_records_out;
    END table_type_pkg;
    PACKAGE BODY table_type_pkg AS
    PROCEDURE get_state_details(v_table_type OUT table_type_pkg.table_type) AS
    CURSOR c_rec IS
    SELECT
    ffv.flex_value_id
    ,ffv.flex_value
    ,fftl.description
    FROM
    fnd_flex_value_sets ffvs,
    fnd_flex_values ffv,
    fnd_flex_values_tl fftl
    WHERE
    ffv.flex_value_set_id= ffvs.flex_value_set_id
    AND ffv.flex_value_id=fftl.flex_value_id
    AND ffvs.flex_value_set_name = 'BellSouth State';
    v_rec_count number:= 1;
    v_table_type_recs_out table_type_pkg.table_type;
    -- v_emp_rec table_type_pkg.t_select_rec_type%TYPE;
    BEGIN
    FOR c_get_rec IN c_rec
    LOOP
    v_table_type_recs_out (v_rec_count) := c_get_rec;
    v_rec_count := v_rec_count + 1;
    END LOOP;
    -- dbms_output.put_line('Last Record of get_records_table is'&#0124; &#0124;v_table_type_recs_out(v_rec_count
    v_table_type := v_table_type_recs_out;
    END get_state_details;
    PROCEDURE get_records_out IS
    v_count_rec NUMBER :=1;
    v_table_recs table_type_pkg.table_type;
    BEGIN
    get_state_details(v_table_recs);
    IF v_table_recs.COUNT > 0 THEN
    FOR i IN v_table_recs.FIRST .. v_table_recs.LAST
    LOOP
    DBMS_OUTPUT.PUT_LINE('State id is '&#0124; &#0124;v_table_recs(i).state_id&#0124; &#0124;' and State_code is'&#0124; &#0124;v_table_recs(i).state_code
    &#0124; &#0124;'Description is '&#0124; &#0124;v_table_recs(i).state_desc);
    END LOOP;
    END IF;
    END get_records_out;
    END table_type_pkg;
    Thanks,
    -Rao Repaka
    null

    these pl/sql contains all HTML and java code insideJava or JavaScript. They are not the same. I wouldn't expect to see Java inside html, whereas JavaScript would be intermixed. On the other hand you might have a java stored proc (Oracle 9/10) which is generating HTML.
    >
    Does any body has any idea:Refactor.
    I doubt it just has html and JavaScript/Java. So what you have is a mess that mixes several things that should have been seperate in the first place.

Maybe you are looking for

  • Why does Premiere Pro CC 2014 renders incredibly slow?

    Dear Premiere Pro experts I created a movie with Adobe Premiere Pro CC 2014 and I have serious performance issues when it comes to export the movie. The first 10% renders pretty fast and takes 1 hour. Then it takes for every additional 1% about 4 hou

  • Pages to Epub - adding space/carriage returns

    I'm building an epub file in Pages, and can't do the simplest thing: Make a couple of blank lines appear before and after section dividers. If I insert a return character, it disappears in the epub file. If I adjust paragraph settings to provide addi

  • 64bit Vista on a macbook

    can i run the 64bit version of vista on my 1st gen macbook?

  • Flex Javascript interaction

    In my application, the Flex Javascript interaction works correctly only when I have a "alert" pop-up!!! I do not want the "alert" in my final application. Here is my code snippet: Javascript code: <script language = "JavaScript" type="text/JavaScript

  • Init-passthrough has not been called

    when the server is started i am getting this error. config ( 1312): for host 0.0.0.0 trying to GET /WEB-INF/web.xml, name-trans-passthrough reports: init-passthrough has not been called already i configured with loadbalance.xml files. how to solve th