JAVASCRIPT AND JSF PROBLEM REFRESHING PAGE PROBLEM

Hello everyone, I am currently using visual JSF and javascript to to disable a fileupload component when a radio button is clicked. I don't have any problems getting it to work if I need to disable a button, a textfield or other visual JSF components. For some reason, i can't disable the fileupload component and I get this error when the JAVASCRIPT is called:
Error: document.getElementById("form1:fileUpload1").refresh is not a function
Source File: http://localhost:8080/TestSingleEvent/theme/com/sun/webui/jsf/suntheme4_2-080320/javascript/webui.js
Line: 22
My javascript code is the following:
document.getElementById("form1:fileUpload1").refresh("form1:radioButton1");return false;
I would appreciate some help here. Why is it that when I replace the fileUpload with i.e a textfield i don't get errors..
Is it something to do with the webui.js ?
Many thanks.

There is no such thing as refresh() in the [DOM element|http://developer.mozilla.org/en/DOM/element]. How did you come to this? Did you a wild guess in the around without reading the docs? Don't do that.
What exactly do you want to achieve? Reset its value? Then set the 'value' property to null. Disable the element? Then set the 'disabled' property to true.
I've been helpful enough with this offtopic question. If you still stucks, please continue at a Javascript oriented forum. There's one at under each webdeveloper.com.

Similar Messages

  • Problem with Javascript and opening a new page

    Hi,
    I'm developping a website with Java Server Faces.
    I've a problem with JavaScript.
    I have a table, and each row of that table, has a button, to display more information about that specific row. I want to display this information in a new window. For this I want to use JavaScript.
    The new window, of course, needs some information of the other window, to show the right data.
    The first time I click the 'more-information-button', it works perfectly, but from than on, he keeps showing the same information...
    Here is my jsp-page of the first page (the one with the table):
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page">
        <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
        <f:view>
             <f:loadBundle basename="languages.MessageBundle" var="bundle"/>
            <html>
                <head>
                    <meta content="no-cache" http-equiv="Cache-Control"/>
                    <meta content="no-cache" http-equiv="Pragma"/>
                    <title>- UCV-Period -</title>
                    <link href="resources/stylesheet.css" rel="stylesheet" type="text/css"/>
                </head>
                <body style="-rave-layout: grid">
                        <h:dataTable binding="#{UcvPeriod.dataTable1}" headerClass="list-header" id="dataTable1" rowClasses="list-row-even,list-row-odd" rows="5"
                            style="left: 24px; top: 168px; position: absolute" value="#{UcvPeriod.dataTable1Model}" var="currentRow">
                            <h:column binding="#{UcvPeriod.column1}" id="column1">
                                <h:outputText binding="#{UcvPeriod.outputUcvPeriod}" id="outputUcvPeriod" value="#{currentRow['UCVPERIOD']}"/>
                                <f:facet name="header">
                                    <h:outputText binding="#{UcvPeriod.outputText2}" id="outputText2" value="#{bundle.ucvPeriod_columnHeader_ucvPeriod}"/>
                                </f:facet>
                            </h:column>
                            <h:column binding="#{UcvPeriod.column11}" id="column11">
                                <h:commandButton action="#{UcvPeriod.btnDetails_action}" binding="#{UcvPeriod.btnDetails}" id="btnDetails" value="+" onclick="window.open('Details.jsp')"/>
                                <f:facet name="header">
                                    <h:outputText binding="#{UcvPeriod.outputText21}" id="outputText21" value=""/>
                                </f:facet>
                            </h:column>
                        </h:dataTable>
                    </h:form>
                </body>
            </html>
        </f:view>
    </jsp:root>Here is my action, when someone clicks on the 'more-information-button':
    public String bthnDetails_action() {
       Object s = outputUcvPeriod.getValue();
       BigDecimal ucvPeriod = (BigDecimal)outputUcvPeriod.getValue();
       this.getSessionBean().setUcvPeriod(new Integer(ucvPeriod.intValue());
       return "detail_ucvperiod";
    }Here is my constructor of the Detailspage.
        public Details() {
             this.txtUcvPeriod.setValue(this.getSessionBean().getUcvPeriod());
        }Here is the navigation part for this part of my faces-config.xml .
    <navigation-rule>
       <from-view-id>/UcvPeriod.jsp</from-view-id>
       <navigation-case>
           <from-outcome>detail_ucvperiod</from-outcome>
           <to-view-id>/UcvPeriod.jsp</to-view-id>
       </navigation-case>
    </navigation-rule>Thx a lot....
    Anneke

    See the tutorial "Sharing Data Between Two Pages" at http://devservices.sun.com/premium/jscreator/standard/learning/tutorials/data_sharing_twopages.html and the FAQ "How can I pass data between pages without creating SessionBean variables in Creator?" at http://devservices.sun.com/premium/jscreator/standard/reference/faqs/technical/javasource/passing_data.html. Since you can open a new window when your button is clicked, the tutorial and FAQ will explain ways to pass your data to the new window.

  • JPA and JSF - Problem persisting object

    Hi all.
    I'm having some trouble with JPA, persisting an object to a MySQL table.
    Let's say I have a simple bean, Message:
    package my.package
    import java.io.Serializable;
    import javax.persistence.Id;
    import javax.persistence.Entity;
    import javax.persistence.Column;
    import javax.persistence.Table;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    @Entity
    @Table(name="messages")
    public class Message implements Serializable {
         @Id
         @GeneratedValue(strategy=GenerationType.AUTO)
         private int id;
         @Column(name="message_text")
         private String message;
         @Column(name="message_author")
         private String author;
         public String getMessage() {
              return this.message;
         public void setMessage(String message) {
              this.message = message;
         public String getAuthor() {
              return this.author;
         public void setAuthor(String author) {
              this.author = author;
    }And a controller for this Message bean:
    package my.package;
    import javax.annotation.Resource;
    import javax.persistence.Query;
    import javax.persistence.EntityManager;
    import javax.persistence.EntityManagerFactory;
    import javax.persistence.PersistenceUnit;
    import javax.transaction.UserTransaction;
    public class MessageController {
         @PersistenceUnit(unitName="em1")
         private EntityManagerFactory emf;
         @Resource
         private UserTransaction utx;
         private Message message;
         public Message getMessage() {
              return this.message;
         public void setMessage(Message message) {
              this.message = message;
         public String save() {
              EntityManager em = null;
              String returnValue = "";
              try {
                   em = this.emf.createEntityManager();
                   utx.begin();
                   em.persist(this.message);
                   utx.commit();
                   returnValue = "success";
              } catch(Exception e) {
                   e.printStackTrace();
                   returnValue = "failure";
              return returnValue;
    }Relevant code from the faces-config.xml:
    <managed-bean>
         <managed-bean-name>MessageController</managed-bean-name>
         <managed-bean-class>my.package.MessageController</managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
         <managed-property>
              <property-name>message</property-name>
              <property-class>my.package.Message</property-class>
              <value>#{Message}</value>
         </managed-property>
    </managed-bean>
    <managed-bean>
         <managed-bean-name>Message</managed-bean-name>
         <managed-bean-class>my.package.Message</managed-bean-class>
         <managed-bean-scope>request</managed-bean-scope>
    </managed-bean>This is my simple persistence.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="1.0"
         xmlns="http://java.sun.com/xml/ns/persistence"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
        <persistence-unit name ="em1">
             <jta-data-source>jdbc/__glfish</jta-data-source>
        </persistence-unit>
    </persistence>The __glfish resource is all set up via Glassfish to point to my MySQL server, via a MySQLPool.
    Can anyone see what I'm doing wrong? The Message doesn't get added to the table in my database, and I get a NullPointerException in the method MessageController.save() on the property MessageController.message - which I have specified in the faces-config.xml. Shouldn't that be enough? What have I missed?

    Ok, I have (re-)located the problem. It's not my Message property which gets a NullPointerException - it seems like the problem is with my EntityManagerFactory instance. The PersistenceUnit don't get assigned, even though I declare it in my persistence.xml file.
    Maybe it is something wrong with my file structure?
    The .war file have this structure:
    - WEB-INF
         - classes
              - my
                   - package
                        Message.class
                        MessageController.class
         - lib
              [external jars goes here]
              - META-INF
                   persistence.xml
         faces-config.xml
         web.xml
    [*.jsp/*.xhtml goes here]Can anyone see what's wrong?

  • Jstl and jsf problem

    i'm programming with jsf and have to use jstl tag
    i cant access "var" in jsf tags
    how can i use # with forEach items attribute ?
    or how can i use $ with jsf tags ?
    <c:forEach  items"${x}" var="x">
    <h:outputText value="${x.documentNo}" />
    </c:forEach>

    soso_xuc wrote:
    i'm programming with jsf and have to use jstl tag
    i cant access "var" in jsf tags
    how can i use # with forEach items attribute ?
    or how can i use $ with jsf tags ?
    <c:forEach  items"${x}" var="x">
    <h:outputText value="${x.documentNo}" />
    </c:forEach>
    If you're using at least JSF 1.2 with at least JSTL 1.2, you can just use unified EL (the "JSF EL") in c:forEach.
    <c:forEach items="#{x}" var="x"><h:outputText value="#{x.p}"/></c:forEach>That said, using c:forEach in JSF is not recommended (as almost every JSTL tag/taglibs, only the Functions taglib is useful). Rather go for an JSF UIData component which does not output anything, such as Tomahawk t:dataList and RichFaces' a4j:repeat. If you're using Facelets instead of JSP, you could also use ui:repeat.

  • Javascript error on EP6, refresh page

    Hello,
    I work on EP6. I've develop a page (I use iview) which I allow users to generate and download a file on his PC. This page open a pop up windows which allows to open or to save the file. If I choose to save the file, when I come back to my page I my page is like frozen and when I try to click to choose a funtionnality I get a javascript error (undefined error). But, I don't use javascript function. I have to click many times or to refresh the page to be able to do something again.
    I'd like to know if forcing the refreshing is a good idea to solve this problem. If it is, I'd like to know how I can refresh without getting event. I suppose that because my page is frozen, I can not get any event.
    Thanks for every response,
    Maria

    Hi Maria
    For refreshing the iView, refer the following code:
    Modify the code as per your requirement.
    response.write("<script>
    response.write("window.opeaner.pageSupport.ivuRefresh('"request.getComponentContext().getContextName().toString()"';
    response.write(window.close();
    response.write("</script>");
    For documentation on ivuRefresh, refer the following doc:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/using%20the%20new%20client%20side%20page%20builder%20features%20of%20ep6%20sp2
    Regards
    Gaurav Gandhi
    PS: Award points if helps.

  • Javascript and vbscript on same page?

    I an editing a customers site which had some old server side javascript on the page.
    I need to use vbscript on the page now as the page is being upgraded to aspx instead of asp.
    The question is, do I need to upgrade all the existing server side javascript on the page to vbscript or can the two co-exist side by side?
    Thank you
    Terry

    terryfoster wrote:
    I wish I could, he left when the tea stopped flowing!
    Hi
    I'm not surprised they left.
    aspx pages are Microsoft's .net pages which is completely different to asp. Using both on the same page will depend on your server set-up, but javascript is not a language you can use for aspx, and I would not recommend mixing them except for the most basic usage.
    Your choices for aspx are - C#, vbscript, C++, Java++,, there are a few others but I have never heard of anyone using them.
    You can use javascript for your client-side, (browser) scripting language though.
    PZ

  • Javascript and JSF

    I am using javascript to try and populate a page with data from a row that is double-clicked.
    I am using the following javascript to output the contents of the row but i want the contents of the row to populate another page when it is double clicked. Can anyone help with this? Or suggest what i change in the javascript i am using?
    Thanks.
    <script>
    function myhandler(){
    alert(value="#{RouteHandler.carrierCode}");
    alert(value="#{RouteHandler.departureAirport}");
    alert(value="#{RouteHandler.arrivalAirport}");
    this.style.backgroundColor='#ffffff';
    </script>
    I am calling the javascript function in the following dataTable:
    t:dataTable id="routeList" value="#{RouteHandler.routeList}" var="rowElement" cellspacing="0" cellpadding="3"
    ondblclick="javascript:myhandler()" border="0" headerClass="listhead" columnClasses="listresults" bgcolor="#FFFFFF">
    <t:column width="104">
    <h:outputText value="#{rowElement.carrierCode}" />
    </t:column>
    <t:column width="165">
    <h:outputText value="#{rowElement.departureAirport}" />
    </t:column>
    <t:column width="920">
    <h:outputText value="#{rowElement.arrivalAirport}" />
    </t:column>
    </t:dataTable>

    If you want javascript itself, then how about this:
         function testDblClick() {
              var evt = window.event;
              var destElement = evt.srcElement;
              if(destElement.tagName == 'BODY') return;
              var parentEle = destElement.parentNode;
              while(parentEle.tagName != "TR") {
                   parentEle = parentEle.parentNode;
                   if(parentEle == null) break;
              var msg = '';
              var childNode = null;
              for(var i=0;i<parentEle.childNodes.length;++i) {
                   childNode = parentEle.childNodes;
                   msg += parentEle.childNodes[i].innerHTML + " | ";
              if(msg != '') alert(msg);
    code}
    At the end of you JSP page inculde this code:
    document.ondblclick = testDblClick;

  • OnChange javascript code to reload/refresh page

    Hello,
    I am trying to refresh the page when a field gets changed using javascript onChange.
    <Property name='onChange' value='JavaScript:location.reload(true);'/>
    also tried
    <Property name='onChange'>
    <script>
    JavaScript:location.reload(true);
    </script>
    </Property>nothing works. I know i could do action, but there is a sun bug with internet explorer which never reloads the pages in selector field.

    Acrobat/Reader 11 allows you to use the printRange property of the PrintParams object that's used with the print statement: http://livedocs.adobe.com/acrobat_sdk/11/Acrobat11_HTMLHelp/JS_API_AcroJS.89.1013.html
    See the sample code included at the link above.

  • Include custom javascript and css in uix page

    Hello
    I got a UIX page based on the pageLayout template and i wanted to include some custom things (css, js) inside the resulting html header like this:
    <document>
    <metaContainer>
    <!-- Set the page title -->
    <head title="mypage"/>
    <html:link rel="stylesheet" type="text/css" href="http://someotherserver.com/generateStyle?pCSSType=loc"/>
    <html:link rel="stylesheet" type="text/css" href="http://someotherserver.com/generateStyle?pCSSType=sys"/>
    <script source="customScript.js"><contents><!-- --></contents></script>
    </metaContainer>
    <contents>
    <body>
    Unfortunatly only ONE thing from within "metaContainer" gets included in the final html file. Is there a way to include everything from within "metacontainer"?
    Thanks for your help,
    Philipp Stecher

    I think metacontainer is a named child, and like all named children it can only have one node.
    Does this work?
    <document>
    <metaContainer>
    <!-- Set the page title -->
    <head title="mypage">
    <contents>
    <html:link rel="stylesheet" type="text/css" href="http://someotherserver.com/generateStyle?pCSSType=loc"/>
    <html:link rel="stylesheet" type="text/css" href="http://someotherserver.com/generateStyle?pCSSType=sys"/>
    <script source="customScript.js"><contents><!-- --></contents></script>
    </contents>
    </head>
    </metaContainer>

  • JSF problem Session Scoped and dialog

    Hello All! i have one problem with using ajax and session scoped .
    I'm using JSF 2.0 and Primefaces for build 2 dialog.
    I have one icon to click on it dialog 1 will display and show all list of customers and when i click details of customer on dialog 1, dialog 2 will display , and details of customer show base on <h:form>
    but my problem is when i click details of customer with id #1 it not show details of customer it return null, i must refresh this page and click on customer #1 and it display, but when i click on customer with id #3 it still display customer with id #1,and i must refresh page again to view customer with id #3 and after that if i want see details of other customer such as customer with id #5 i must click and refresh page, after refresh page i click on any id of customer if always show the last id of customer before refresh page, it mean because i use p:commandButton with ajax and 2 dialog inside one page, i know , if using session scoped i must pass value from one page to another page. But i want get id in the same page with session scoped this mean when i use p:commandButton call dialog 2 for pass id value from dialog one to dialog two it will get value don't refresh page . How can i do it? or can i call dialog from another show on the same page contain dialog 1?
    Primefaces dialog http://www.primefaces.org/showcase/ui/dialogHome.jsf

    Hello All! i have one problem with using ajax and session scoped .
    I'm using JSF 2.0 and Primefaces for build 2 dialog.
    I have one icon to click on it dialog 1 will display and show all list of customers and when i click details of customer on dialog 1, dialog 2 will display , and details of customer show base on <h:form>
    but my problem is when i click details of customer with id #1 it not show details of customer it return null, i must refresh this page and click on customer #1 and it display, but when i click on customer with id #3 it still display customer with id #1,and i must refresh page again to view customer with id #3 and after that if i want see details of other customer such as customer with id #5 i must click and refresh page, after refresh page i click on any id of customer if always show the last id of customer before refresh page, it mean because i use p:commandButton with ajax and 2 dialog inside one page, i know , if using session scoped i must pass value from one page to another page. But i want get id in the same page with session scoped this mean when i use p:commandButton call dialog 2 for pass id value from dialog one to dialog two it will get value don't refresh page . How can i do it? or can i call dialog from another show on the same page contain dialog 1?
    Primefaces dialog http://www.primefaces.org/showcase/ui/dialogHome.jsf

  • 4.2 "Include Standard JavaScript and CSS" option removed ?

    Hi,
    APEX 4.2, Oracle 11g r2.
    I was using the option *"Include Standard JavaScript and CSS"* from the page attributes. It was set to *"No"* in all pages as I manage my own JQuery versions.
    We upgraded to 4.2 yesterday, and I see the option is still here on 4.2.
    I simply tried to set it to "Yes" for a test, but now the option has disappeared !! I can't set it back to "No"...
    In each page, if I set it to "Yes" and apply changes, the option is not here when I go back to the page attributes.
    Bug ?
    Or maybe this option has been removed from 4.2 ?

    Hi,
    yes this has intentionally been removed for applications / pages which do not use the feature. As you mentioned yourself and what we have seen from other customers is that someone doesn't just want to exclude that on a single page and instead want to control it for the application. Which made it a little bit cumbersome, because a developer had to set it for each new page.
    That's why we have created a page template placeholder for *#APEX_JAVASCRIPT#* and *#APEX_CSS#* to give you full control where to load the APEX libraries and if you don't want to load them, just remove them from the page template as Vikram already pointed out.
    Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • Insert and then show the result and refresh page problem

    hi all,
    I collect the form value and put them into db, and then display this student 's inform out from db including the one we just submit, first I do it on this way
      insertpayment(UserId, FeeType, DuteDate, OfficerReason, OtherReason, CompleteDate,
                            InterviewDate, ApprovalDate,PaymentYear);
                   studentRecords= getFound(UserId);
                     userSession.setAttribute("studentRecords", studentRecords);
                     RequestDispatcher disp;
                   // disp = getServletContext().getRequestDispatcher("/WEB-INF/jsp/   studentRecords= getFound(UserId);");
                     disp = getServletContext().getRequestDispatcher("/showPayment");
                    disp.forward(req, res); then whenever I refresh my showRecords.jsp" I call the insert function. THAT IS HORRIABLE.
    I try to move the studentRecords= getFound(UserId); to my showPayment servlet and then forward the result to showRecords.jsp, but I alwarys get error
    PWC4011: Unable to set request character encoding to UTF-8 from context /report, because request parameters have already been read, or ServletRequest.getReader() has already been called
    How should I handle this kind of problem??

    Karan, thank you for the link, i read a few articles, I only get the sample part part use res.sendRedirect("/myfolder/showPayment"); in my insert servlet and use forward to display the page
    userSession.setAttribute("studentRecords", studentRecords);
                  RequestDispatcher disp;
                  disp = getServletContext().getRequestDispatcher("/WEB-INF/jsp/secure/admin/showRecords.jsp");
                   disp.forward(req, res);   
    this solute the refresh page problem, but bring the new problem I can't use the following way to disable the back button. not the perter solution
    maybe I did not understand PRC more advice!!
    response.setHeader("Cache-Control","no-cache"); //Forces caches to obtain a new copy of the page from the origin server
    response.setHeader("Cache-Control","no-store"); //Directs caches not to store the page under any circumstance
    response.setDateHeader("Expires", 0); //Causes the proxy cache to see the page as "stale"
    response.setHeader("Pragma","no-cache"); //HTTP 1.0 backward compatibility

  • Facelets and jsf-extensions problem.

    I'm fairly certain I've run into a problem between facelets and jsf-extensions. I'm working with JSF 1.2 RI, Woodstock, Facelets 1.1.13, on Tomcat 6.
    When trying to get Woodstock autoValidation to work I get a javascript error the "I has no properties". The error occurs in the com_sun_faces_ajax.js file in the jsf-extensions-dynamic-faces-0.1.jar (I've used both the RC4 and a build today ,10/18/07 from source with the same results). Here is the code snippet where it happens (with my comment).
    var I = G.getElementsByTagName("components")[0];
    var C = I.getElementsByTagName("render");
    for(var F = 0; F < C.length; F++) {
    In the second line there it looks like the variable I is null, but based on the post response below I don't know why.
    The response from the post looks like this:
    <partial-response><components><render id="PayableForm:vendorGci"><markup><![CDATA[{"valid":true,"id":"PayableForm:vendorGci"}]]></markup></render></components>
    However the server side code (validation method) never gets executed. I'm willing to do some digging and debug work, but I'd need to be pointed in the right direction.
    The following is more potentially useful code snippets.
    Here is the textField code:
    <w:form id="PayableForm">
    <w:textField style="display:none;" />
    <w:message for="vendorGci" />
    <w:label id="vendorGciLabel" for="vendorGci" text="Vendor: " />
    <w:textField id="vendorGci" autoValidate="true"
    text="${vendorBean.searchGci}" maxlength="8" required="true"
    validatorExpression="#{ vendorBean.validateVendor}" />
    Here is the javascript in the page (the init function is called from the body: onLoad="setTimeout('init();', 0);" , this does happen):
    <w:script type="text/javascript">
    function VendorListener(){
    function VendorNotify(props){
    alert("VendorNotify called!"); <--------------- I never see this alert message
    if ( props.id != "PayableForm:vendorGci") { return; }
    var field = document.getElementById("PayableForm:vendorGciLabel");
    field.setProps({
    valid: props.valid
    VendorListener.prototype.notify = VendorNotify;
    function initAccountRows(){
    var table = document.getElementById("PayableForm:vendorAccountTable");
    table.initAllRows();
    function init(){
    initAccountRows();
    var listener = new VendorListener();
    dojo.subscribe(
    webui.suntheme.widget.textField.event.validation.endTopic ,
    listener, listener.notify);
    Here is the validator method. It currently doesn't do anything, just trying to get something to work. I never see the output, and I never hit the breakpoint in the method.
    public void validateVendor(FacesContext context, UIComponent comp, Object value){
    System.out.println("**********************************");
    System.out.println("validateVendor called");
    System.out.println(value);
    System.out.println("**********************************");
    }

    Actually I don't need a global variable. I need to refer in my included template the actual backing bean used in the current page. As all my backing bean extends a abstract class I could bind my component to a property of the current backing bean, no matters which one. Just like a polymorphic call but without the parameter. Let's imagine I could get this object of the facesContext object I would be able to do:
    <rich:datascroller renderIfSinglePage="false" align="right" for="listagem" maxPages="12" fastStep="10"
    pageIndexVar="pageIndex" pagesVar="pages" stepControls="show" fastControls="hide" boundaryControls="show"
    inactiveStyleClass="paginacaoInativa" selectedStyleClass="paginacaoSelecionada"
    styleClass="paginacao" tableStyleClass="paginacaoTabela"
    binding="#{facesContext.currentBackingbean.formDataScroller}" id="paginacao">
    Instead of pass the backing bean to the ui:param of this template... Dou you get the point?

  • JSF problems with Javascript

    Hi everyone!!
    The situation is this: I have a datable with one of its columns make an h:commanLink, which has two f:params, its actionListener is a function of a ManagedBean. This is JSF, not MyFaces. In IE, When the link is pressed, it shows a javascript error: " 'elements.idVar' is null or it's not an object ", however in Firefox, it works perfectly. I have been looking for the problem and it have to do with this:
    </form><a href="# onclick="clearFormHiddenParams_formResultado('formResultado');document.forms['formResultado'['formResultado:_idcl'].value='formResultado:dtTablaResultados:0:_id10';document.forms['formResultado']['idVar'].value='37';document.forms['formResultado']['idMun'].value='168'; document.forms['formResultado'].submit(); return false;"><span id="formResultado:dtTablaResultados:0:itColumna3" title="AREA COSECHADA EN CULTIVOS PERMANENTES">1,230</span></a></td>
    </tr>
    <tr class="standardTable_Row2">
    <td><span id="formResultado:dtTablaResultados:1:itColumna1" style="text-align:center;" title="C&oacute;digo Municipio">718</span></td>
    <td><a href="javascript:void(0)" onclick="javascript:window.opener.opener.showLink('SASAIMA')"><span id="formResultado:dtTablaResultados:1:itColumna2_l" title="Municipio">SASAIMA</span></a></td>
    <td><form id="formResultado:dtTablaResultados:1:_id9" method="post" action="/ConsultaEstadisticasGeo/resultadoConsulta.jsf" enctype="application/x-www-form-urlencoded">
    <input type="hidden" name="com.sun.faces.VIEW" id="com.sun.faces.VIEW" value="_id39:_id41" /><input type="hidden" name="formResultado:dtTablaResultados:1:_id9" value="formResultado:dtTablaResultados:1:_id9" /><input type="hidden" name="idVar" /><input type="hidden" name="idMun" /><input type="hidden" name="formResultado:_idcl" />
    <script type="text/javascript">
    <!--
    function clearFormHiddenParams_formResultado_dtTablaResultados_1__id9(curFormName) {
    var curForm = document.forms[curFormName];
    curForm.elements['idVar'].value = null;
    curForm.elements['idMun'].value = null;
    curForm.elements['formResultado:_idcl'].value = null;
    //-->
    </script>
    the way JSF manage the params. The error, acdording to the message shonw by IE is in this line: curForm.elements['idVar'].value = null;
    The code of the JSP is this:
    <h:commandLink     actionListener="#{consultaEstadisticasMB.detalleEstadistica}">
         <f:param name="idVar" value="#{consultaEstadisticasMB.idColumna3}" id="idVar" />
         <f:param name="idMun" value="#{registro[0]}" id="idMun" />
         <h:outputText title="#{consultaEstadisticasMB.columna3}" id="itColumna3" value="#{registro[2]}" />
    </h:commandLink>
    Waht can i do? (Not using MyFaces, because I can�t do that)
    Thanks for your answers!!

    I have run into this same problem with javascript and the colon. I am not sure if the colon is a valid character for a javascript identifier (one would think the RI developers would have checked it out though!?!).
    Anyway, my workaround is to search through the Javascript DOM for the widget you want to obtain a reference to, using part of its id. After all, you know its id, you just can't use it as a javascript reference. In your Javascript code, do something like:
        var inputWidgets = document.getElementsByTagName("input");
        var targetInput;
        for(var i = 0; i < inputWidgets.length; i++)
           var inputId = inputWidgets.id;
    if(inputId.indexOf("yourInputId") != -1)
    targetInput = inputWidgets[i];
    break;
    It's a lot of effort to just get a reference to a form widget....but it works (I pasted in the code and changed it a bit, so it might not work as is, but at least it demonstrates the idea).

  • Problems refreshing page with AJAX

    Hello,
    I have never used AJAX but today I decided to try it to improve my current implementation of a "processing" page that I use to display a waiting message and to check every 5 seconds if a response is available. If it is, the user is redirected to a "processing done" page.
    My previous implementation used the refresh tag provided by HTML in the "processing" page:
    <meta HTTP-EQUIV="Refresh" CONTENT="5; URL=<%=request.getContextPath()%>/main/CheckForResponse.do"/>
    Every 5 seconds a struts action is executed and the action itself will forward to the "processing done" page when a response is available.
    This solution works, however I don't like the refresh page effect, so I was trying to use AJAX instead. Now I put in the "processing" page the following script:
            function checkForResponse()
                var xmlHttp;
                try
                    // Firefox, Opera 8.0+, Safari
                    xmlHttp=new XMLHttpRequest();
                catch (e)
                    // Internet Explorer
                    try
                          xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
                    catch (e)
                        try
                            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                        catch (e)
                            alert("Your browser does not support AJAX!");
                            return false;
                xmlHttp.open("GET","<%=request.getContextPath()%>/main/CheckForResponse.do",true);
                xmlHttp.send(null);
            }and I have the following html body tag.
    <body onLoad="setInterval('checkForResponse()',5000);">
    The function executes correctly and the struts action is also executed. However the problem is that for some reason the action doesn't forward to the "processing done" page. It does actually, if I debug, but nothing happens, the "waiting" page keeps being displayed.
    Does anyone have an idea about what I could be doing wrong? any suggestion?
    Thanks a lot!!

    Did you define the call back function correctly? like===
    xmlhttp.onreadystatechange = handleHttpEvent;
    function handleHttpEvent(){
            if (xmlhttp.readyState == 4) {
                if (xmlhttp.status == 200) {
                    // GO TO PROCESSING END PAGE
                } else {
                    window.alert("ERROR");
        }Also, you might want to check the progress bar application
    in bpcatalog -> http://bpcatalog.dev.java.net

Maybe you are looking for