Generally the JS include (<script src="sortTable.js"></script>) should go in the head of the document so that the objects and/or functions defined in it will be global to the page. The alert() function just displays a dialog window with a message. It's like using println() to debug java code. Here are some JavaScript resources: http://developer.netscape.com/docs/manuals/javascript.html <http://developer.netscape.com/docs/manuals/javascript.html> http://developer.netscape.com/docs/manuals/communicator/jsref/index.htm <http://developer.netscape.com/docs/manuals/communicator/jsref/index.htm> http://wp.netscape.com/eng/mozilla/3.0/handbook/javascript/index.html <http://wp.netscape.com/eng/mozilla/3.0/handbook/javascript/index.html> Welcome to the wonderful world of JavaScript! -----Original Message----- From: Heligon Sandra [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 7:41 AM To: 'Struts Users Mailing List' Subject: RE: Tiles with logic:iterate and JavaScript to sort table Sorry, but I don't know JavaScript very well and I don't understand your remark. In my example the call to the function initTable("table0"); is done after the definition of the table <table id="table0". So the navigator know its name, isn't it ? it is probably the JavaScript which is not called. but I do not know how to make this test. I added the line alert("function found and starting..");,but nothing what is the aim of this instruction ? I joined the JavaScript. Thanks in advance for your help ----------------------------------------------------------------------------
As of February 12th, 2003 Thomson unifies its email addresses on a worldwide basis. Please note my new email address: [EMAIL PROTECTED] http://www.thomson.net/ <http://www.thomson.net/> ----Original Message----- From: Thomas CORNET [ mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ] Sent: 31 March 2003 14:32 To: Struts Users Mailing List Subject: Re: Tiles with logic:iterate and JavaScript to sort table As the 'initFunction' function has a parameter which is the name of the table, its call should stay at the bottom of the page. If you put it at the top, there will be an error because the table hasn't been yet processed by the navigator so it can't know its name. To ensure the script is called, just put a debugging message at the first line of 'initFunction' in your script, such as alert("function found and starting.."); Thomas At 14:18 31/03/2003, you wrote: > I have a Struts web application with the following JSP page that >allows to display table. > I would like to allow the user to sort column. > > <%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %> > <%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %> > <%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %> > > <html:form action="/MyAction.do" method="GET"> > > <table id="table0" width="100%" border="1" cellpadding="0" >cellspacing="0" bordercolor="#FFFFFF"> > > <%-- Title for the columns of the table --%> > <tr bgcolor="#FFCC00"> > <th align=left width="10%"><bean:message key="title.id"/></th> > <th align=left width="10%"><bean:message key="title.name"/></th> > </tr> > > <logic:iterate name="myForm" id="employees" property="employees" >type="myBean.Employee" offset="offset" length="length"> > <tr bgcolor="#EBEBEB"> > <td bgcolor="#EBEBEB" width="10%"> > <html:link href="display.do"> > <bean:write name="employees" property="id"/> > </html:link> > </td> > > <td bgcolor="#EBEBEB" width="10%"> > <bean:write name="employees" property="name"/> > </td> > </tr> > </logic:iterate> > > </table> > > <script src="sortTable.js"></script> > <script>initTable("table0");</script> > </html:form> > > This page extends a common model classicLayout.jsp. > Do I have to call the script in the <head> of the classicLayout.jsp >? > > I placed the JavaScript file sortTable.js in the same directory as >my JSP. > But it doesn't work, has someone an idea of the problem ? > > > >--------------------------------------------------------------------------- - > >As of February 12th, 2003 Thomson unifies its email addresses on a worldwide >basis. >Please note my new email address: [EMAIL PROTECTED] > > http://www.thomson.net/ <http://www.thomson.net/> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]