[ https://issues.apache.org/jira/browse/TAP5-568?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12680556#action_12680556 ]
Howard M. Lewis Ship commented on TAP5-568: ------------------------------------------- Oops. This is a Tapestry 4 bug! > javascript is not nor showing nor being rendered within the .html. we have a > prototype and implemented the same things? > ----------------------------------------------------------------------------------------------------------------------- > > Key: TAP5-568 > URL: https://issues.apache.org/jira/browse/TAP5-568 > Project: Tapestry 5 > Issue Type: Bug > Components: JavaScript > Environment: OS: WindowsXP > Server: JBoss > IDE: Eclipse > Tapestry: version 3.0.3 > Java: J2re1.4.2_16 > Reporter: Frederick Gaetos > Original Estimate: 120h > Remaining Estimate: 120h > > Here's what happened: > We're going to implement a component based javascript within our tapestry > project (big project). > We have two projects. > 1.)Prototype HelloWorld Tapestry project that was able to produce "Hello > World" message that is invoked by javascript. (this thing worked!) > 2.) Second was a project where we are going to implement the same scenario > wherein a button will invoke a page. And when the said page is rendered, it > will also display a "Hello World" since it has the same javascript > implementation similar with "project number one" ("Prototype HelloWorld > Tapestry Project"). > The "Prototype HelloWorld Tapestry project" is made for the purpose of > implementing component based javascript within an expert system project. > ...However, for some reasons it did NOT worked... > Thus, No <script> tag was rendered within the second scenario/ Project. > Please see more of the details and explanation below. > here's the prototype: > html > codes:================================================================================== > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" > "http://www.w3.org/TR/html4/strict.dtd"> > <html> > <head> > <script jwcid="searchScript" language="JavaScript" > type="text/javascript"/> > <title>Welcome to Tapestry!</title> > </head> > <body onload="Javascript:Hello()" topmargin="0"> > <h2>Welcome to Tapestry!</h2> > <form action="" jwcid="loginForm"> > <p> User Name: <input type="text" jwcid="uname" /> > <br/> Password: <input type="password" jwcid="password" /> > <br/> <input type="submit" value="Let me in!"/></p> > </form> > </body> > </html> > Home.page > codes:============================================================================= > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE page-specification PUBLIC > "-//Apache Software Foundation//Tapestry Specification 3.0//EN" > "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd"> > <!-- generated by Spindle, http://spindle.sourceforge.net --> > <page-specification class="com.scc.mytapestry.Home"> > <description>Login page</description> > <property-specification name="uname" type="java.lang.String"/> > <property-specification name="password" type="java.lang.String"/> > <component id="loginForm" type="Form"> > <binding name="listener" expression="listeners.onFormSubmit"/> > </component> > <component id="uname" type="TextField"> > <binding name="value" expression="uname"/> > </component> > <component id="password" type="TextField"> > <binding name="value" expression="password"/> > <static-binding name="hidden" value="true"/> > </component> > <context-asset name="search_js" path="/script/searchForm.js"/> > <component id="searchScript" type="Any"> > <static-binding name="element" value="script"/> > <binding name="src" expression="assets.search_js"/> > </component> > </page-specification> > ============================================================================================= > HelloWorld.js > codes:========================================================================= > onload=function(){ > alert('Hello World'); > } > ============================================================================================= > Here is how our page has been > rendered:====================================================== > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" > "http://www.w3.org/TR/html4/strict.dtd"> > <html> > <head> > <script src="/Login/script/searchForm.js" language="JavaScript" > type="text/javascript"></script> > <title>Welcome to Tapestry!</title> > </head> > <body onload="Javascript:Hello()" topmargin="0"> > <h2>Welcome to Tapestry!</h2> <form method="post" name="Form0" > action="/Login/app"> > <input type="hidden" name="service" value="direct/0/Home/loginForm"/> > <input type="hidden" name="sp" value="S0"/> > <input type="hidden" name="Form0" value="uname,password"/> > <p>User Name: <input type="text" name="uname"/><br/> > Password: <input type="password" name="password"/><br/> > <input type="submit" value="Let me in!"/></p> </form> > </body> > </html> > ============================================================================================= > Result: (Prototype HelloWorld Tapestry project) was a SUCCESS!!! > Thus, codes above worked and showed the "HelloWorld!" message as invoked by > javascript alert method. > ============================================================================================= > so, on our second scenario. What we have in mind is to simply implement the > same things on our second project. > insert this in the .page > ============================================================================================= > <context-asset name="helloWorldJS" path="/js/HelloWorld.js"/> > <component id="helloWorldScript" type="Any"> > <static-binding name="element" value="script"/> > <binding name="src" expression="assets.helloWorldJS"/> > </component> > ============================================================================================= > insert this code in the .html > ============================================================================================= > <script jwcid="helloWorldScript" language="JavaScript" > type="text/javascript"/> > ============================================================================================= > and ofcourse, have a file "HelloWorld.js" within the second > ============================================================================================= > onload=function(){ > alert('Hello World'); > } > ============================================================================================= > Please download the zip file that has the > 1.)sales_paymentmodes.page (This contains the component) > 2.)sales_paymentmodes.html (this contains the <script> tag) > http://www.geocities.com/pikapika2501/Files.zip > I uploaded this since the two files will make my posting too ambiguous to > understand... > This is a function within a .java that will activate/invoke the > sales_paymentmode.html > ============================================================================================= > public void applyPaymentMethod(IRequestCycle cycle) throws Exception > {======================= > this.resetCombo(cycle); > this.applyDiscount(cycle); > if (!this.validateSaleStatus()) > return; > log.debug(new LogFormat((powVisit) this.getVisit(), > "Applying Payment Methods to " + this.getSaleID())); > GlobeSalesPaymentModesPage paymentMethodsPage = > (GlobeSalesPaymentModesPage) cycle > .getPage("globesalespaymodes"); > paymentMethodsPage.setSaleID(this.getSaleID().longValue()); > paymentMethodsPage.setCurrentSalePaymentMethod(null); > // 1) hold values in payment modes page > this.holdPageValues(paymentMethodsPage); > paymentMethodsPage.setSalePaymentMethods(this.readPaymentMethodItems()); > paymentMethodsPage.setAmountDue(this.getTotalAmount()); > paymentMethodsPage.setEwtAmount(new Double(Sale > .getEWTAmount(getSaleID().longValue()))); > log.debug(new LogFormat((powVisit) this.getVisit(), > "paymentMethodsPage.getEwtAmount() " > + paymentMethodsPage.getEwtAmount())); > CurrencyType defaultCurrency = null; > CurrencySelectionModel currencySelectionModel = > (CurrencySelectionModel) paymentMethodsPage > .getBeans().getBean("currencySelectionModel"); > defaultCurrency = (CurrencyType) currencySelectionModel > .getOption(currencySelectionModel > .getIndexFromCurrencyCode("PHP")); > paymentMethodsPage.setCurrencyType(defaultCurrency); > paymentMethodsPage.setSalePaymentMethod(new SalePayMethod()); > cycle.activate(paymentMethodsPage); > > } > ============================================================================================= > Note: > The last two lines are important... > paymentMethodsPage.setSalePaymentMethod(new SalePayMethod()); > cycle.activate(paymentMethodsPage); > ============================================================================================= > What we are confuse of is that "why is it that when we implement the same > HelloWorld alert scenario, it is not rendering the alert javascript to the > .html". > P.S. > - we even tried calling the prototype within our expert system project > (project 2) and it worked. > - we verified if our .page xml is correct (project 2)... > - we suspect that the concern can be rectified by analyzing the > "sales_paymentmodes.page" and there might be some syntax that is preventing > it from rendering the script. > > I have already spent five days in doing everything I could to check any loop > holes with no luck. Hope you could help us out. > Thanks! -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.