2 Replies Latest reply on Jan 24, 2008 8:08 AM by ssilvert

    All Javascript doen't work, please help me

    yangpa094

      I have small example.
      Here, I made a java script setting some value to the inputText with command button click.
      And I add js.jar classpath.

      In the IE6, clickcing button works well, but in JSFUnit, the sciprt doesn't work.

      Thanks for your advice.



      <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

      <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>




      <!--
      function openPopup()
      {
      var url = "popUp.faces";
      var obj = window.open(url,"popup","height=200,width = 200,resizable=yes");
      }
      function testScript()
      {
      document.getElementById("form00:inputText00").value = "200";
      }
      -->



      <f:view>
      <h:form id="form00" style="height: 300px; width: 300px">
      <h:panelGrid columns="1">
      <h:panelGroup>
      <h:outputText value="AA test"></h:outputText>
      </h:panelGroup>
      <h:panelGroup style="height: 20px; width: 800px">
      <h:inputText id="inputText00" value="#{testPageBean.inputText00}" size="10"></h:inputText>
      <h:outputText value="*"></h:outputText>
      <h:inputText id="inputText01" value="#{testPageBean.inputText01}" size="10"></h:inputText>
      <h:commandButton id="commandButton00" value="calculation" actionListener="#{testPageBean.processChangeAction}" ></h:commandButton>
      <h:commandButton id="commandButton01" value="popUp" onclick="openPopup();" ></h:commandButton>
      <h:commandButton id="commandButton02" value="Next Page" action="newPage"></h:commandButton>
      <h:commandButton id="commandButton03" value="Script test" onclick="testScript();"></h:commandButton>
      <h:outputText id="outputText00" value="#{testPageBean.outputText00}"></h:outputText>
      </h:panelGroup>
      </h:panelGrid>
      </h:form>
      </f:view>

        • 1. Re: All Javascript doen't work, please help me
          yangpa094

          And I use JSF in JEUS6. Should I run my example in JBoss WAS?

          • 2. Re: All Javascript doen't work, please help me
            ssilvert

            JSFUnit doesn't currently test ad hock javascript. It will probably never be a client-side javascript testing tool because what happens in the browser really has little to do with JSF.

            Where javascript comes into play with JSF is when it is used to submit a request to the server and subsequently change the DOM of the client page. In other words, AJAX. I talk about JSFUnit and AJAX here: http://wiki.jboss.org/wiki/AjaxWithJSFUnit

            So in your test, you are allowed to mimic the effect that javascript is having on your page by manually changing the DOM using your own java code. That is how we are able to support "Ajaxified" JSF components like RichFaces.

            Of course, it would be simpler if you could just call into a javascript engine that runs your real javascript code. We are looking into that possibility, but we aren't there yet.

            Regards,

            Stan