Re: JavaScript errors on exception-handling.html
Yes, we know that and it's already solved - please check the Draft docs http://struts.apache.org/development/2.x/docs/exception-handling.html Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ 2013/9/5 Volker Krebs volker.kr...@abas.de: Hello, the Exception Handling Documentation Page http://struts.apache.org/release/2.3.x/docs/exception-handling.html has some JavaScript Errors. I stumbled over this a couple of weeks ago ... and now again. So I thought I'll write it to the list, hoping to reach someone who can fix it. Regards - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: JavaScript errors on exception-handling.html
Hallo Volker, Thanks, I was writing this in the same time Some HTML pages in WW/docs give sometimes an ( alert? ) error and yon can't see the data For example, Coding Struts 2 Actions, docs/WW/docs/coding-struts-2-actions.html, The same error: -- SyntaxHighlighter Can't find brush for: xml - THe data , in a script syntax like this one : --- script type=syntaxhighlighter class=theme: Default; brush: xml; gutter: falselt;![CDATA[ amp;lt;action name=hello class=org.apache.struts.helloworld.action.HelloWorldAction method=executeamp;gt; amp;lt;result name=successamp;gt;/HelloWorld.jspamp;lt;/resultamp;gt; amp;lt;/actionamp;gt; ]]gt;/script What about script src='http://struts.apache.org/highlighter/js/shBrushJava.js' type='text/javascript'/script? De : Volker Krebs volker.kr...@abas.de À : Struts Users Mailing List user@struts.apache.org Envoyé le : Jeudi 5 septembre 2013 9h08 Objet : JavaScript errors on exception-handling.html Hello, the Exception Handling Documentation Page http://struts.apache.org/release/2.3.x/docs/exception-handling.html has some JavaScript Errors. I stumbled over this a couple of weeks ago ... and now again. So I thought I'll write it to the list, hoping to reach someone who can fix it. Regards - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: javascript array to Struts 2 action
Hi, try with String[] field in your action, or create a custom field setter that will take String[] as a parameter. I also assume that on your page You are submiting it as an array? Best greetings, Paweł Wielgus. 2011/5/10 srsankar sriram.it...@gmail.com: i am having a array of strings on javascript and i would like to make an ajax call to struts 2 action which expects ListString. I need to know a way to pass these values to action which will recognize it. If i pass the array directly, SOP is printing it as an Object and it couldnt able to cast it to java List. Please help me to identify how to do this. thanks. -- View this message in context: http://struts.1045723.n5.nabble.com/javascript-array-to-Struts-2-action-tp4384471p4384471.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: Javascript proble in sx:civ in struts2
Thanks for the advice. But my problem is, after clicking on the tabbed pannel I am loading one jsp(certification.jsp). I want, if I write javascript inside certification.jsp that should work. mgainty wrote: Good Advice struts anchor tag: href The URL to call to obtain the content. Note: If used with ajax context, the value must be set as an url tag value. --the javascript anchor alternative references struts-dojo-tags uri and allows a javascript handler as illustrated here: %@ taglib prefix=sx uri=/struts-dojo-tags % sx:a .. handler=JavaScriptFunction / Martin __ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Date: Fri, 17 Sep 2010 09:55:09 +0100 From: alo...@flordeutopia.pt To: user@struts.apache.org Subject: Re: Javascript proble in sx:civ in struts2 I don't have a definite answer, but just keep in mind that: - The Dojo plugin is deprecated, you might want to consider other ways of achieving the same thing. - For the ajax tags to work you have to include the head tag ( sx:head/ ). Please read: http://struts.apache.org/2.x/docs/ajax-tags.html http://struts.apache.org/2.x/docs/dojo-head.html http://struts.apache.org/2.x/docs/ajax.html SudhirJava, 17-09-2010 06:44: Hi, Please help me in the following issue. I have gone throgh some threads which have explained the same problem. But not able to solve this. So I need your help on this. Please provide me if you know the solution is explained clearly. I apoloigize if this a duplicate thread. The issue in Javascript is not working in the included page in sx:div. Below is the code In certification.jsp if I click on Edit link it is not calling the javascript function editCertification() I am using struts2-dojo-plugin-2.1.8.1.jar struts2-core-2.1.8.1.jar welcome.jsp -- sx:div id=two label=Tab 2 href=certificationLink.action preload=false executeScripts=true separateScripts=false /sx:div struts.xml -- action name=certificationLink class=com.lnt.pms.action.AddDeleteCertificationAction result name=success/pages/certification.jsp/result /action certification.jsp - script function editCertification(userCertificationId){ var url = editCertification.action?certificationId=+userCertificationId; var myAjax = new Ajax.Request( url, { method: 'post', onComplete: fetchSuccess } } function fetchSuccess(originalRequest){ var result = originalRequest.responseText.evalJSON(); document.getElementById(certificationName).value=result.certificationList[0].certificationName; } /script td class=nowraps:set id=userCertificationId value=userCertificationId / s:a href=javascript:editCertification('%{userCertificationId}') theme=xhtmlEdit/s:a /td Regards Sudhir sudhi...@... - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- View this message in context: http://old.nabble.com/Javascript-proble-in-sx%3Aciv-in-struts2-tp29735361p29756382.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Javascript proble in sx:civ in struts2
I don't have a definite answer, but just keep in mind that: - The Dojo plugin is deprecated, you might want to consider other ways of achieving the same thing. - For the ajax tags to work you have to include the head tag ( sx:head/ ). Please read: http://struts.apache.org/2.x/docs/ajax-tags.html http://struts.apache.org/2.x/docs/dojo-head.html http://struts.apache.org/2.x/docs/ajax.html SudhirJava, 17-09-2010 06:44: Hi, Please help me in the following issue. I have gone throgh some threads which have explained the same problem. But not able to solve this. So I need your help on this. Please provide me if you know the solution is explained clearly. I apoloigize if this a duplicate thread. The issue in Javascript is not working in the included page in sx:div. Below is the code In certification.jsp if I click on Edit link it is not calling the javascript function editCertification() I am using struts2-dojo-plugin-2.1.8.1.jar struts2-core-2.1.8.1.jar welcome.jsp -- sx:div id=two label=Tab 2 href=certificationLink.action preload=false executeScripts=true separateScripts=false /sx:div struts.xml -- action name=certificationLink class=com.lnt.pms.action.AddDeleteCertificationAction result name=success/pages/certification.jsp/result /action certification.jsp - script function editCertification(userCertificationId){ var url = editCertification.action?certificationId=+userCertificationId; var myAjax = new Ajax.Request( url, { method: 'post', onComplete: fetchSuccess } } function fetchSuccess(originalRequest){ var result = originalRequest.responseText.evalJSON(); document.getElementById(certificationName).value=result.certificationList[0].certificationName; } /script td class=nowraps:set id=userCertificationId value=userCertificationId / s:a href=javascript:editCertification('%{userCertificationId}') theme=xhtmlEdit/s:a /td Regards Sudhir sudhi...@... - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: Javascript proble in sx:civ in struts2
Good Advice struts anchor tag: href The URL to call to obtain the content. Note: If used with ajax context, the value must be set as an url tag value. --the javascript anchor alternative references struts-dojo-tags uri and allows a javascript handler as illustrated here: %@ taglib prefix=sx uri=/struts-dojo-tags % sx:a .. handler=JavaScriptFunction / Martin __ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Date: Fri, 17 Sep 2010 09:55:09 +0100 From: alo...@flordeutopia.pt To: user@struts.apache.org Subject: Re: Javascript proble in sx:civ in struts2 I don't have a definite answer, but just keep in mind that: - The Dojo plugin is deprecated, you might want to consider other ways of achieving the same thing. - For the ajax tags to work you have to include the head tag ( sx:head/ ). Please read: http://struts.apache.org/2.x/docs/ajax-tags.html http://struts.apache.org/2.x/docs/dojo-head.html http://struts.apache.org/2.x/docs/ajax.html SudhirJava, 17-09-2010 06:44: Hi, Please help me in the following issue. I have gone throgh some threads which have explained the same problem. But not able to solve this. So I need your help on this. Please provide me if you know the solution is explained clearly. I apoloigize if this a duplicate thread. The issue in Javascript is not working in the included page in sx:div. Below is the code In certification.jsp if I click on Edit link it is not calling the javascript function editCertification() I am using struts2-dojo-plugin-2.1.8.1.jar struts2-core-2.1.8.1.jar welcome.jsp -- sx:div id=two label=Tab 2 href=certificationLink.action preload=false executeScripts=true separateScripts=false /sx:div struts.xml -- action name=certificationLink class=com.lnt.pms.action.AddDeleteCertificationAction result name=success/pages/certification.jsp/result /action certification.jsp - script function editCertification(userCertificationId){ var url = editCertification.action?certificationId=+userCertificationId; var myAjax = new Ajax.Request( url, { method: 'post', onComplete: fetchSuccess } } function fetchSuccess(originalRequest){ var result = originalRequest.responseText.evalJSON(); document.getElementById(certificationName).value=result.certificationList[0].certificationName; } /script td class=nowraps:set id=userCertificationId value=userCertificationId / s:a href=javascript:editCertification('%{userCertificationId}') theme=xhtmlEdit/s:a /td Regards Sudhir sudhi...@... - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Javascript issues
Hey man, did u see the email i send? with my class and struts.xml?? tks - Original Message - From: JP Cafaro jcafar...@gmail.com To: Struts Users Mailing List user@struts.apache.org Sent: Monday, July 12, 2010 2:38 PM Subject: Re: Javascript issues I think the problem has to do with this line: script src=ajax-user-browser.js type=text/javascript / When I use firefox, and view the source, I can click on the link to ajax-user-browser.js and it can't find the resource. I think this is because it's under my WEB-INF directory. I moved ajax-user-browser.js to a folder js on the same level as WEB-INF and changed the line to: script src=../js/ajax-user-browser.js type=text/javascript / but it still doesn't work! Nothing shows up on the page. However when I view the source this time, I can click the link and I do see the code for the javascript. Please help! JP Cafaro wrote: I'm trying to incorporate some ajax stuff with struts2 but I'm running into problems. I have this action: public class AjaxUserBrowser extends ActionSupport { private ListUser users; public String execute() { System.out.println(AJAX USER BROWSER); setUsers(getPortfolioService().getUsers()); return SUCCESS; } public PortfolioService getPortfolioService( ){ return new PortfolioService(); } public void setUsers(ListUser users) { this.users = users; } public ListUser getUsers() { return users; } } It's very simple. It doesn't really do anything. Then I have this resulting jsp page: ?xml version=1.0 encoding=ISO-8859-1 ? %@ page language=java contentType=text/html; charset=ISO-8859-1 pageEncoding=ISO-8859-1% %@ taglib prefix=s uri=/struts-tags% !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / script src=ajax-user-browser.js type=text/javascript / titleTitle/title /head body h5Artist Browser Control/h5s:form action=AjaxRetrieveUser s:select name=username list='users' listKey=username listValue=username label=Select an artist value=defaultUsername onchange=fetchUser();/ /s:form hr/ h5Artist Information/h5 div id='console' pName: s:property value=defaultUser.firstName/ s:property value=defaultUser.lastName//p s:iterator value=defaultUser.portfolios pPortfolioName: s:property value=value.name //p /s:iterator /div /body /html When I click the link to the action, nothing appears on the resulting page. The action fires (print statement is printed) but no resulting page is shown. If I view the source, the html is right, and if I take out the script line, the page is shown but doesn't do anything obviously Here is the javascript file: var req=null; var console=null; var READY_STATE_UNINITIALIZED=0; var READY_STATE_LOADING=1; var READY_STATE_LOADED=2; var READY_STATE_INTERACTIVE=3; var READY_STATE_COMPLETE=4; function sendRequest ( url, params, HttpMethod ) { if ( !HttpMethod ){ HttpMethod=GET; } req=initXMLHTTPRequest();if ( req ) { req.onreadystatechange=onReadyState; req.open(HttpMethod, url, true ); req.setRequestHeader ( Content-Type, application/x-www-form-urlencoded); req.send (params); } } function initXMLHTTPRequest(){ var xRequest=null; if (window.XMLHttpRequest) { xRequest=new XMLHttpRequest(); } else if ( window.ActiveXObject ){ xRequest = new ActiveXObject(Microsoft.XMLHTTP); } return xRequest; } function onReadyState() { var ready=req.readyState; var jsonObject=null; if ( ready == READY_STATE_COMPLETE ){ jsonObject=eval( (+ req.responseText +) ); toFinalConsole ( jsonObject ); } } function toFinalConsole(jsonObject){ if (console!=null){ removeAllChildren ( console ); var div = document.createElement(p); var txt=document.createTextNode(Name: + jsonObject.artist.firstName + + jsonObject.artist.lastName ); div.appendChild ( txt ); console.appendChild(div); //mess of Javascript references because we didn't mediate the JSON interpretation of our maps, etc. var portfolios = jsonObject.artist.portfolios.entry; var portfolioCount = portfolios.length; for ( var index = 0; index portfolioCount; index++ ) { var portfolio = portfolios[index]; txt=document.createTextNode(Portfolio Name: + portfolio['string'] ); div = document.createElement(p); div.appendChild ( txt ); console.appendChild(div); } } } function removeAllChildren( node ){ var childCount = node.childNodes.length; for ( var count = 1; count = childCount; count++) { node.removeChild ( node.childNodes[0] ); } } function fetchUser() { console=document.getElementById('console'); var selectBox = document.getElementById
Re: Javascript issues
I think the problem has to do with this line: script src=ajax-user-browser.js type=text/javascript / When I use firefox, and view the source, I can click on the link to ajax-user-browser.js and it can't find the resource. I think this is because it's under my WEB-INF directory. I moved ajax-user-browser.js to a folder js on the same level as WEB-INF and changed the line to: script src=../js/ajax-user-browser.js type=text/javascript / but it still doesn't work! Nothing shows up on the page. However when I view the source this time, I can click the link and I do see the code for the javascript. Please help! JP Cafaro wrote: I'm trying to incorporate some ajax stuff with struts2 but I'm running into problems. I have this action: public class AjaxUserBrowser extends ActionSupport { private ListUser users; public String execute() { System.out.println(AJAX USER BROWSER); setUsers(getPortfolioService().getUsers()); return SUCCESS; } public PortfolioService getPortfolioService( ){ return new PortfolioService(); } public void setUsers(ListUser users) { this.users = users; } public ListUser getUsers() { return users; } } It's very simple. It doesn't really do anything. Then I have this resulting jsp page: ?xml version=1.0 encoding=ISO-8859-1 ? %@ page language=java contentType=text/html; charset=ISO-8859-1 pageEncoding=ISO-8859-1% %@ taglib prefix=s uri=/struts-tags% !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / script src=ajax-user-browser.js type=text/javascript / titleTitle/title /head body h5Artist Browser Control/h5s:form action=AjaxRetrieveUser s:select name=username list='users' listKey=username listValue=username label=Select an artist value=defaultUsername onchange=fetchUser();/ /s:form hr/ h5Artist Information/h5 div id='console' pName: s:property value=defaultUser.firstName/ s:property value=defaultUser.lastName//p s:iterator value=defaultUser.portfolios pPortfolioName: s:property value=value.name //p /s:iterator /div /body /html When I click the link to the action, nothing appears on the resulting page. The action fires (print statement is printed) but no resulting page is shown. If I view the source, the html is right, and if I take out the script line, the page is shown but doesn't do anything obviously Here is the javascript file: var req=null; var console=null; var READY_STATE_UNINITIALIZED=0; var READY_STATE_LOADING=1; var READY_STATE_LOADED=2; var READY_STATE_INTERACTIVE=3; var READY_STATE_COMPLETE=4; function sendRequest ( url, params, HttpMethod ) { if ( !HttpMethod ){ HttpMethod=GET; } req=initXMLHTTPRequest();if ( req ) { req.onreadystatechange=onReadyState; req.open(HttpMethod, url, true ); req.setRequestHeader ( Content-Type, application/x-www-form-urlencoded); req.send (params); } } function initXMLHTTPRequest(){ var xRequest=null; if (window.XMLHttpRequest) { xRequest=new XMLHttpRequest(); } else if ( window.ActiveXObject ){ xRequest = new ActiveXObject(Microsoft.XMLHTTP); } return xRequest; } function onReadyState() { var ready=req.readyState; var jsonObject=null; if ( ready == READY_STATE_COMPLETE ){ jsonObject=eval( (+ req.responseText +) ); toFinalConsole ( jsonObject ); } } function toFinalConsole(jsonObject){ if (console!=null){ removeAllChildren ( console ); var div = document.createElement(p); var txt=document.createTextNode(Name: + jsonObject.artist.firstName + + jsonObject.artist.lastName ); div.appendChild ( txt ); console.appendChild(div); //mess of Javascript references because we didn't mediate the JSON interpretation of our maps, etc. var portfolios = jsonObject.artist.portfolios.entry; var portfolioCount = portfolios.length; for ( var index = 0; index portfolioCount; index++ ) { var portfolio = portfolios[index]; txt=document.createTextNode(Portfolio Name: + portfolio['string'] ); div = document.createElement(p); div.appendChild ( txt ); console.appendChild(div); } } } function removeAllChildren( node ){ var childCount = node.childNodes.length; for ( var count = 1; count = childCount; count++) { node.removeChild ( node.childNodes[0] ); } } function fetchUser() { console=document.getElementById('console'); var selectBox = document.getElementById('AjaxRetrieveUser_username'); var selectedIndex = selectBox.selectedIndex; var selectedValue = selectBox.options[selectedIndex].value sendRequest(AjaxRetrieveUser.action, username= + selectedValue , POST); } Maybe there's an error in the
RE: Javascript issues
ajax controls allow asynchronous population of div tags..there needs to be some sort of notify/listener capability to triggger the listener to wakeup and populate the div tag when the event is being notified e.g. script type=text/javascript function handler(widget, node) { !-- go do something in the Action class and populate the Action bean -- alert('I will handle this myself!'); node.innerHTML = %{Action.Bean}%; //the contents of the div tag get populated here } /script s:url var=ajaxTest value=/AjaxTest.action / body !-- the handler sx:div id=once cssStyle=border: 1px solid yellow; martin --- Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Date: Mon, 12 Jul 2010 12:57:47 -0400 From: jcafar...@gmail.com To: user@struts.apache.org Subject: Javascript issues I'm trying to incorporate some ajax stuff with struts2 but I'm running into problems. I have this action: public class AjaxUserBrowser extends ActionSupport { private ListUser users; public String execute() { System.out.println(AJAX USER BROWSER); setUsers(getPortfolioService().getUsers()); return SUCCESS; } public PortfolioService getPortfolioService( ) { return new PortfolioService(); } public void setUsers(ListUser users) { this.users = users; } public ListUser getUsers() { return users; } } It's very simple. It doesn't really do anything. Then I have this resulting jsp page: ?xml version=1.0 encoding=ISO-8859-1 ? %@ page language=java contentType=text/html; charset=ISO-8859-1 pageEncoding=ISO-8859-1% %@ taglib prefix=s uri=/struts-tags% !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / script src=ajax-user-browser.js type=text/javascript / titleTitle/title /head body h5Artist Browser Control/h5 s:form action=AjaxRetrieveUser s:select name=username list='users' listKey=username listValue=username label=Select an artist value=defaultUsername onchange=fetchUser();/ /s:form hr/ h5Artist Information/h5 div id='console' pName: s:property value=defaultUser.firstName/ s:property value=defaultUser.lastName//p s:iterator value=defaultUser.portfolios pPortfolioName: s:property value=value.name //p /s:iterator /div /body /html When I click the link to the action, nothing appears on the resulting page. The action fires (print statement is printed) but no resulting page is shown. If I view the source, the html is right, and if I take out the script line, the page is shown but doesn't do anything obviously Here is the javascript file: var req=null; var console=null; var READY_STATE_UNINITIALIZED=0; var READY_STATE_LOADING=1; var READY_STATE_LOADED=2; var READY_STATE_INTERACTIVE=3; var READY_STATE_COMPLETE=4; function sendRequest ( url, params, HttpMethod ) { if ( !HttpMethod ){ HttpMethod=GET; } req=initXMLHTTPRequest(); if ( req ) { req.onreadystatechange=onReadyState; req.open(HttpMethod, url, true ); req.setRequestHeader ( Content-Type, application/x-www-form-urlencoded); req.send (params); } } function initXMLHTTPRequest(){ var xRequest=null; if (window.XMLHttpRequest) { xRequest=new XMLHttpRequest(); } else if ( window.ActiveXObject ){ xRequest = new ActiveXObject(Microsoft.XMLHTTP); } return xRequest; } function onReadyState() { var ready=req.readyState; var jsonObject=null; if ( ready == READY_STATE_COMPLETE ){ jsonObject=eval( (+ req.responseText +) ); toFinalConsole ( jsonObject ); } } function toFinalConsole(jsonObject){ if (console!=null){ removeAllChildren ( console ); var div = document.createElement(p); var txt=document.createTextNode(Name: + jsonObject.artist.firstName + + jsonObject.artist.lastName ); div.appendChild ( txt ); console.appendChild(div); //mess of Javascript references because
Re: Javascript issues
The problem was...stupid enough...not having a /script end tag. Apparently I can't type script / Martin Gainty wrote: ajax controls allow asynchronous population of div tags..there needs to be some sort of notify/listener capability to triggger the listener to wakeup and populate the div tag when the event is being notified e.g. script type=text/javascript function handler(widget, node) { !-- go do something in the Action class and populate the Action bean -- alert('I will handle this myself!'); node.innerHTML = %{Action.Bean}%; //the contents of the div tag get populated here } /script s:url var=ajaxTest value=/AjaxTest.action / body !-- the handler sx:div id=once cssStyle=border: 1px solid yellow; martin --- Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Date: Mon, 12 Jul 2010 12:57:47 -0400 From: jcafar...@gmail.com To: user@struts.apache.org Subject: Javascript issues I'm trying to incorporate some ajax stuff with struts2 but I'm running into problems. I have this action: public class AjaxUserBrowser extends ActionSupport { private ListUser users; public String execute() { System.out.println(AJAX USER BROWSER); setUsers(getPortfolioService().getUsers()); return SUCCESS; } public PortfolioService getPortfolioService( ) { return new PortfolioService(); } public void setUsers(ListUser users) { this.users = users; } public ListUser getUsers() { return users; } } It's very simple. It doesn't really do anything. Then I have this resulting jsp page: ?xml version=1.0 encoding=ISO-8859-1 ? %@ page language=java contentType=text/html; charset=ISO-8859-1 pageEncoding=ISO-8859-1% %@ taglib prefix=s uri=/struts-tags% !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / script src=ajax-user-browser.js type=text/javascript / titleTitle/title /head body h5Artist Browser Control/h5 s:form action=AjaxRetrieveUser s:select name=username list='users' listKey=username listValue=username label=Select an artist value=defaultUsername onchange=fetchUser();/ /s:form hr/ h5Artist Information/h5 div id='console' pName: s:property value=defaultUser.firstName/ s:property value=defaultUser.lastName//p s:iterator value=defaultUser.portfolios pPortfolioName: s:property value=value.name //p /s:iterator /div /body /html When I click the link to the action, nothing appears on the resulting page. The action fires (print statement is printed) but no resulting page is shown. If I view the source, the html is right, and if I take out the script line, the page is shown but doesn't do anything obviously Here is the javascript file: var req=null; var console=null; var READY_STATE_UNINITIALIZED=0; var READY_STATE_LOADING=1; var READY_STATE_LOADED=2; var READY_STATE_INTERACTIVE=3; var READY_STATE_COMPLETE=4; function sendRequest ( url, params, HttpMethod ) { if ( !HttpMethod ){ HttpMethod=GET; } req=initXMLHTTPRequest(); if ( req ) { req.onreadystatechange=onReadyState; req.open(HttpMethod, url, true ); req.setRequestHeader ( Content-Type, application/x-www-form-urlencoded); req.send (params); } } function initXMLHTTPRequest(){ var xRequest=null; if (window.XMLHttpRequest) { xRequest=new XMLHttpRequest(); } else if ( window.ActiveXObject ){ xRequest = new ActiveXObject(Microsoft.XMLHTTP); } return xRequest; } function onReadyState() { var ready=req.readyState; var jsonObject=null; if ( ready == READY_STATE_COMPLETE ){ jsonObject=eval( (+ req.responseText +) ); toFinalConsole ( jsonObject ); } } function toFinalConsole(jsonObject){ if (console!=null){ removeAllChildren ( console ); var div = document.createElement(p); var txt=document.createTextNode(Name: + jsonObject.artist.firstName + + jsonObject.artist.lastName ); div.appendChild ( txt ); console.appendChild(div); //mess of Javascript
Re: JavaScript / AJAX + Struts 2?
Here is the answer that I was provided used: 1. You can use the ${somethingFromTheValueStack} notation like so: onclick=onjavaScriptMethod('${value}'); I tried this but missed the ' marks because it's been so long since I did any JavaScript. I haven't tried this trick in an actual embedded script or script file. Just jsp's. Would be nice if it worked. Does anyone know if it does? 2. If you map the action to a jsp fragment, it can be placed in a div like so: //First you need to get the request handle some platform crap. var request = false; try { request = new XMLHttpRequest(); } catch (trymicrosoft) { try { request = new ActiveXObject(Msxml2.XMLHTTP); } catch (othermicrosoft) { try { request = new ActiveXObject(Microsoft.XMLHTTP); } catch (failed) { request = false; } } } if (!request) alert(Error initializing XMLHttpRequest!); //*** //Functions. //*** //Execute the action function checkSomething(string) { var url = string + /context/DoSomething.action; request.open(GET, url, true); request.onreadystatechange = updatePage(); request.send(null); } //Update the page. //Put the results in the div display. //Note there are two div tags. One is for results and the other for processing messages like Loading function updatePage() { var d = document.getElementById(divResults); d.innerHTML = 'Loading...'; var d1 = document.getElementById(divProcessing); d1.style.display=block; if (request.readyState == 4) d.innerHTML = request.responseText ; d1.style.display=none; } On Thu, Dec 17, 2009 at 5:11 AM, Jim Collings jlistn...@gmail.com wrote: So I have two actions and one jsp. The idea is that one is for the entire page and another is for putting into a div via a JavaScript method. Question: How do I get items off of the value stack for use in JavaScript? Jim C. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: JavaScript / AJAX + Struts 2?
On Fri, Dec 18, 2009 at 6:37 AM, Jim Collings jlistn...@gmail.com wrote: Here is the answer that I was provided used: 1. You can use the ${somethingFromTheValueStack} notation like so: onclick=onjavaScriptMethod('${value}'); I tried this but missed the ' marks because it's been so long since I did any JavaScript. I haven't tried this trick in an actual embedded script or script file. Just jsp's. Would be nice if it worked. Does anyone know if it does? It'll work fine in script tags embedded in your jsp, but it won't work in external script files. -Brian
Re: JavaScript / AJAX + Struts 2?
Hi Jim, action is on server side and javascript is on browser side, they don't interact, You can generate js server side but that's it. Js will be run in browser so it has no access to stack or action variables. Best greetings, Paweł Wielgus. 2009/12/17 Jim Collings jlistn...@gmail.com: So I have two actions and one jsp. The idea is that one is for the entire page and another is for putting into a div via a JavaScript method. Question: How do I get items off of the value stack for use in JavaScript? Jim C. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: JavaScript / AJAX + Struts 2?
So it's impossible? JavaScript and Struts 2 don't interact at all? What good is Struts 2 then? 2009/12/17 Paweł Wielgus poulw...@gmail.com: Hi Jim, action is on server side and javascript is on browser side, they don't interact, You can generate js server side but that's it. Js will be run in browser so it has no access to stack or action variables. Best greetings, Paweł Wielgus. 2009/12/17 Jim Collings jlistn...@gmail.com: So I have two actions and one jsp. The idea is that one is for the entire page and another is for putting into a div via a JavaScript method. Question: How do I get items off of the value stack for use in JavaScript? Jim C. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: JavaScript / AJAX + Struts 2?
Pawel, I am doing something like shown below and it works good for me. Isn't it calling the values from model/stack value from java script? zipCodes is in my model. Please tell me ur option. that would help me underst it better. I am using struts 2.1.6. Thanks. function showmylist() { var myList = 's:property value=zipCodes/'; var seletedzipcodelist = new Array(); seletedzipcodelist = myList.split(,); if (seletedzipcodelist != null seletedzipcodelist != ) { for (i in seletedzipcodelist) { document.getElementById(seletedzipcodelist[i]).className = showzip; } } document.getElementById(something).value = 's:property value=NewDate/'; } 2009/12/17 Paweł Wielgus poulw...@gmail.com Hi Jim, action is on server side and javascript is on browser side, they don't interact, You can generate js server side but that's it. Js will be run in browser so it has no access to stack or action variables. Best greetings, Paweł Wielgus. 2009/12/17 Jim Collings jlistn...@gmail.com: So I have two actions and one jsp. The idea is that one is for the entire page and another is for putting into a div via a JavaScript method. Question: How do I get items off of the value stack for use in JavaScript? Jim C. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: JavaScript / AJAX + Struts 2?
Bwuh? Just because your fridge doesn't have a built-in toaster, it's worthless? Struts is helpful for stuff you'd want to do on the server side. An easy way to make stuff from the value stack available in javascript is to do this in the jsp: script type=text/javascript var foo = s:property value=%{foo}/; //int, boolean, etc. var bar = 's:property value=%{bar}/'; //string var bat = 's:property value=%{foo.bat}/'; //string retrieved by foo.getBat() //javascript logic goes here /script Hope that helps, -Brian On Thu, Dec 17, 2009 at 8:33 AM, Jim Collings jlistn...@gmail.com wrote: So it's impossible? JavaScript and Struts 2 don't interact at all? What good is Struts 2 then? 2009/12/17 Paweł Wielgus poulw...@gmail.com: Hi Jim, action is on server side and javascript is on browser side, they don't interact, You can generate js server side but that's it. Js will be run in browser so it has no access to stack or action variables. Best greetings, Paweł Wielgus. 2009/12/17 Jim Collings jlistn...@gmail.com: So I have two actions and one jsp. The idea is that one is for the entire page and another is for putting into a div via a JavaScript method. Question: How do I get items off of the value stack for use in JavaScript? Jim C. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: JavaScript / AJAX + Struts 2?
You can use the action to get data from server to display in the div thru JS. e.g., in your jsp, user selects a dropdown element of country name, then it will get the state/province names data to be displayed in the div. You can invoke an action for the dropdown value-change event to get the data back (such as return null in the action) , then you can use ajax object api to catch the data for JS to display into div. This is hand coding it. If you use an ajax enabled tag framework, you don't need to code to this details -of course you may have to set properties instead. John Feng On Thu, Dec 17, 2009 at 5:11 AM, Jim Collings jlistn...@gmail.com wrote: So I have two actions and one jsp. The idea is that one is for the entire page and another is for putting into a div via a JavaScript method. Question: How do I get items off of the value stack for use in JavaScript? Jim C. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: JavaScript / AJAX + Struts 2?
Hello Jim, if you like to use AJAX with struts2 take a look at the build in dojo plugin or to one of the other (jquery, yui) plugins you can found in the Plugin Registry. http://cwiki.apache.org/S2PLUGINS/home.html Best Regards Johannes Geppert jcllings wrote: So I have two actions and one jsp. The idea is that one is for the entire page and another is for putting into a div via a JavaScript method. Question: How do I get items off of the value stack for use in JavaScript? Jim C. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - --- web: http://www.jgeppert.com twitter: http://twitter.com/jogep -- View this message in context: http://old.nabble.com/JavaScript---AJAX-%2B-Struts-2--tp26825831p26829058.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: JavaScript / AJAX + Struts 2?
Hi James, the code You have shown is generating java script on server side, and then on browser side you run it in browser. For example You can't do this: var myList = 's:property value=zipCodes/'; myList.toUpperCase(); and expect that on server side inside action, zipCodes variable is updated with new uppereCased value. Also there is nothing bad in generating js on server side, i do it all the time. It's just worth knowing that server != browser in terms of execution space. Best greetings, Paweł Wielgus. 2009/12/17 james billa jambi...@gmail.com: Pawel, I am doing something like shown below and it works good for me. Isn't it calling the values from model/stack value from java script? zipCodes is in my model. Please tell me ur option. that would help me underst it better. I am using struts 2.1.6. Thanks. function showmylist() { var myList = 's:property value=zipCodes/'; var seletedzipcodelist = new Array(); seletedzipcodelist = myList.split(,); if (seletedzipcodelist != null seletedzipcodelist != ) { for (i in seletedzipcodelist) { document.getElementById(seletedzipcodelist[i]).className = showzip; } } document.getElementById(something).value = 's:property value=NewDate/'; } 2009/12/17 Paweł Wielgus poulw...@gmail.com Hi Jim, action is on server side and javascript is on browser side, they don't interact, You can generate js server side but that's it. Js will be run in browser so it has no access to stack or action variables. Best greetings, Paweł Wielgus. 2009/12/17 Jim Collings jlistn...@gmail.com: So I have two actions and one jsp. The idea is that one is for the entire page and another is for putting into a div via a JavaScript method. Question: How do I get items off of the value stack for use in JavaScript? Jim C. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: JavaScript / AJAX + Struts 2?
Hi Brian, have You tried running this code? i have a doubt about: foo.getBat() line. As far as i know it will not work. Also line: var foo = s:property value=%{foo}/; //int, boolean, etc. will not work too. Best greetings, Paweł Wielgus. 2009/12/17 Brian Thompson elephant...@gmail.com: Bwuh? Just because your fridge doesn't have a built-in toaster, it's worthless? Struts is helpful for stuff you'd want to do on the server side. An easy way to make stuff from the value stack available in javascript is to do this in the jsp: script type=text/javascript var foo = s:property value=%{foo}/; //int, boolean, etc. var bar = 's:property value=%{bar}/'; //string var bat = 's:property value=%{foo.bat}/'; //string retrieved by foo.getBat() //javascript logic goes here /script Hope that helps, -Brian On Thu, Dec 17, 2009 at 8:33 AM, Jim Collings jlistn...@gmail.com wrote: So it's impossible? JavaScript and Struts 2 don't interact at all? What good is Struts 2 then? 2009/12/17 Paweł Wielgus poulw...@gmail.com: Hi Jim, action is on server side and javascript is on browser side, they don't interact, You can generate js server side but that's it. Js will be run in browser so it has no access to stack or action variables. Best greetings, Paweł Wielgus. 2009/12/17 Jim Collings jlistn...@gmail.com: So I have two actions and one jsp. The idea is that one is for the entire page and another is for putting into a div via a JavaScript method. Question: How do I get items off of the value stack for use in JavaScript? Jim C. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: JavaScript / AJAX + Struts 2?
TBH, I just wrote it as a quick off the top of my head example. The basic structure is sound, though -- I did that sort of thing all the time in my struts project earlier this year. What do you think is wrong with it? n.b. foo.getBat() does not belong on its own line - it's part of the //string retrieved... comment. -Brian 2009/12/17 Paweł Wielgus poulw...@gmail.com Hi Brian, have You tried running this code? i have a doubt about: foo.getBat() line. As far as i know it will not work. Also line: var foo = s:property value=%{foo}/; //int, boolean, etc. will not work too. Best greetings, Paweł Wielgus. 2009/12/17 Brian Thompson elephant...@gmail.com: Bwuh? Just because your fridge doesn't have a built-in toaster, it's worthless? Struts is helpful for stuff you'd want to do on the server side. An easy way to make stuff from the value stack available in javascript is to do this in the jsp: script type=text/javascript var foo = s:property value=%{foo}/; //int, boolean, etc. var bar = 's:property value=%{bar}/'; //string var bat = 's:property value=%{foo.bat}/'; //string retrieved by foo.getBat() //javascript logic goes here /script Hope that helps, -Brian On Thu, Dec 17, 2009 at 8:33 AM, Jim Collings jlistn...@gmail.com wrote: So it's impossible? JavaScript and Struts 2 don't interact at all? What good is Struts 2 then? 2009/12/17 Paweł Wielgus poulw...@gmail.com: Hi Jim, action is on server side and javascript is on browser side, they don't interact, You can generate js server side but that's it. Js will be run in browser so it has no access to stack or action variables. Best greetings, Paweł Wielgus. 2009/12/17 Jim Collings jlistn...@gmail.com: So I have two actions and one jsp. The idea is that one is for the entire page and another is for putting into a div via a JavaScript method. Question: How do I get items off of the value stack for use in JavaScript? Jim C. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: JavaScript / AJAX + Struts 2?
Hi Brian, i din't notice that it is a continuation of comment, so You are wright. As for first assignement, there are no ' or chars around scriptlet so it will not work because most probably there is no variable named as the foo's toString value. Second and third assignement has them an will work. Best greetings, Pawel Wielgus. 2009/12/17, Brian Thompson elephant...@gmail.com: TBH, I just wrote it as a quick off the top of my head example. The basic structure is sound, though -- I did that sort of thing all the time in my struts project earlier this year. What do you think is wrong with it? n.b. foo.getBat() does not belong on its own line - it's part of the //string retrieved... comment. -Brian 2009/12/17 Paweł Wielgus poulw...@gmail.com Hi Brian, have You tried running this code? i have a doubt about: foo.getBat() line. As far as i know it will not work. Also line: var foo = s:property value=%{foo}/; //int, boolean, etc. will not work too. Best greetings, Paweł Wielgus. 2009/12/17 Brian Thompson elephant...@gmail.com: Bwuh? Just because your fridge doesn't have a built-in toaster, it's worthless? Struts is helpful for stuff you'd want to do on the server side. An easy way to make stuff from the value stack available in javascript is to do this in the jsp: script type=text/javascript var foo = s:property value=%{foo}/; //int, boolean, etc. var bar = 's:property value=%{bar}/'; //string var bat = 's:property value=%{foo.bat}/'; //string retrieved by foo.getBat() //javascript logic goes here /script Hope that helps, -Brian On Thu, Dec 17, 2009 at 8:33 AM, Jim Collings jlistn...@gmail.com wrote: So it's impossible? JavaScript and Struts 2 don't interact at all? What good is Struts 2 then? 2009/12/17 Paweł Wielgus poulw...@gmail.com: Hi Jim, action is on server side and javascript is on browser side, they don't interact, You can generate js server side but that's it. Js will be run in browser so it has no access to stack or action variables. Best greetings, Paweł Wielgus. 2009/12/17 Jim Collings jlistn...@gmail.com: So I have two actions and one jsp. The idea is that one is for the entire page and another is for putting into a div via a JavaScript method. Question: How do I get items off of the value stack for use in JavaScript? Jim C. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: JavaScript / AJAX + Struts 2?
In context of the other two examples, you're right; I should have used something like var foo = s:property value=%{foo.foobar}/; //int, boolean, etc. instead to be more clear. The lack of quotes was deliberate, though ... you wouldn't want to quote a numeric value when you're setting it up that way. -Brian 2009/12/17 Paweł Wielgus poulw...@gmail.com Hi Brian, i din't notice that it is a continuation of comment, so You are wright. As for first assignement, there are no ' or chars around scriptlet so it will not work because most probably there is no variable named as the foo's toString value. Second and third assignement has them an will work. Best greetings, Pawel Wielgus. 2009/12/17, Brian Thompson elephant...@gmail.com: TBH, I just wrote it as a quick off the top of my head example. The basic structure is sound, though -- I did that sort of thing all the time in my struts project earlier this year. What do you think is wrong with it? n.b. foo.getBat() does not belong on its own line - it's part of the //string retrieved... comment. -Brian 2009/12/17 Paweł Wielgus poulw...@gmail.com Hi Brian, have You tried running this code? i have a doubt about: foo.getBat() line. As far as i know it will not work. Also line: var foo = s:property value=%{foo}/; //int, boolean, etc. will not work too. Best greetings, Paweł Wielgus. 2009/12/17 Brian Thompson elephant...@gmail.com: Bwuh? Just because your fridge doesn't have a built-in toaster, it's worthless? Struts is helpful for stuff you'd want to do on the server side. An easy way to make stuff from the value stack available in javascript is to do this in the jsp: script type=text/javascript var foo = s:property value=%{foo}/; //int, boolean, etc. var bar = 's:property value=%{bar}/'; //string var bat = 's:property value=%{foo.bat}/'; //string retrieved by foo.getBat() //javascript logic goes here /script Hope that helps, -Brian On Thu, Dec 17, 2009 at 8:33 AM, Jim Collings jlistn...@gmail.com wrote: So it's impossible? JavaScript and Struts 2 don't interact at all? What good is Struts 2 then? 2009/12/17 Paweł Wielgus poulw...@gmail.com: Hi Jim, action is on server side and javascript is on browser side, they don't interact, You can generate js server side but that's it. Js will be run in browser so it has no access to stack or action variables. Best greetings, Paweł Wielgus. 2009/12/17 Jim Collings jlistn...@gmail.com: So I have two actions and one jsp. The idea is that one is for the entire page and another is for putting into a div via a JavaScript method. Question: How do I get items off of the value stack for use in JavaScript? Jim C. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: JavaScript / AJAX + Struts 2?
I like how code is declared #fail because there probably is not a toString method. lawl. Please do not be distractedBrian's code was a perfectly good example. Brian Thompson-5 wrote: In context of the other two examples, you're right; I should have used something like var foo = s:property value=%{foo.foobar}/; //int, boolean, etc. instead to be more clear. The lack of quotes was deliberate, though ... you wouldn't want to quote a numeric value when you're setting it up that way. -Brian 2009/12/17 Paweł Wielgus poulw...@gmail.com Hi Brian, i din't notice that it is a continuation of comment, so You are wright. As for first assignement, there are no ' or chars around scriptlet so it will not work because most probably there is no variable named as the foo's toString value. Second and third assignement has them an will work. Best greetings, Pawel Wielgus. 2009/12/17, Brian Thompson elephant...@gmail.com: TBH, I just wrote it as a quick off the top of my head example. The basic structure is sound, though -- I did that sort of thing all the time in my struts project earlier this year. What do you think is wrong with it? n.b. foo.getBat() does not belong on its own line - it's part of the //string retrieved... comment. -Brian 2009/12/17 Paweł Wielgus poulw...@gmail.com Hi Brian, have You tried running this code? i have a doubt about: foo.getBat() line. As far as i know it will not work. Also line: var foo = s:property value=%{foo}/; //int, boolean, etc. will not work too. Best greetings, Paweł Wielgus. 2009/12/17 Brian Thompson elephant...@gmail.com: Bwuh? Just because your fridge doesn't have a built-in toaster, it's worthless? Struts is helpful for stuff you'd want to do on the server side. An easy way to make stuff from the value stack available in javascript is to do this in the jsp: script type=text/javascript var foo = s:property value=%{foo}/; //int, boolean, etc. var bar = 's:property value=%{bar}/'; //string var bat = 's:property value=%{foo.bat}/'; //string retrieved by foo.getBat() //javascript logic goes here /script Hope that helps, -Brian On Thu, Dec 17, 2009 at 8:33 AM, Jim Collings jlistn...@gmail.com wrote: So it's impossible? JavaScript and Struts 2 don't interact at all? What good is Struts 2 then? 2009/12/17 Paweł Wielgus poulw...@gmail.com: Hi Jim, action is on server side and javascript is on browser side, they don't interact, You can generate js server side but that's it. Js will be run in browser so it has no access to stack or action variables. Best greetings, Paweł Wielgus. 2009/12/17 Jim Collings jlistn...@gmail.com: So I have two actions and one jsp. The idea is that one is for the entire page and another is for putting into a div via a JavaScript method. Question: How do I get items off of the value stack for use in JavaScript? Jim C. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- View this message in context: http://old.nabble.com/JavaScript---AJAX-%2B-Struts-2--tp26825831p26838826.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: JavaScript / AJAX + Struts 2?
Thanks :) Oh, and to the OP ... my (somewhat sloppy) pseudocode is only one way to do it. You could also set up Ajax calls to get data in JSON format from the server. It's simpler to start out by writing javascript values for whatever you need from the value stack, though. -Brian On Thu, Dec 17, 2009 at 10:05 PM, dusty dustin_pea...@yahoo.com wrote: I like how code is declared #fail because there probably is not a toString method. lawl. Please do not be distractedBrian's code was a perfectly good example. Brian Thompson-5 wrote: In context of the other two examples, you're right; I should have used something like var foo = s:property value=%{foo.foobar}/; //int, boolean, etc. instead to be more clear. The lack of quotes was deliberate, though ... you wouldn't want to quote a numeric value when you're setting it up that way. -Brian 2009/12/17 Paweł Wielgus poulw...@gmail.com Hi Brian, i din't notice that it is a continuation of comment, so You are wright. As for first assignement, there are no ' or chars around scriptlet so it will not work because most probably there is no variable named as the foo's toString value. Second and third assignement has them an will work. Best greetings, Pawel Wielgus. 2009/12/17, Brian Thompson elephant...@gmail.com: TBH, I just wrote it as a quick off the top of my head example. The basic structure is sound, though -- I did that sort of thing all the time in my struts project earlier this year. What do you think is wrong with it? n.b. foo.getBat() does not belong on its own line - it's part of the //string retrieved... comment. -Brian 2009/12/17 Paweł Wielgus poulw...@gmail.com Hi Brian, have You tried running this code? i have a doubt about: foo.getBat() line. As far as i know it will not work. Also line: var foo = s:property value=%{foo}/; //int, boolean, etc. will not work too. Best greetings, Paweł Wielgus. 2009/12/17 Brian Thompson elephant...@gmail.com: Bwuh? Just because your fridge doesn't have a built-in toaster, it's worthless? Struts is helpful for stuff you'd want to do on the server side. An easy way to make stuff from the value stack available in javascript is to do this in the jsp: script type=text/javascript var foo = s:property value=%{foo}/; //int, boolean, etc. var bar = 's:property value=%{bar}/'; //string var bat = 's:property value=%{foo.bat}/'; //string retrieved by foo.getBat() //javascript logic goes here /script Hope that helps, -Brian On Thu, Dec 17, 2009 at 8:33 AM, Jim Collings jlistn...@gmail.com wrote: So it's impossible? JavaScript and Struts 2 don't interact at all? What good is Struts 2 then? 2009/12/17 Paweł Wielgus poulw...@gmail.com: Hi Jim, action is on server side and javascript is on browser side, they don't interact, You can generate js server side but that's it. Js will be run in browser so it has no access to stack or action variables. Best greetings, Paweł Wielgus. 2009/12/17 Jim Collings jlistn...@gmail.com: So I have two actions and one jsp. The idea is that one is for the entire page and another is for putting into a div via a JavaScript method. Question: How do I get items off of the value stack for use in JavaScript? Jim C. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org -- View this message in context: http://old.nabble.com/JavaScript---AJAX-%2B-Struts-2--tp26825831p26838826.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional
Re: Javascript CSS obfuscator and packing
Use packtag. David Canos wrote: Hi guys I'm looking for a plugin or a lib that packs my Javascript and CSS in everydeploy, Google gives nothing useful. if there's nothing done I would be happy to do it but I cant do it alone. -- View this message in context: http://www.nabble.com/Javascript---CSS-obfuscator-and-packing-tp23665810p23741235.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Javascript CSS obfuscator and packing
So what you mean is you want the process to be automated?just as if you press Ctrl+b in Eclipse, its compiles your .java to .class? but instead turns your .js to .min.js? or are you simply looking for something to obfuscate your scripts?
Re: Javascript CSS obfuscator and packing
yes, an automated way. And also mix all js file into one only. 2009/5/22 Steven Yang kenshin...@gmail.com So what you mean is you want the process to be automated?just as if you press Ctrl+b in Eclipse, its compiles your .java to .class? but instead turns your .js to .min.js? or are you simply looking for something to obfuscate your scripts?
Re: Javascript CSS obfuscator and packing
David Canos wrote: yes, an automated way. And also mix all js file into one only. http://lmgtfy.com/?q=jsmin -Dale - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Javascript CSS obfuscator and packing
Hi Dale, what a great site :-) Sweet. Best greetings, Paweł Wielgus. 2009/5/22 Dale Newfield d...@newfield.org: David Canos wrote: yes, an automated way. And also mix all js file into one only. http://lmgtfy.com/?q=jsmin -Dale - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: javascript in returned jsp through xhr
---BeginMessage--- Dear Gainty, vielen Dank for your reply. I am very sorry but I cant supply you with a url. What I load into the div is the following: %@ include file=/common/taglibs.jsp% s:form id=traitForm method=post s:textfield id=form_start theme=xhtml cssClass=text medium / button id=button_start type=button class=button../button s:submit key=button.next / /s:form script type=text/javascript src=c:url value='/scripts/prototype.js'//script script type=text/javascript src=${ctx}/scripts/calendar/calendar.js/script script type=text/javascript src=${ctx}/scripts/calendar/calendar-setup.js/script script type=text/javascript src=${ctx}/scripts/calendar/lang/calendar-${pageContext.request.locale}.js/script script type=text/javascript Form.focusFirstElement(document.forms[traitForm]); Calendar.setup( { inputField : form_start, // id of the input field //ifFormat: %m/%d/%Y, // the date format ifFormat: Calendar._TT['TT_DATE_TIME_FORMAT'], showsTime : true, singleClick : false, button : button_start// id of the button } ); /script I use the following technique to load it into the div: s:form id=form_TraitPage action=selectTraitPage namespace=/ method=post s:radio list=traits listValue=getText(class.name) listKey=class.name name=traitType / s:submit id=submitSelectTratiPage theme=ajax targets=traitDiv / /s:form s:div id=traitDiv theme=ajax cssStyle=width: 100%; loadingText=getText('Loading') /s:div The selectTraitPage-action returns the jsp with the jcalender. The problem is, that clicking the button than does not result in a calendar view. I can use it when loaded not in the div. I simply dont know why and are very grateful for your help. I believe its a matter, that the imported calender.js and/or prototype.js (which is needed for the calendar) can bind to the button!? So it fails. Thx, Henning Martin Gainty schrieb: can you supply the URL (which delivers the content..) and we can test it here %@ taglib prefix=sx uri=/struts-dojo-tags % head sx:head debug=true extraLocales=de-de/ /head body sx:div href=http://kropp.de/test;Initial Content/sx:div /body /html Vielen Danke, Martin __ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. Date: Sat, 16 Aug 2008 22:41:09 +0200 From: [EMAIL PROTECTED] To: user@struts.apache.org Subject: javascript in returned jsp through xhr Hi, I am a little stuck here. A action loads a jsp into a div. For this I use the ajax theme (dojo) and a form submit with target. Works fine. The Problem ist, that the jsp returned by the action has javascript in it. Its the jcalendar. Having this jsp load normally the calendar works fine, but not in div. To solve this I tried executeScripts option, but that did not work. I searched and found out that eval might help, but I simply dont know how this could help. Any hints would be greatly appreciated. Many thanks in advanced! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Talk to your Yahoo! Friends via Windows Live Messenger. Find Out How http://www.windowslive.com/explore/messenger?ocid=TXT_TAGLM_WL_messenger_yahoo_082008 ---End Message--- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javascript in returned jsp through xhr
talking about XHR anyone have success a JSON send and request? the idea is to make S2 as the JSON RPC implementation anyone F - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javascript in returned jsp through xhr
Kropp, Henning wrote: Hi, I am a little stuck here. A action loads a jsp into a div. For this I use the ajax theme (dojo) and a form submit with target. Works fine. The Problem ist, that the jsp returned by the action has javascript in it. Its the jcalendar. Having this jsp load normally the calendar works fine, but not in div. To solve this I tried executeScripts option, but that did not work. I searched and found out that eval might help, but I simply dont know how this could help. Any hints would be greatly appreciated. Many thanks in advanced! Ensure separateScripts is also true. Cut back the javascript to the bare minmial first (eg. an alert). A lot of javascript has problems in this scenario because it assumes the DOM is complete or won't change before it's executed. I think dojo updates the DOM, the executes discovered scripts, but in some browsers you can get race conditions. eg. calls getElementById before that element exists properly (eg. exists and all its content exists). The best approach is to use a listener that initialises the javascript calendar only after it's certain the DOM is up-to-date, rather than using inline javascript in the result.. Hope that helps. Jeromy Evans - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javascript in returned jsp through xhr
Somewhat on-topic: we should really figure this out, enumerate go/no-go use-cases, and write something up, since it comes up pretty frequently--I was never able to reproduce that JIRA issue around this, but I'd sure like to put this issue to rest w/ an easily-spewable wiki page. Dave --- On Sat, 8/16/08, Jeromy Evans wrote: From: Jeromy Evans [EMAIL PROTECTED] Subject: Re: javascript in returned jsp through xhr To: Struts Users Mailing List user@struts.apache.org Date: Saturday, August 16, 2008, 10:35 PM Kropp, Henning wrote: Hi, I am a little stuck here. A action loads a jsp into a div. For this I use the ajax theme (dojo) and a form submit with target. Works fine. The Problem ist, that the jsp returned by the action has javascript in it. Its the jcalendar. Having this jsp load normally the calendar works fine, but not in div. To solve this I tried executeScripts option, but that did not work. I searched and found out that eval might help, but I simply dont know how this could help. Any hints would be greatly appreciated. Many thanks in advanced! Ensure separateScripts is also true. Cut back the javascript to the bare minmial first (eg. an alert). A lot of javascript has problems in this scenario because it assumes the DOM is complete or won't change before it's executed. I think dojo updates the DOM, the executes discovered scripts, but in some browsers you can get race conditions. eg. calls getElementById before that element exists properly (eg. exists and all its content exists). The best approach is to use a listener that initialises the javascript calendar only after it's certain the DOM is up-to-date, rather than using inline javascript in the result.. Hope that helps. Jeromy Evans - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javascript in returned jsp through xhr
Dave Newton wrote: Somewhat on-topic: we should really figure this out, enumerate go/no-go use-cases, and write something up, since it comes up pretty frequently--I was never able to reproduce that JIRA issue around this, but I'd sure like to put this issue to rest w/ an easily-spewable wiki page. Dave Agreed! I can't reproduce the JIRA issue either. It works for me...except in cases where it's obvious it can't work. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Javascript validation error
It should be rendered just before your validations, it's called Static JavaScript [1], check if you has it. [1] http://struts.apache.org/1.3.8/struts-taglib/tagreference.html#html:javascript Regards -- Lukasz http://www.lenart.org.pl/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Javascript error using struts select tag
Since html:submit doesn't emit any Javascrip, the error has to be in your custom Javascript code. That came through somewhat unreadably formatted, though, and you didn't include its dependencies so it's tough to debug from here... I would strongly recommend installing Firefox + Firebug and stepping through your code in the debugger to figure out the problem. L. Joe Yuen wrote: I am trying to use the html:select tag in my jsp page but am getting the following javascript error, Microsoft JScript runtime error: Object expected. In my jsp page I have: table align=left class=tableGold tr th align=left bgcolor=#EEE8AAfont size=-1 color=#ff*/fontbean:message key=table.head.category//th /tr tr td align=center valign=middle div div style={float: left;} html:select styleId=category property=devicecategoryid onchange=selectDevOrStent() html:option value=bean:message key=select.list.device.category//html:option html:options collection=DeviceCategory property=id labelProperty=description/ /html:select /div div id=otherdev style={float: left; display: none; font-family: Arial, Helvetica, sans-serif; font-size: xx-small; vertical-align: middle; padding-left: 50px; line-height: 1.2em} html:text property=other size=35 maxlength=60 onfocus=clearOther() value = Enter Device Description / /div /div /td /tr /table Here is the javascript funtion that is called when a onchange event is detected: function selectDevOrStent(){ alert(In SelectDevOrStent); var category = id(category).options[id(category).selectedIndex].value; var categoryText = id(category).options[id(category).selectedIndex].text; //alert(categoryText = + categoryText); if(categoryText == 'Stents'){ //alert(Stent selected); id(stent).style.display = block; id(dev).style.display = none; id(otherdev).style.display = none; getSelectList(category, StentManufacturerSelect.do, stentmanufcallback); }else if(categoryText == 'Joint Replacement'){ //alert(Joint Replacement selected); document.DeviceInputForm.devicetypeid.disabled='true'; document.DeviceInputForm.manufacturer.disabled='true'; document.DeviceInputForm.modelnumber.disabled='true'; getSelectList(category, DeviceLocationSelect.do?devicecategoryid= + escape(id(category).value), locationcallback); id(dev).style.display = block; id(stent).style.display = none; id(otherdev).style.display = none; }else if(categoryText == 'Other'){ //alert(Other selected); id(otherdev).style.display = block; id(stent).style.display = none; id(dev).style.display = none; }else{ //alert(Stent not selected); id(stent).style.display = none; id(dev).style.display = block; id(otherdev).style.display = none; getSelectList(category, DeviceTypeSelect.do?devicecategoryid= + escape(id(category).value), devicecallback); } } Everything is fine, I can see the select box and all the options are there but when I trigger a onchange event I get the error. Can anyone see what I am doing wrong? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Javascript issue encountered with s:optiontransferselect
Hello, Do the tag is in a div loaded in AJAX ? If you load the tag s:optiontransferselect in a ajax div, js will not be included. In this case try with this : script language=javascript src=./struts/optiontransferselect.js/script Julien -Message d'origine- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Envoyé : vendredi 15 février 2008 15:15 À : user@struts.apache.org Objet : Javascript issue encountered with s:optiontransferselect Hi all, I am facing a particular problem, and I didn't find help on the web so I'm turning myself to you. I use in my Struts 2 application the UI tag s:optiontransferselect. The parameters work fine and everything's displayed correctly on the screen. Nevertheless, the buttons just don't work. Nothing happens and I get a javascript error each time I hit those buttons, saying that a javascript function is undefined (the function corresponding to the buttons : moveSelectedOptions, moveAllOptions ...). In my head tag, I have included the ajax theme (s:head theme=ajax debug=true/), which gives me this in my final page: link rel=stylesheet href=/roadbook/struts/xhtml/styles.css type=text/css/ script type=text/javascript // Dojo configuration djConfig = { baseRelativePath: /roadbook/struts/dojo, isDebug: true, bindEncoding: UTF-8, debugAtAllCosts: true // not needed, but allows the Venkman debugger to work with the includes }; /script script type=text/javascript src=/roadbook/struts/dojo/dojo.js/script script type=text/javascript src=/roadbook/struts/simple/dojoRequire.js/scriptscript type=text/javascript src=/roadbook/struts/ajax/dojoRequire.js/script script type=text/javascript src=/roadbook/struts/CommonFunctions.js/script I think I might have a lacking js file, where the optiontranserselect javascript methods may be ... Any ideas ? regards, Matthieu This message and any attachments (the message) is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. The internet can not guarantee the integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will) not therefore be liable for the message if modified. Do not print this message unless it is necessary, consider the environment. - Ce message et toutes les pieces jointes (ci-apres le message) sont etablis a l'intention exclusive de ses destinataires et sont confidentiels. Si vous recevez ce message par erreur, merci de le detruire et d'en avertir immediatement l'expediteur. Toute utilisation de ce message non conforme a sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. L'internet ne permettant pas d'assurer l'integrite de ce message, BNP PARIBAS (et ses filiales) decline(nt) toute responsabilite au titre de ce message, dans l'hypothese ou il aurait ete modifie. N'imprimez ce message que si necessaire, pensez a l'environnement. This e-mail, any attachments and the information contained therein (this message) are confidential and intended solely for the use of the addressee(s). If you have received this message in error please send it back to the sender and delete it. Unauthorized publication, use, dissemination or disclosure of this message, either in whole or in part is strictly prohibited. -- Ce message électronique et tous les fichiers joints ainsi que les informations contenues dans ce message ( ci après le message ), sont confidentiels et destinés exclusivement à l'usage de la personne à laquelle ils sont adressés. Si vous avez reçu ce message par erreur, merci de le renvoyer à son émetteur et de le détruire. Toutes diffusion, publication, totale ou partielle ou divulgation sous quelque forme que se soit non expressément autorisées de ce message, sont interdites. - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Réf. : RE: Javascript issue encountered with s :optiontransferselect
Hi, The tag actually was in a div loaded in AJAX, and thanks to you it now works just fine ! Thanks a lot ! Matthieu Internet [EMAIL PROTECTED] 15/02/2008 15:23 Veuillez répondre à user@struts.apache.org Pour user@struts.apache.org cc Objet RE: Javascript issue encountered with s:optiontransferselect Hello, Do the tag is in a div loaded in AJAX ? If you load the tag s:optiontransferselect in a ajax div, js will not be included. In this case try with this : script language=javascript src=./struts/optiontransferselect.js/script Julien -Message d'origine- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Envoyé : vendredi 15 février 2008 15:15 À : user@struts.apache.org Objet : Javascript issue encountered with s:optiontransferselect Hi all, I am facing a particular problem, and I didn't find help on the web so I'm turning myself to you. I use in my Struts 2 application the UI tag s:optiontransferselect. The parameters work fine and everything's displayed correctly on the screen. Nevertheless, the buttons just don't work. Nothing happens and I get a javascript error each time I hit those buttons, saying that a javascript function is undefined (the function corresponding to the buttons : moveSelectedOptions, moveAllOptions ...). In my head tag, I have included the ajax theme (s:head theme=ajax debug=true/), which gives me this in my final page: link rel=stylesheet href=/roadbook/struts/xhtml/styles.css type=text/css/ script type=text/javascript // Dojo configuration djConfig = { baseRelativePath: /roadbook/struts/dojo, isDebug: true, bindEncoding: UTF-8, debugAtAllCosts: true // not needed, but allows the Venkman debugger to work with the includes }; /script script type=text/javascript src=/roadbook/struts/dojo/dojo.js/script script type=text/javascript src=/roadbook/struts/simple/dojoRequire.js/scriptscript type=text/javascript src=/roadbook/struts/ajax/dojoRequire.js/script script type=text/javascript src=/roadbook/struts/CommonFunctions.js/script I think I might have a lacking js file, where the optiontranserselect javascript methods may be ... Any ideas ? regards, Matthieu This message and any attachments (the message) is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. The internet can not guarantee the integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will) not therefore be liable for the message if modified. Do not print this message unless it is necessary, consider the environment. - Ce message et toutes les pieces jointes (ci-apres le message) sont etablis a l'intention exclusive de ses destinataires et sont confidentiels. Si vous recevez ce message par erreur, merci de le detruire et d'en avertir immediatement l'expediteur. Toute utilisation de ce message non conforme a sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. L'internet ne permettant pas d'assurer l'integrite de ce message, BNP PARIBAS (et ses filiales) decline(nt) toute responsabilite au titre de ce message, dans l'hypothese ou il aurait ete modifie. N'imprimez ce message que si necessaire, pensez a l'environnement. This e-mail, any attachments and the information contained therein (this message) are confidential and intended solely for the use of the addressee(s). If you have received this message in error please send it back to the sender and delete it. Unauthorized publication, use, dissemination or disclosure of this message, either in whole or in part is strictly prohibited. -- Ce message électronique et tous les fichiers joints ainsi que les informations contenues dans ce message ( ci après le message ), sont confidentiels et destinés exclusivement à l'usage de la personne à laquelle ils sont adressés. Si vous avez reçu ce message par erreur, merci de le renvoyer à son émetteur et de le détruire. Toutes diffusion, publication, totale ou partielle ou divulgation sous quelque forme que se soit non expressément autorisées de ce message, sont interdites. - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: Javascript problem
addOnLoad() should cause the function to be executed as soon as the DOM is complete, which may be before the page has finished loading and rendering. However, since the DOM will be fully constructed, getElementById() should work properly at that point. I'd go with Dave's advice and confirm that the element you're referencing really exists in the DOM. And, if you really do have an element with an ID of 'name[0]', I'd definitely try changing the ID to something that's legal, in case that's what's confusing the browser. L. Pablo Vázquez Blázquez wrote: script type=text/javascript function init() { alert(document.getElementById('name[0]')); } dojo.addOnLoad(init); /script It is the same as: script type=text/javascript alert(document.getElementById('name[0]')); /script It is executed before the page loads. Dave Newton escribió: --- Pablo Vázquez Blázquez [EMAIL PROTECTED] wrote: Anyone knows why my javascript code is executed at the loading of a page instead when it *should*?? Mostly because of your definition of should ;) For example, I have a .jspx page with a form: form ... input id=id ... ... form script alert('hi'); alert(document.getElementById('id')); /script 'hi' is shown before the form and then 'undefined'. But my js code is at the end of the page. How can it be possible? Just because your JavaScript is at the end of the page doesn't mean the entire page (thus the DOM) will be rendered before your JavaScript executes, and it may be browser-dependent. As was pointed out you can put your JavaScript in a window.onload section; IIRC this will wait until *everything* has loaded, including images etc. However, putting such JavaScript in an window.onload handler *may* interfere with Dojo's own onload handler, which may do DOM rewriting and so on. Instead try using Dojo's: dojo.addOnLoad(aFunction) where aFunction is either a function reference or an anonymous function. See dojo.addOnLoad [1] and a short blog post [2] for some further information. Dave [1] Dojo's dojo.addOnLoad function: http://redesign.dojotoolkit.org/jsdoc/dojo/HEAD/dojo.addOnLoad [2] http://www.dev411.com/blog/2006/07/13/dojo-dojo-addonload-vs-body-onload-and-window-onload - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: Javascript problem
If I use a hidden iframe to do the same, it works. I didn´t put the script tag in the head. I don´t understand why I should do it... I´m using Tiles and my header is reused in several pages, and this script is only valid for few ones. Thanks. Dave Newton escribió: --- Pablo Vázquez Blázquez [EMAIL PROTECTED] wrote: script type=text/javascript function init() { alert(document.getElementById('name[0]')); } dojo.addOnLoad(init); /script It is the same as: script type=text/javascript alert(document.getElementById('name[0]')); /script It is executed before the page loads. Are you saying there's still a problem? AFAICT there are no issues with dojo.addOnLoad. When you look at the DOM w/ Firebug does the ID match what you expect? Is it legal to give an element an ID with brackets in it? Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: Javascript problem
--- Pablo Vázquez Blázquez [EMAIL PROTECTED] wrote: script type=text/javascript function init() { alert(document.getElementById('name[0]')); } dojo.addOnLoad(init); /script It is the same as: script type=text/javascript alert(document.getElementById('name[0]')); /script It is executed before the page loads. Are you saying there's still a problem? AFAICT there are no issues with dojo.addOnLoad. When you look at the DOM w/ Firebug does the ID match what you expect? Is it legal to give an element an ID with brackets in it? Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: Javascript problem
Did you put such code inside page header's tags? Regards -- Lukasz http://www.linkedin.com/in/lukaszlenart - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: Javascript problem
script type=text/javascript function init() { alert(document.getElementById('name[0]')); } dojo.addOnLoad(init); /script It is the same as: script type=text/javascript alert(document.getElementById('name[0]')); /script It is executed before the page loads. Dave Newton escribió: --- Pablo Vázquez Blázquez [EMAIL PROTECTED] wrote: Anyone knows why my javascript code is executed at the loading of a page instead when it *should*?? Mostly because of your definition of should ;) For example, I have a .jspx page with a form: form ... input id=id ... ... form script alert('hi'); alert(document.getElementById('id')); /script 'hi' is shown before the form and then 'undefined'. But my js code is at the end of the page. How can it be possible? Just because your JavaScript is at the end of the page doesn't mean the entire page (thus the DOM) will be rendered before your JavaScript executes, and it may be browser-dependent. As was pointed out you can put your JavaScript in a window.onload section; IIRC this will wait until *everything* has loaded, including images etc. However, putting such JavaScript in an window.onload handler *may* interfere with Dojo's own onload handler, which may do DOM rewriting and so on. Instead try using Dojo's: dojo.addOnLoad(aFunction) where aFunction is either a function reference or an anonymous function. See dojo.addOnLoad [1] and a short blog post [2] for some further information. Dave [1] Dojo's dojo.addOnLoad function: http://redesign.dojotoolkit.org/jsdoc/dojo/HEAD/dojo.addOnLoad [2] http://www.dev411.com/blog/2006/07/13/dojo-dojo-addonload-vs-body-onload-and-window-onload - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] Re: Javascript problem
Just one minor clarification that hasn't been mentioned elsewhere in this thread. If your HTML fragment is being loaded via XHR with Dojo, then Dojo itself is responsible for parsing the html for scripts and then executing them. This is because inserting html into the DOM via innerHTML does not necessarily execute the scripts (it's browser-dependent) The S2 implementation executes the scripts at the end of parsing, not as each script tag is encountered. Your design needs to cater for this. As others mentioned, addOnLoad is okay for a full page, but if you're using XHR then you'll need to use dojo's pub/sub features. Pablo Vázquez Blázquez wrote: Hi! Anyone knows why my javascript code is executed at the loading of a page instead when it *should*?? For example, I have a .jspx page with a form: form ... input id=id ... ... form script alert('hi'); alert(document.getElementById('id')); /script 'hi' is shown before the form and then 'undefined'. But my js code is at the end of the page. How can it be possible? I´m sure it is a dojo thing, but I don´t know how to solve it. I access to this page from another one where I have executeScripts=true. Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Javascript problem
Thanks Dave. I had already written this post before seeing your other response. I´ll try dojo.addOnLoad(fn). Dave Newton escribió: --- Pablo Vázquez Blázquez [EMAIL PROTECTED] wrote: What I want is to execute my js after the page is loaded (so, the normal behabiour), not while it is loading. window.onload does not execute while the page is loading; that wouldn't make any sense: it executes after all page-related requests have been made. I don't know if that necessarily means that every browser will have rendered the entire DOM; you'd need to ask a question like that in a more appropriate forum. In any case, see my other response to your original question, which details a more Dojo-friendly method. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Javascript problem
--- Pablo Vázquez Blázquez [EMAIL PROTECTED] wrote: What I want is to execute my js after the page is loaded (so, the normal behabiour), not while it is loading. window.onload does not execute while the page is loading; that wouldn't make any sense: it executes after all page-related requests have been made. I don't know if that necessarily means that every browser will have rendered the entire DOM; you'd need to ask a question like that in a more appropriate forum. In any case, see my other response to your original question, which details a more Dojo-friendly method. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] Re: Javascript problem
--- Pablo Vázquez Blázquez [EMAIL PROTECTED] wrote: Anyone knows why my javascript code is executed at the loading of a page instead when it *should*?? Mostly because of your definition of should ;) For example, I have a .jspx page with a form: form ... input id=id ... ... form script alert('hi'); alert(document.getElementById('id')); /script 'hi' is shown before the form and then 'undefined'. But my js code is at the end of the page. How can it be possible? Just because your JavaScript is at the end of the page doesn't mean the entire page (thus the DOM) will be rendered before your JavaScript executes, and it may be browser-dependent. As was pointed out you can put your JavaScript in a window.onload section; IIRC this will wait until *everything* has loaded, including images etc. However, putting such JavaScript in an window.onload handler *may* interfere with Dojo's own onload handler, which may do DOM rewriting and so on. Instead try using Dojo's: dojo.addOnLoad(aFunction) where aFunction is either a function reference or an anonymous function. See dojo.addOnLoad [1] and a short blog post [2] for some further information. Dave [1] Dojo's dojo.addOnLoad function: http://redesign.dojotoolkit.org/jsdoc/dojo/HEAD/dojo.addOnLoad [2] http://www.dev411.com/blog/2006/07/13/dojo-dojo-addonload-vs-body-onload-and-window-onload - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Javascript problem
What I want is to execute my js after the page is loaded (so, the normal behabiour), not while it is loading. And I would like to add my javascript behaviour when necessary (on demand, no in page header). Is it possible? I have always done so but now with dojo and struts 2. Lukasz Lenart escribió: Try to put your JavaScript in page header and use onload header script window.onload = function() { alert('hi'); alert(document.getElementById('id')); } /script /header Regards - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Javascript problem
Try to put your JavaScript in page header and use onload header script window.onload = function() { alert('hi'); alert(document.getElementById('id')); } /script /header Regards -- Lukasz http://www.linkedin.com/in/lukaszlenart - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: Javascript problem
Hi Jeromy, Thanks for your explanation. Now, my problem has a reason. Well, you say The S2 implementation executes the scripts at the end of parsing, not as each script tag is encountered. At the end of parsing is before inserting html into the DOM, isn´t it? So, if it is so, that's my problem. I'll need to use publish/subscribe, as you say. Thanks to everyone. Jeromy Evans escribió: Just one minor clarification that hasn't been mentioned elsewhere in this thread. If your HTML fragment is being loaded via XHR with Dojo, then Dojo itself is responsible for parsing the html for scripts and then executing them. This is because inserting html into the DOM via innerHTML does not necessarily execute the scripts (it's browser-dependent) The S2 implementation executes the scripts at the end of parsing, not as each script tag is encountered. Your design needs to cater for this. As others mentioned, addOnLoad is okay for a full page, but if you're using XHR then you'll need to use dojo's pub/sub features. Pablo Vázquez Blázquez wrote: Hi! Anyone knows why my javascript code is executed at the loading of a page instead when it *should*?? For example, I have a .jspx page with a form: form ... input id=id ... ... form script alert('hi'); alert(document.getElementById('id')); /script 'hi' is shown before the form and then 'undefined'. But my js code is at the end of the page. How can it be possible? I´m sure it is a dojo thing, but I don´t know how to solve it. I access to this page from another one where I have executeScripts=true. Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javascript update tag value property [OFFTOPIC?]
Hello Victor, Simplify. something like this should work. Maquina.onChange event { document.form1.textfield1.value= document.form1.Maquina.options[document.form1.Maquina.selectedIndex].value; } Regards, Domingo --- victor sosa [EMAIL PROTECTED] escribió: ANY IDEAS, how to? victor sosa wrote: Hi, I am trying to update a textfield when the select is changed using javascript event onchange, so How I can do that? Which is the best practices here? Here is my code, any Ideas? script type=text/javascript function getVolumenInicial() { var volumenInicial = document.getElementById('save_volumenInicial'); var maquinaSelected = document.getElementById('save_maquina_codigo'); volumenInicial.value = '%{maquinas[' + maquinaSelected.selectedIndex + '].metro}'; } /script . s:select label=Maquina name=maquina.codigo list=maquinas onchange=getVolumenInicial(); value=%{maquina.codigo} required=true listKey=codigo listValue=codigo / s:textfield label=Volumen Inicial name=volumenInicial value=%{venta.volumenInicial} readonly=true size=7 maxlength=9 / ANY IDEAS, how to? -- View this message in context: http://www.nabble.com/javascript-update-tag-value-property-tf4843331.html#a13858354 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Comparte video en la ventana de tus mensajes (y también tus fotos de Flickr). Usa el nuevo Yahoo! Messenger versión Beta. http://e1.beta.messenger.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javascript update tag value property [OFFTOPIC?]
Thks for you answer but is still open Because I need to put into the textfield base in another property of Maquina object (here only put id), for example: name or comment, features, ect. So every time a select a Maquina object, I need to get also the properties of its. Domingo A. Rodriguez S. wrote: Hello Victor, Simplify. something like this should work. Maquina.onChange event { document.form1.textfield1.value= document.form1.Maquina.options[document.form1.Maquina.selectedIndex].value; } Regards, Domingo --- victor sosa [EMAIL PROTECTED] escribió: ANY IDEAS, how to? victor sosa wrote: Hi, I am trying to update a textfield when the select is changed using javascript event onchange, so How I can do that? Which is the best practices here? Here is my code, any Ideas? script type=text/javascript function getVolumenInicial() { var volumenInicial = document.getElementById('save_volumenInicial'); var maquinaSelected = document.getElementById('save_maquina_codigo'); volumenInicial.value = '%{maquinas[' + maquinaSelected.selectedIndex + '].metro}'; } /script . s:select label=Maquina name=maquina.codigo list=maquinas onchange=getVolumenInicial(); value=%{maquina.codigo} required=true listKey=codigo listValue=codigo / s:textfield label=Volumen Inicial name=volumenInicial value=%{venta.volumenInicial} readonly=true size=7 maxlength=9 / ANY IDEAS, how to? -- View this message in context: http://www.nabble.com/javascript-update-tag-value-property-tf4843331.html#a13858354 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Comparte video en la ventana de tus mensajes (y también tus fotos de Flickr). Usa el nuevo Yahoo! Messenger versión Beta. http://e1.beta.messenger.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/javascript-update-tag-value-property-tf4843331.html#a13887504 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javascript update tag value property
ANY IDEAS, how to? victor sosa wrote: Hi, I am trying to update a textfield when the select is changed using javascript event onchange, so How I can do that? Which is the best practices here? Here is my code, any Ideas? script type=text/javascript function getVolumenInicial() { var volumenInicial = document.getElementById('save_volumenInicial'); var maquinaSelected = document.getElementById('save_maquina_codigo'); volumenInicial.value = '%{maquinas[' + maquinaSelected.selectedIndex + '].metro}'; } /script . s:select label=Maquina name=maquina.codigo list=maquinas onchange=getVolumenInicial(); value=%{maquina.codigo} required=true listKey=codigo listValue=codigo / s:textfield label=Volumen Inicial name=volumenInicial value=%{venta.volumenInicial} readonly=true size=7 maxlength=9 / ANY IDEAS, how to? -- View this message in context: http://www.nabble.com/javascript-update-tag-value-property-tf4843331.html#a13858354 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javascript and logic:forward
Ok, I've got it working much better. What I did was use JavaScript to redirect, setting window.location. I've read that logic:forward is a server-side redirect, and I did not try using sendRedirect yet. thenameless20 wrote: What comes firsta documents body onload=function(...) or logic:forward name=login Is this browser dependent? For more backgound: The login for my site uses a cookie value, this cookie was created on the same domain but not in the java request, so if I'm correct javascript is probably the only solution I have to reading in this client's cookie my javascript reads the client cookie sets a hidden form variable and using`AJAX` like magic, it sends the forum to a method that stores that cookie's value in the http servlet response, so it can use it later on, after this my hopes are for the logic forward to trigger and continue the login process. This method works from what I've tested, but seems finicky using different browsers...is this method I described a solid way to approach this problem? [if you have already seen this it's because I posted on struts-dev by accident, thanks] -- View this message in context: http://www.nabble.com/javascript-and-logic%3Aforward-tf3998107.html#a11402080 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] Re: javascript issue in jsp
--- Krishna, Hari (FTT-CInternet) wrote: This is the line of code that causes the issue. Look in to JavaScript strings to understand why these two things are issues. \ is an escape character. document.getElementById(text+i).value = ; Is that legal JavaScript? (Hint: No.) If you're embedding quotes you must escape them, or use the quote that isn't in your input string (may work, may just cause same problem). d. Got a little couch potato? Check out fun summer activities for kids. http://search.yahoo.com/search?fr=oni_on_mailp=summer+activities+for+kidscs=bz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] Re: javascript issue in jsp
Thanks dave I got a little key to big door Regards, I.HariKrishna | Software Engineer | Franklin Templeton International Services (India) Pvt. Ltd. | Franklin Templeton Centre,1st Floor, No.7,Third Cross Street, Kasturba Nagar, Adyar, Chennai 600020 | Tel: +91 44 24407000 | Extn: 17123 | Fax: +91 44 24453661 | Mobile: +91 9884528587 | www.franklintempleton.com -Original Message- From: Dave Newton [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 06, 2007 3:31 PM To: Struts Users Mailing List Subject: [OT] Re: javascript issue in jsp --- Krishna, Hari (FTT-CInternet) wrote: This is the line of code that causes the issue. Look in to JavaScript strings to understand why these two things are issues. \ is an escape character. document.getElementById(text+i).value = ; Is that legal JavaScript? (Hint: No.) If you're embedding quotes you must escape them, or use the quote that isn't in your input string (may work, may just cause same problem). d. Got a little couch potato? Check out fun summer activities for kids. http://search.yahoo.com/search?fr=oni_on_mailp=summer+activities+for+ki dscs=bz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Notice: All email and instant messages (including attachments) sent to or from Franklin Templeton Investments (FTI) personnel may be retained, monitored and/or reviewed by FTI and its agents, or authorized law enforcement personnel, without further notice or consent. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Javascript onfocus issuein IE and struts 1.2.x
Hi Don, In which version of IE do you observe this behavior? I just verified in IE 5.5, 6 and 7 that onfocus with a lower-case 'f' works just fine. AFAIK, case does not matter to any browser with event handler names, whether Struts is involved or not... any chance the problem your seeing is caused by something else and it just seems like this is the problem? (we've all been there before! LOL) Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Thu, January 11, 2007 10:16 am, Don Don wrote: Hi all, I've noticed an issue with the above versions of struts and the javascript onfocus function when using IE. Struts uses the function in lower case (e.g. onfocus()) and even renders the generated code in lower case as well, IE on the other hand requires the function to be in this format onFocus() where the F is capitalized. If the F is capitalized the function works in IE but if its uncapitalised e.g. f then it does not function in IE. Other browsers seems to work fine, Firefox, etc. Anyway of getting around this ? Cheers - Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Javascript onfocus issuein IE and struts 1.2.x
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Frank, Frank W. Zammetti wrote: In which version of IE do you observe this behavior? I just verified in IE 5.5, 6 and 7 that onfocus with a lower-case 'f' works just fine. Just out of curiosity, what DOCTYPE were you guys using? I know that XHTML requires that all attributes be entirely in lowercase (i.e. 'onfocus' is correct while 'onFocus' is actually incorrect). Could this be an issue with quirks mode versus standards compliance mode in MSIE? - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFpl2H9CaO5/Lv0PARAlF+AJ9BBnkJ6bP1dM0WemxaoYzQVof2hACfYL9x J2YwVk0LZE2G20lfG77HkeY= =grTT -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Javascript onfocus issuein IE and struts 1.2.x
Hi guys here's what am tryin to do input type=text name=firstName maxlength=50 size=40 value=First Name onfocus=if(this.value=='First Name')this.value=''; in IE (all versions from 5 to 7) this just does not work. Maybe as Chris said it has to do with the doc type, here's the doctype am using !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; What could be wrong ? Frank W. Zammetti [EMAIL PROTECTED] wrote: Hi Don, In which version of IE do you observe this behavior? I just verified in IE 5.5, 6 and 7 that onfocus with a lower-case 'f' works just fine. AFAIK, case does not matter to any browser with event handler names, whether Struts is involved or not... any chance the problem your seeing is caused by something else and it just seems like this is the problem? (we've all been there before! LOL) Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Thu, January 11, 2007 10:16 am, Don Don wrote: Hi all, I've noticed an issue with the above versions of struts and the javascript onfocus function when using IE. Struts uses the function in lower case (e.g. onfocus()) and even renders the generated code in lower case as well, IE on the other hand requires the function to be in this format onFocus() where the F is capitalized. If the F is capitalized the function works in IE but if its uncapitalised e.g. f then it does not function in IE. Other browsers seems to work fine, Firefox, etc. Anyway of getting around this ? Cheers - Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates.
Re: Javascript onfocus issuein IE and struts 1.2.x
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Don, Don Don wrote: in IE (all versions from 5 to 7) this just does not work. I tried this exact file in MSIE 6.0.2900.2180 and it works just fine (after you tell MSIE that it's okay to run scripts from a file you grabbed off your own disk): !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; html body input type=text name=firstName maxlength=50 size=40 value=First Name onfocus=if(this.value=='First Name')this.value=''; /body /html Mozilla ff renders this same page in standards compliance mode (as you would expect, given that DOCTYPE), but can't remember how to tell what MSIE is doing with it. At any rate, it works for me. Do other scripts on your page work as well? Perhaps you have a script somewhere else on the page that is failing, causing this one never to be run. (??) I'm just grasping at straws at this point. Try the minimal example that you provided on a page all by itself and see what happens for you. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFpmMW9CaO5/Lv0PARAjxsAKCWPP+RE8b64v/Cq1exCbEkttDYKgCeL8uP s9eSOKDB+JbGEkBbrQ9VQ9k= =Y75R -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Javascript onfocus issuein IE and struts 1.2.x
Hi I noticed it working in an html only environment (i.e. not struts) when struts is applied it fails to work still only in IE Christopher Schultz [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Don, Don Don wrote: in IE (all versions from 5 to 7) this just does not work. I tried this exact file in MSIE 6.0.2900.2180 and it works just fine (after you tell MSIE that it's okay to run scripts from a file you grabbed off your own disk): http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; [input] value=First Name onfocus=if(this.value=='First Name')this.value=''; Mozilla ff renders this same page in standards compliance mode (as you would expect, given that DOCTYPE), but can't remember how to tell what MSIE is doing with it. At any rate, it works for me. Do other scripts on your page work as well? Perhaps you have a script somewhere else on the page that is failing, causing this one never to be run. (??) I'm just grasping at straws at this point. Try the minimal example that you provided on a page all by itself and see what happens for you. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFpmMW9CaO5/Lv0PARAjxsAKCWPP+RE8b64v/Cq1exCbEkttDYKgCeL8uP s9eSOKDB+JbGEkBbrQ9VQ9k= =Y75R -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Want to start your own business? Learn how on Yahoo! Small Business.
Re: Javascript onfocus issuein IE and struts 1.2.x
Hmm, curious... I just tried the following: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; htmlhead/headbody input type=text name=firstName maxlength=50 size=40 value=First Name onfocus=if(this.value=='First Name')this.value=''; /body/html This is working for me just fine, IE 6 and 7 anyway. I also tried changing onfocus to onFocus, and it still worked. I definitely would have been with Christopher in thinking doctype was the culprit, but this working both ways seems to imply otherwise. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Thu, January 11, 2007 10:57 am, Don Don wrote: Hi guys here's what am tryin to do input type=text name=firstName maxlength=50 size=40 value=First Name onfocus=if(this.value=='First Name')this.value=''; in IE (all versions from 5 to 7) this just does not work. Maybe as Chris said it has to do with the doc type, here's the doctype am using !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; What could be wrong ? Frank W. Zammetti [EMAIL PROTECTED] wrote: Hi Don, In which version of IE do you observe this behavior? I just verified in IE 5.5, 6 and 7 that onfocus with a lower-case 'f' works just fine. AFAIK, case does not matter to any browser with event handler names, whether Struts is involved or not... any chance the problem your seeing is caused by something else and it just seems like this is the problem? (we've all been there before! LOL) Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Thu, January 11, 2007 10:16 am, Don Don wrote: Hi all, I've noticed an issue with the above versions of struts and the javascript onfocus function when using IE. Struts uses the function in lower case (e.g. onfocus()) and even renders the generated code in lower case as well, IE on the other hand requires the function to be in this format onFocus() where the F is capitalized. If the F is capitalized the function works in IE but if its uncapitalised e.g. f then it does not function in IE. Other browsers seems to work fine, Firefox, etc. Anyway of getting around this ? Cheers - Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Javascript onfocus issuein IE and struts 1.2.x
I see you guys were two posts ahead of me while I typed my last reply :) On the same wavelength though. If you just throw a simple alert(''); in the event handler instead, in the fullblown Struts version, do you get the popup as expected? I'm grasping at the same pack of straws Christopher is, just trying to narrow the problem down a tad. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Thu, January 11, 2007 11:21 am, Don Don wrote: Hi I noticed it working in an html only environment (i.e. not struts) when struts is applied it fails to work still only in IE Christopher Schultz [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Don, Don Don wrote: in IE (all versions from 5 to 7) this just does not work. I tried this exact file in MSIE 6.0.2900.2180 and it works just fine (after you tell MSIE that it's okay to run scripts from a file you grabbed off your own disk): http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; [input] value=First Name onfocus=if(this.value=='First Name')this.value=''; Mozilla ff renders this same page in standards compliance mode (as you would expect, given that DOCTYPE), but can't remember how to tell what MSIE is doing with it. At any rate, it works for me. Do other scripts on your page work as well? Perhaps you have a script somewhere else on the page that is failing, causing this one never to be run. (??) I'm just grasping at straws at this point. Try the minimal example that you provided on a page all by itself and see what happens for you. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFpmMW9CaO5/Lv0PARAjxsAKCWPP+RE8b64v/Cq1exCbEkttDYKgCeL8uP s9eSOKDB+JbGEkBbrQ9VQ9k= =Y75R -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Want to start your own business? Learn how on Yahoo! Small Business. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Javascript onfocus issuein IE and struts 1.2.x
From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] This is working for me just fine, IE 6 and 7 anyway. Works for me too, IE 6 and 7. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Javascript onfocus issuein IE and struts 1.2.x
Hum...its strange am looking to see if struts has got anything to do with it, or if setting a field to obtain the focus automatically when the form is loaded has any effect on how the rest of the fields deal with focus etc. Dave Newton [EMAIL PROTECTED] wrote: From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] This is working for me just fine, IE 6 and 7 anyway. Works for me too, IE 6 and 7. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Everyone is raving about the all-new Yahoo! Mail beta.
RE: Javascript onfocus issuein IE and struts 1.2.x
From: Don Don [mailto:[EMAIL PROTECTED] Hum...its strange am looking to see if struts has got anything to do with it, or if setting a field to obtain the focus automatically when the form is loaded has any effect on how the rest of the fields deal with focus etc. Dave Newton [EMAIL PROTECTED] wrote: From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] This is working for me just fine, IE 6 and 7 anyway. Works for me too, IE 6 and 7. Mine was a Struts app w/ the html tags. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javascript and readonly in struts
Søren Blidorf wrote: Hi. I am trying to convert the following in to struts taglib I'm not really sure what that means. You want to convert a client-side Javascript behaviour to a server-side behaviour. What is the use case you're trying to achieve? script language=javascript function choose() { if (this.form.v1.selectedIndex==3) { this.form.v2.readOnly=true; this.form.v2.value=''; } } /script select name=v1 onchange=choose(selectedIndex) option value=11/option option value=22/option option value=33/option /select OK, so when the selected value is changed, you have Javascript that will dynamically set another field to readonly. Are you asking how to implement the same logic if the form is submitted with the appropriate option selected? L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javascript and readonly in struts
Soren-- you may want to use the disabled attribute as in form.v2.disabled=true; works for me ..(I do not know if the form.v2.readonly is operational) also in the body of the code if your control is not passing any parameters use onChange=choose(); Tak, Martin -- This e-mail communication and any attachments may contain confidential and privileged information for the use of the designated recipients named above. If you are not the intended recipient, you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it or its contents - Original Message - From: Søren Blidorf [EMAIL PROTECTED] To: user@struts.apache.org Sent: Sunday, November 19, 2006 9:24 AM Subject: javascript and readonly in struts Hi. I am trying to convert the following in to struts taglib script language=javascript function choose() { if (this.form.v1.selectedIndex==3) { this.form.v2.readOnly=true; this.form.v2.value=''; } } /script select name=v1 onchange=choose(selectedIndex) option value=11/option option value=22/option option value=33/option /select input type=text name=v2 How do I make this work: script language=javascript function choose() { if (this.form.v1.selectedIndex==3) { this.form.v2.readOnly=true; this.form.v2.value=''; } } /script html:select property=v1 onchange=choose(selectedIndex) html:option value=11/html:option html:option value=22/html:option html:option value=33/html:option /html:select html:text property=v2 Søren Blidorf Nolas Consulting Automatikvej 1 DK-2860 Søborg Telefon: +45 32713661 Direkte: +45 61676513 Webside: www.nolas.dk - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JavaScript validation errors
Hi sean, i think if you put onsubmit=return validateLoginForm(this); it works fine with client(front-end validation)side and if you remove onsubmit from jsp then it works fine with server(backend validation)may be this helps you Thanks, Srinivas. O'Shea, Sean Sean.O'[EMAIL PROTECTED] com To user@struts.apache.org 08/12/2006 12:11 cc AM Subject RE: JavaScript validation errors Please respond to Struts Users Mailing List [EMAIL PROTECTED] he.org Hi, I'm not writing the JavaScript code myself, so I cannot include a check like you suggested. The JavaScript is being automatically generated using the html:javascript tag. The generated validateRequired method is taken directly from the commons-validator.jar: function validateRequired(form) { var isValid = true; var focusField = null; var i = 0; var fields = new Array(); var formName = form.getAttributeNode(name); oRequired = eval('new ' + formName.value + '_required()'); for (x in oRequired) { var field = form[oRequired[x][0]]; if ((field.type == 'hidden' || field.type == 'text' || field.type == 'textarea' || field.type == 'file' || field.type == 'checkbox' || field.type == 'select-one' || field.type == 'password') field.disabled == false) { var value = ''; // get field's value if (field.type == select-one) { var si = field.selectedIndex; if (si = 0) { value = field.options[si].value; } } else if (field.type == 'checkbox') { if (field.checked) { value = field.value; } } else { value = field.value; } if (trim(value).length == 0) { if (i == 0) { focusField = field; } fields[i++] = oRequired[x][1]; isValid = false; } } else if (field.type == select-multiple) { var numOptions = field.options.length; lastSelected=-1; for(loop=numOptions-1;loop=0;loop--) { if(field.options[loop].selected) { lastSelected = loop; value = field.options[loop].value; break; } } if(lastSelected 0 || trim(value).length == 0) { if(i == 0) { focusField = field; } fields[i++] = oRequired[x][1]; isValid=false; } } else if ((field.length 0) (field[0].type == 'radio' || field[0].type == 'checkbox')) { isChecked=-1; for (loop=0;loop field.length;loop++) { if (field[loop].checked) { isChecked=loop; break; // only one needs to be checked } } if (isChecked 0) { if (i == 0) { focusField = field[0]; } fields[i++] = oRequired[x][1]; isValid=false; } } } if (fields.length 0) { focusField.focus(); alert(fields.join('\n')); } return isValid; } // Trim whitespace from left and right sides of s. function trim(s) { return s.replace( /^\s*/, ).replace( /\s*$/, ); } Sean -Original Message- From: Monkeyden [mailto:[EMAIL PROTECTED] Sent: Friday, August 11, 2006 1:57 PM To: Struts Users Mailing List
RE: JavaScript validation errors
Hi Srinivas, I tried setting my login form like this: html:form action=login onsubmit=return validateLoginForm(this); . /html:form html:javascript formName=loginForm/ ... Still no luck in getting the javascript function called though. I've checked the source of the generated page and it looks like the validateLoginForm function is getting generated: function validateLoginForm(form) { if (bCancel) return true; else var formValidationResult; formValidationResult = validateRequired(form); return (formValidationResult == 1); } function loginForm_required () { this.a0 = new Array(SSN, SSN is required., new Function (varName, return this[varName];)); this.a1 = new Array(password, Password is required., new Function (varName, return this[varName];)); } The generated validateRequired function looks like this: function validateRequired(form) { var isValid = true; var focusField = null; var i = 0; var fields = new Array(); var formName = form.getAttributeNode(name); oRequired = eval('new ' + formName.value + '_required()'); . I'm guessing the intent of the eval('new ' + formName.value + '_required()'); line is to call the loginForm_required function? I made a little change to the validateRequired.js in the org.apache.commons.validator.javascript to alert when the function is called: /*$RCSfile: validateRequired.js,v $ $Revision: 1.13 $ $Date: 2004/03/28 16:53:21 $ */ /** * Check to see if fields must contain a value. * Fields are not checked if they are disabled. * p * @param form The form validation is taking place on. */ function validateRequired(form) { alert(Calling required ) . But this doesn't even get called. My browser says that there is an error on line 1081 on the page - looking at this line I see this: //End -- /script My browser says it expects a '}' - it appears that there is a missing closing brace somewhere in the code? Has anyone else come across this problem? Thanks Sean -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, August 14, 2006 5:39 AM To: Struts Users Mailing List Subject: RE: JavaScript validation errors Hi sean, i think if you put onsubmit=return validateLoginForm(this); it works fine with client(front-end validation)side and if you remove onsubmit from jsp then it works fine with server(backend validation)may be this helps you Thanks, Srinivas. O'Shea, Sean Sean.O'[EMAIL PROTECTED] com To user@struts.apache.org 08/12/2006 12:11 cc AM Subject RE: JavaScript validation errors Please respond to Struts Users Mailing List [EMAIL PROTECTED] he.org Hi, I'm not writing the JavaScript code myself, so I cannot include a check like you suggested. The JavaScript is being automatically generated using the html:javascript tag. The generated validateRequired method is taken directly from the commons-validator.jar: function validateRequired(form) { var isValid = true; var focusField = null; var i = 0; var fields = new Array(); var formName = form.getAttributeNode(name); oRequired = eval('new ' + formName.value + '_required()'); for (x in oRequired) { var field = form[oRequired[x][0]]; if ((field.type == 'hidden' || field.type == 'text' || field.type == 'textarea' || field.type == 'file' || field.type == 'checkbox' || field.type == 'select-one' || field.type == 'password') field.disabled == false) { var value = ''; // get field's value if (field.type == select-one) { var si = field.selectedIndex; if (si = 0) { value = field.options[si].value; } } else if (field.type == 'checkbox') { if (field.checked) { value = field.value; } } else { value = field.value; } if (trim(value).length == 0) { if (i == 0) { focusField = field; } fields[i++] = oRequired[x][1]; isValid = false; } } else if (field.type == select-multiple) { var numOptions = field.options.length; lastSelected=-1; for(loop=numOptions-1;loop=0;loop--) { if(field.options[loop
RE: JavaScript validation errors
Try to put html:javascript formName=loginForm dynamicJavascript=true staticJavascript=false/ instead of html:javascript formName=loginForm/...just a trial.. Thanks, Srinivas. O'Shea, Sean Sean.O'[EMAIL PROTECTED] com To user@struts.apache.org 08/14/2006 08:02 cc PM Subject RE: JavaScript validation errors Please respond to Struts Users Mailing List [EMAIL PROTECTED] he.org Hi Srinivas, I tried setting my login form like this: html:form action=login onsubmit=return validateLoginForm(this); . /html:form html:javascript formName=loginForm/ ... Still no luck in getting the javascript function called though. I've checked the source of the generated page and it looks like the validateLoginForm function is getting generated: function validateLoginForm(form) { if (bCancel) return true; else var formValidationResult; formValidationResult = validateRequired(form); return (formValidationResult == 1); } function loginForm_required () { this.a0 = new Array(SSN, SSN is required., new Function (varName, return this[varName];)); this.a1 = new Array(password, Password is required., new Function (varName, return this[varName];)); } The generated validateRequired function looks like this: function validateRequired(form) { var isValid = true; var focusField = null; var i = 0; var fields = new Array(); var formName = form.getAttributeNode(name); oRequired = eval('new ' + formName.value + '_required()'); . I'm guessing the intent of the eval('new ' + formName.value + '_required()'); line is to call the loginForm_required function? I made a little change to the validateRequired.js in the org.apache.commons.validator.javascript to alert when the function is called: /*$RCSfile: validateRequired.js,v $ $Revision: 1.13 $ $Date: 2004/03/28 16:53:21 $ */ /** * Check to see if fields must contain a value. * Fields are not checked if they are disabled. * p * @param form The form validation is taking place on. */ function validateRequired(form) { alert(Calling required ) . But this doesn't even get called. My browser says that there is an error on line 1081 on the page - looking at this line I see this: //End -- /script My browser says it expects a '}' - it appears that there is a missing closing brace somewhere in the code? Has anyone else come across this problem? Thanks Sean -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, August 14, 2006 5:39 AM To: Struts Users Mailing List Subject: RE: JavaScript validation errors Hi sean, i think if you put onsubmit=return validateLoginForm(this); it works fine with client(front-end validation)side and if you remove onsubmit from jsp then it works fine with server(backend validation)may be this helps you Thanks, Srinivas. O'Shea, Sean Sean.O'[EMAIL PROTECTED] com To user@struts.apache.org 08/12/2006 12:11 cc AM Subject RE: JavaScript validation errors Please respond to Struts Users Mailing List [EMAIL PROTECTED] he.org Hi, I'm not writing the JavaScript code myself, so I cannot include a check like you suggested. The JavaScript is being automatically generated using the html:javascript tag. The generated validateRequired method is taken directly from the commons-validator.jar: function validateRequired(form) { var isValid = true; var focusField = null; var i = 0; var fields = new Array(); var formName = form.getAttributeNode(name); oRequired = eval('new ' + formName.value + '_required()'); for (x in oRequired) { var field = form
RE: JavaScript validation errors
Hi all, It appears a faulty JavaScript function was being plugged in elsewhere in the application. This was causing JavaScript rendering errors when the page loaded. I've removed the faulty script and the client side validation works perfectly. Thanks for all the suggestions Sean -Original Message- From: O'Shea, Sean Sent: Monday, August 14, 2006 10:32 AM To: user@struts.apache.org Subject: RE: JavaScript validation errors Hi Srinivas, I tried setting my login form like this: html:form action=login onsubmit=return validateLoginForm(this); . /html:form html:javascript formName=loginForm/ ... Still no luck in getting the javascript function called though. I've checked the source of the generated page and it looks like the validateLoginForm function is getting generated: function validateLoginForm(form) { if (bCancel) return true; else var formValidationResult; formValidationResult = validateRequired(form); return (formValidationResult == 1); } function loginForm_required () { this.a0 = new Array(SSN, SSN is required., new Function (varName, return this[varName];)); this.a1 = new Array(password, Password is required., new Function (varName, return this[varName];)); } The generated validateRequired function looks like this: function validateRequired(form) { var isValid = true; var focusField = null; var i = 0; var fields = new Array(); var formName = form.getAttributeNode(name); oRequired = eval('new ' + formName.value + '_required()'); . I'm guessing the intent of the eval('new ' + formName.value + '_required()'); line is to call the loginForm_required function? I made a little change to the validateRequired.js in the org.apache.commons.validator.javascript to alert when the function is called: /*$RCSfile: validateRequired.js,v $ $Revision: 1.13 $ $Date: 2004/03/28 16:53:21 $ */ /** * Check to see if fields must contain a value. * Fields are not checked if they are disabled. * p * @param form The form validation is taking place on. */ function validateRequired(form) { alert(Calling required ) . But this doesn't even get called. My browser says that there is an error on line 1081 on the page - looking at this line I see this: //End -- /script My browser says it expects a '}' - it appears that there is a missing closing brace somewhere in the code? Has anyone else come across this problem? Thanks Sean -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, August 14, 2006 5:39 AM To: Struts Users Mailing List Subject: RE: JavaScript validation errors Hi sean, i think if you put onsubmit=return validateLoginForm(this); it works fine with client(front-end validation)side and if you remove onsubmit from jsp then it works fine with server(backend validation)may be this helps you Thanks, Srinivas. O'Shea, Sean Sean.O'[EMAIL PROTECTED] com To user@struts.apache.org 08/12/2006 12:11 cc AM Subject RE: JavaScript validation errors Please respond to Struts Users Mailing List [EMAIL PROTECTED] he.org Hi, I'm not writing the JavaScript code myself, so I cannot include a check like you suggested. The JavaScript is being automatically generated using the html:javascript tag. The generated validateRequired method is taken directly from the commons-validator.jar: function validateRequired(form) { var isValid = true; var focusField = null; var i = 0; var fields = new Array(); var formName = form.getAttributeNode(name); oRequired = eval('new ' + formName.value + '_required()'); for (x in oRequired) { var field = form[oRequired[x][0]]; if ((field.type == 'hidden' || field.type == 'text' || field.type == 'textarea' || field.type == 'file' || field.type == 'checkbox' || field.type == 'select-one' || field.type == 'password') field.disabled == false) { var value = ''; // get field's value if (field.type == select-one) { var si = field.selectedIndex; if (si = 0) { value = field.options[si].value; } } else if (field.type == 'checkbox') { if (field.checked) { value = field.value; } } else { value = field.value; } if (trim(value).length == 0
Re: JavaScript validation errors
Sean- You need to add an onsubmit attribute to your html:form element that calls the validation function. Specifically, IIRC, it needs to say: onsubmit=return validateForm(this); happy coding, -adam O'Shea, Sean wrote: Hi all, I'm using struts 1.2.7 with commons-validator-1.1.4 and I'm running into a few generated JavaScript errors. Here's what my JSP looks like: html:javascript formName=loginForm / html:form action=/login method=POST table border=0 cellspacing=5 tr th align=right bean:message key=login.ssn/: /th td align=left html:text property=SSN/bean:message key=login.correctssn/ /td /tr tr th align=right bean:message key=login.password/: /th td align=left html:password property=password/bean:message key=login.correctpw/ /td /tr tr td align=right input type=submit value=bean:message key=login.button// /td td align=left input type=reset/ /td /tr /table /html:form Here's what my action mapping looks like: action path=/login name=loginForm type=LoginAction scope=request validate=true input=login . /action This is what my form bean looks like: form-bean name=loginForm type=org.apache.struts.validator.DynaValidatorForm form-property name=SSN type=java.lang.String / form-property name=password type=java.lang.String / /form-bean My form validations look like this: form name=loginForm field property=SSN depends=required arg key=login.ssn position=0/ /field field property=password depends=required arg key=login.password position=0/ /field /form When I try to submit my loginForm. my server die validations work fine, but the JavaScript does not get executed. From looking at the generated source I see this: script type=text/javascript language=Javascript1.1 !-- Begin var bCancel = false; function validateLoginForm(form) { if (bCancel) return true; else var formValidationResult; formValidationResult = validateRequired(form); return (formValidationResult == 1); } function loginForm_required () { this.a0 = new Array(SSN, SSN is required., new Function (varName, return this[varName];)); this.a1 = new Array(password, Password is required., new Function (varName, return this[varName];)); } Either the JavaScript is not getting called, or the generated JavaScript does not match up. Could it be something to do with the html:javasctipt tag? Looking at the source I have for the JavascriptValidatorTag class I see this version: * $Id: JavascriptValidatorTag.java 165208 2005-04-28 21:41:45Z mrdon $ All help would be greatly appreciated. Thanks Sean - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JavaScript validation errors
Hi Adam, I changed my login form to look like this: html:form action=/login method=POST onsubmit=return validateLoginForm(this); table border=0 cellspacing=5 tr th align=right bean:message key=login.ssn/: /th td align=left html:text property=SSN/bean:message key=login.correctssn/ /td /tr tr th align=right bean:message key=login.password/: /th td align=left html:password property=password/bean:message key=login.correctpw/ /td /tr tr td align=right input type=submit value=bean:message key=login.button// /td td align=left input type=reset/ /td /tr /table /html:form But still no luck. My server side validation still works fine, but the client side validation does not seem to execute. Even when I look at the source for my JSP I can see the call to the JavaScript function: form name=loginForm method=POST action=/MySampleApp/sample/login onsubmit=return validateLoginForm(this); Its as if the variables are not getting loaded into the JavaScript function, or the function is not getting called at all. Anyone have any ideas on this? Thanks again Sean -Original Message- From: Adam Gordon [mailto:[EMAIL PROTECTED] Sent: Friday, August 11, 2006 11:56 AM To: Struts Users Mailing List Subject: Re: JavaScript validation errors Sean- You need to add an onsubmit attribute to your html:form element that calls the validation function. Specifically, IIRC, it needs to say: onsubmit=return validateForm(this); happy coding, -adam O'Shea, Sean wrote: Hi all, I'm using struts 1.2.7 with commons-validator-1.1.4 and I'm running into a few generated JavaScript errors. Here's what my JSP looks like: html:javascript formName=loginForm / html:form action=/login method=POST table border=0 cellspacing=5 tr th align=right bean:message key=login.ssn/: /th td align=left html:text property=SSN/bean:message key=login.correctssn/ /td /tr tr th align=right bean:message key=login.password/: /th td align=left html:password property=password/bean:message key=login.correctpw/ /td /tr tr td align=right input type=submit value=bean:message key=login.button// /td td align=left input type=reset/ /td /tr /table /html:form Here's what my action mapping looks like: action path=/login name=loginForm type=LoginAction scope=request validate=true input=login . /action This is what my form bean looks like: form-bean name=loginForm type=org.apache.struts.validator.DynaValidatorForm form-property name=SSN type=java.lang.String / form-property name=password type=java.lang.String / /form-bean My form validations look like this: form name=loginForm field property=SSN depends=required arg key=login.ssn position=0/ /field field property=password depends=required arg key=login.password position=0/ /field /form When I try to submit my loginForm. my server die validations work fine, but the JavaScript does not get executed. From looking at the generated source I see this: script type=text/javascript language=Javascript1.1 !-- Begin var bCancel = false; function validateLoginForm(form) { if (bCancel) return true; else var formValidationResult; formValidationResult = validateRequired(form); return (formValidationResult == 1); } function loginForm_required () { this.a0 = new Array(SSN, SSN is required., new Function (varName, return this[varName];)); this.a1 = new Array(password, Password is required., new Function (varName, return this[varName];)); } Either the JavaScript is not getting called, or the generated JavaScript does not match up. Could it be something to do with the html:javasctipt tag? Looking at the source I have for the JavascriptValidatorTag class I see this version: * $Id: JavascriptValidatorTag.java 165208 2005-04-28 21:41:45Z mrdon $ All help would be greatly appreciated. Thanks Sean - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL
Re: JavaScript validation errors
Are you returning false when there is an error in the validation? if(userName.trim().length() == 0){ alert(Pathetic, technologically inept users must enter a user name.); return false; } On 8/11/06, O'Shea, Sean Sean.O'[EMAIL PROTECTED] wrote: Hi Adam, I changed my login form to look like this: html:form action=/login method=POST onsubmit=return validateLoginForm(this); table border=0 cellspacing=5 tr th align=right bean:message key=login.ssn/: /th td align=left html:text property=SSN/bean:message key=login.correctssn/ /td /tr tr th align=right bean:message key=login.password/: /th td align=left html:password property=password/bean:message key=login.correctpw/ /td /tr tr td align=right input type=submit value=bean:message key=login.button// /td td align=left input type=reset/ /td /tr /table /html:form But still no luck. My server side validation still works fine, but the client side validation does not seem to execute. Even when I look at the source for my JSP I can see the call to the JavaScript function: form name=loginForm method=POST action=/MySampleApp/sample/login onsubmit=return validateLoginForm(this); Its as if the variables are not getting loaded into the JavaScript function, or the function is not getting called at all. Anyone have any ideas on this? Thanks again Sean -Original Message- From: Adam Gordon [mailto:[EMAIL PROTECTED] Sent: Friday, August 11, 2006 11:56 AM To: Struts Users Mailing List Subject: Re: JavaScript validation errors Sean- You need to add an onsubmit attribute to your html:form element that calls the validation function. Specifically, IIRC, it needs to say: onsubmit=return validateForm(this); happy coding, -adam O'Shea, Sean wrote: Hi all, I'm using struts 1.2.7 with commons-validator-1.1.4 and I'm running into a few generated JavaScript errors. Here's what my JSP looks like: html:javascript formName=loginForm / html:form action=/login method=POST table border=0 cellspacing=5 tr th align=right bean:message key=login.ssn/: /th td align=left html:text property=SSN/bean:message key=login.correctssn/ /td /tr tr th align=right bean:message key=login.password/: /th td align=left html:password property=password/bean:message key=login.correctpw/ /td /tr tr td align=right input type=submit value=bean:message key=login.button// /td td align=left input type=reset/ /td /tr /table /html:form Here's what my action mapping looks like: action path=/login name=loginForm type=LoginAction scope=request validate=true input=login . /action This is what my form bean looks like: form-bean name=loginForm type=org.apache.struts.validator.DynaValidatorForm form-property name=SSN type=java.lang.String / form-property name=password type=java.lang.String / /form-bean My form validations look like this: form name=loginForm field property=SSN depends=required arg key=login.ssn position=0/ /field field property=password depends=required arg key=login.password position=0/ /field /form When I try to submit my loginForm. my server die validations work fine, but the JavaScript does not get executed. From looking at the generated source I see this: script type=text/javascript language=Javascript1.1 !-- Begin var bCancel = false; function validateLoginForm(form) { if (bCancel) return true; else var formValidationResult; formValidationResult = validateRequired(form); return (formValidationResult == 1); } function loginForm_required () { this.a0 = new Array(SSN, SSN is required., new Function (varName, return this[varName];)); this.a1 = new Array(password, Password is required., new Function (varName, return this[varName];)); } Either the JavaScript is not getting called, or the generated JavaScript does not match up. Could it be something to do with the html:javasctipt tag? Looking at the source I have for the JavascriptValidatorTag class I see this version: * $Id: JavascriptValidatorTag.java 165208 2005-04-28 21:41:45Z mrdon $ All help would be greatly appreciated. Thanks Sean - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
RE: JavaScript validation errors
Hi, I'm not writing the JavaScript code myself, so I cannot include a check like you suggested. The JavaScript is being automatically generated using the html:javascript tag. The generated validateRequired method is taken directly from the commons-validator.jar: function validateRequired(form) { var isValid = true; var focusField = null; var i = 0; var fields = new Array(); var formName = form.getAttributeNode(name); oRequired = eval('new ' + formName.value + '_required()'); for (x in oRequired) { var field = form[oRequired[x][0]]; if ((field.type == 'hidden' || field.type == 'text' || field.type == 'textarea' || field.type == 'file' || field.type == 'checkbox' || field.type == 'select-one' || field.type == 'password') field.disabled == false) { var value = ''; // get field's value if (field.type == select-one) { var si = field.selectedIndex; if (si = 0) { value = field.options[si].value; } } else if (field.type == 'checkbox') { if (field.checked) { value = field.value; } } else { value = field.value; } if (trim(value).length == 0) { if (i == 0) { focusField = field; } fields[i++] = oRequired[x][1]; isValid = false; } } else if (field.type == select-multiple) { var numOptions = field.options.length; lastSelected=-1; for(loop=numOptions-1;loop=0;loop--) { if(field.options[loop].selected) { lastSelected = loop; value = field.options[loop].value; break; } } if(lastSelected 0 || trim(value).length == 0) { if(i == 0) { focusField = field; } fields[i++] = oRequired[x][1]; isValid=false; } } else if ((field.length 0) (field[0].type == 'radio' || field[0].type == 'checkbox')) { isChecked=-1; for (loop=0;loop field.length;loop++) { if (field[loop].checked) { isChecked=loop; break; // only one needs to be checked } } if (isChecked 0) { if (i == 0) { focusField = field[0]; } fields[i++] = oRequired[x][1]; isValid=false; } } } if (fields.length 0) { focusField.focus(); alert(fields.join('\n')); } return isValid; } // Trim whitespace from left and right sides of s. function trim(s) { return s.replace( /^\s*/, ).replace( /\s*$/, ); } Sean -Original Message- From: Monkeyden [mailto:[EMAIL PROTECTED] Sent: Friday, August 11, 2006 1:57 PM To: Struts Users Mailing List Subject: Re: JavaScript validation errors Are you returning false when there is an error in the validation? if(userName.trim().length() == 0){ alert(Pathetic, technologically inept users must enter a user name.); return false; } On 8/11/06, O'Shea, Sean Sean.O'[EMAIL PROTECTED] wrote: Hi Adam, I changed my login form to look like this: html:form action=/login method=POST onsubmit=return validateLoginForm(this); table border=0 cellspacing=5 tr th align=right bean:message key=login.ssn/: /th td align=left html:text property=SSN/bean:message key=login.correctssn/ /td /tr tr th align=right bean:message key=login.password/: /th td align=left html:password property=password/bean:message key=login.correctpw/ /td /tr tr td align=right input type=submit value=bean:message key=login.button// /td td align=left input type=reset/ /td /tr /table /html:form But still no luck. My server side validation still works fine, but the client side validation does not seem to execute. Even when I look at the source for my JSP I can see the call to the JavaScript function: form name=loginForm method=POST action=/MySampleApp/sample/login onsubmit=return validateLoginForm(this); Its as if the variables are not getting loaded into the JavaScript function, or the function is not getting called at all
RE: Javascript problem, how to control special characters from being entered into textbox
If you want to allow only characters and digits, you need not know keycodes of all the special characters. Just compare the characters' and digits' ASCII values with the character entered on OnKeyUp event. If it's a special character, just drop it. You can also use java.util.regex.Pattern and java.util.regex.Matcher classes at server side. -Original Message- From: Medicherla Lakshmi [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 27, 2006 2:29 PM To: Struts Users Mailing List Subject: Javascript problem, how to control special characters from being entered into textbox Hi, I hava a javascript problem. I need to restrict anyone entering special characters into a textbox which is there in my html. I know that i can use onKeyPress event to handle this, but for this i need to know the keycodes. Please anyone tel me if there is any other way to handle this or tel me how to know the keycodes of the characters, so that i can use it. Also, i have to restrict the textboxes with characters and then digits. Thanks in advance. - Yahoo! India Answers: Share what you know. Learn something new Click here Catch all the FIFA World Cup 2006 action on Yahoo! India Click here - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: javascript help using html:image
need help with this please. From: fea jabi [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org To: user@struts.apache.org Subject: javascript help Date: Mon, 26 Jun 2006 15:20:26 -0400 function setMethodNameCopy() { var copylbl = 'fmt:message key=lbl.copy bundle=${appbundle}/'; var mtd=document.getElementById(mtdID); mtd.value = copylbl; return; } JSP: html:hidden name=Form property=act styleId=mtdID/ html:hidden name=Form property=custID styleId=custStyID/ display:table name=sessionScope.Form.customers id=custs requestURI=PrepareAction.do defaultsort=7 pagesize=6 display:column html:image src=images/copy.gif styleId=copyImgID onclick=setMethodNameCopy();/ /display:column . ... /display:table When the user clicks on the image want to assign hidden property custID to displaytags ${custs.custID } want to pass this value to the dispatch action to copy that cust obj. how to do this? thanks. _ Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Javascript problem, how to control special characters from being entered into textbox
You could also check to see if the keycode is in a range. See the table below. With a quick search, I found a javascript that will check it. codes 48-57 are numbers 0-9, codes 65-90 are upper letters A-B, codes 97-122 are lower letters a-z. ASCII table http://www.newebgroup.com/rod/newillusions/ascii.htm The JS http://javascript.internet.com/miscellaneous/ascii-character-code.html On 6/27/06, Mukta [EMAIL PROTECTED] wrote: If you want to allow only characters and digits, you need not know keycodes of all the special characters. Just compare the characters' and digits' ASCII values with the character entered on OnKeyUp event. If it's a special character, just drop it. You can also use java.util.regex.Pattern and java.util.regex.Matcherclasses at server side. -Original Message- From: Medicherla Lakshmi [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 27, 2006 2:29 PM To: Struts Users Mailing List Subject: Javascript problem, how to control special characters from being entered into textbox Hi, I hava a javascript problem. I need to restrict anyone entering special characters into a textbox which is there in my html. I know that i can use onKeyPress event to handle this, but for this i need to know the keycodes. Please anyone tel me if there is any other way to handle this or tel me how to know the keycodes of the characters, so that i can use it. Also, i have to restrict the textboxes with characters and then digits. Thanks in advance. - Yahoo! India Answers: Share what you know. Learn something new Click here Catch all the FIFA World Cup 2006 action on Yahoo! India Click here - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Javascript problem, how to control special characters from being entered into textbox
You might also consider the StringContentValid tag in the JSTags taglib from Java Web Parts: http://javawebparts.sourceforge.net Specifically: http://javawebparts.sourceforge.net/javadocs/javawebparts/taglib/jstags/StringContentValidTag.html I *think* you can do: input type=text onKeyUp=return JWPStringContentValid(this.value, 'abc123', JWPSCV_FROMLIST); Replace 'abc123' with only those characters you want to be allowed, and that should do it. If it happens to not work that way, try: input type=text onKeyUp=v=this.value;if (!JWPStringContentValid(this.value, 'abc123', JWPSCV_FROMLIST)){this.value=v;} Only slightly more effort that way :) Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: [EMAIL PROTECTED] Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Tue, June 27, 2006 1:41 pm, Monkeyden wrote: You could also check to see if the keycode is in a range. See the table below. With a quick search, I found a javascript that will check it. codes 48-57 are numbers 0-9, codes 65-90 are upper letters A-B, codes 97-122 are lower letters a-z. ASCII table http://www.newebgroup.com/rod/newillusions/ascii.htm The JS http://javascript.internet.com/miscellaneous/ascii-character-code.html On 6/27/06, Mukta [EMAIL PROTECTED] wrote: If you want to allow only characters and digits, you need not know keycodes of all the special characters. Just compare the characters' and digits' ASCII values with the character entered on OnKeyUp event. If it's a special character, just drop it. You can also use java.util.regex.Pattern and java.util.regex.Matcherclasses at server side. -Original Message- From: Medicherla Lakshmi [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 27, 2006 2:29 PM To: Struts Users Mailing List Subject: Javascript problem, how to control special characters from being entered into textbox Hi, I hava a javascript problem. I need to restrict anyone entering special characters into a textbox which is there in my html. I know that i can use onKeyPress event to handle this, but for this i need to know the keycodes. Please anyone tel me if there is any other way to handle this or tel me how to know the keycodes of the characters, so that i can use it. Also, i have to restrict the textboxes with characters and then digits. Thanks in advance. - Yahoo! India Answers: Share what you know. Learn something new Click here Catch all the FIFA World Cup 2006 action on Yahoo! India Click here - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javascript in mozilla
hi adam,everyrhing is ther in my project but still the same code works in IE but not in firefox. On 4/19/06, Adam Hardy [EMAIL PROTECTED] wrote: Chaitanya Parkhi on 19/04/06 05:59, wrote: hi guys,i m facing a problem tha javascript is not working in mozilla firefox 1.0 ,i came to know about a java file which has 2 b added in src of struts framework a tab in javascript file,i m not getting yhat can anybody pls tell me about it!!! let me guess - you are talking about validator-rules.xml? Grab it from the struts download and put it in your WEB-INF. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javascript in mozilla
So my guess was close - you are talking about validation? Chaitanya Parkhi on 20/04/06 10:45, wrote: hi adam,everyrhing is ther in my project but still the same code works in IE but not in firefox. On 4/19/06, Adam Hardy [EMAIL PROTECTED] wrote: Chaitanya Parkhi on 19/04/06 05:59, wrote: hi guys,i m facing a problem tha javascript is not working in mozilla firefox 1.0 ,i came to know about a java file which has 2 b added in src of struts framework a tab in javascript file,i m not getting yhat can anybody pls tell me about it!!! let me guess - you are talking about validator-rules.xml? Grab it from the struts download and put it in your WEB-INF. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: javascript editor
script type=text/JavaScript src=/path/nameofjavascriptfile.js/ __ Senior Programmer Analyst, Tax Distributed Systems Development Tax Compliance Development, ADP IT Phone: (909) 592-6411 Ext. 3863 e-mail: [EMAIL PROTECTED] -Original Message- From: gomathi [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 21, 2006 7:56 PM To: user@struts.apache.org Subject: javascript editor Hi I have installed myeclipse 4.1 and eclipse 3.1.How to call javascript file from jsp.Any body knows sample file. kindly Regards gomes - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - This message and any attachments are intended only for the use of the addressee and may contain information that is privileged and confidential. If the reader of the message is not the intended recipient or an authorized representative of the intended recipient, you are hereby notified that any dissemination of this communication is strictly prohibited. If you have received this communication in error, notify the sender immediately by return email and delete the message and any attachments from your system. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javascript in validator -- html:javascript
why, if I can write a javascript in validator-rules.xml, I should be able to able to get the dialog right. using confirm of javascript. if I give below in jsp html:javascript formName=SetupForm dynamicJavascript=true staticJavascript=true / it works fine. But I observed that the javascript is generated on client side. Which I don't want. Is there a way to execute the javascript on server-side? What are these dynamicJavascript and staticJavascript. When should these be set to true? My application requirement is the users may not have javascript enabled on their browsers. Can I still use this html:javascript. Or is there any oher alternative to do this? in validator-rules.xml validator name=populate classname=org.apache.struts.validator.FieldChecks method=changeInPopulate methodParams=java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest depends= msg=errors.setup javascript ![CDATA[ function changeInPopulate(autoPop){ var yesObj = document.getElementById(yesID); var noObj = document.getElementById(noID); if( (autoPop (yesObj.checked)) || (!autoPop (noObj.checked)) ) { return; } var answer = confirm(are you sure); if(!answer) { if(yesObj.checked) { noObj.checked=true; }else { yesObj.checked=true; } } } ]] /javascript /validator Thanks. From: Laurie Harper [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: user@struts.apache.org Subject: Re: javascript in validator Date: Tue, 22 Nov 2005 23:43:57 -0500 fea jabi wrote: One of the requirement in my application is that I should not use the client side javascript as the browsers the user use might not have the javascript enabled in their browsers. In my jsp there are 2 radio buttons. one of which is enable by default. When the user clicks on either of those he/she should be promted with some message depending on which radio button they pressed Yes/No. Using DynaValidatorForm. Can I do this in struts validator xml? if so how to do this? No, validator can check if a form is valid but it doesn't provide a way to generate arbitrary prompts and dialogs. Assuming you want something like an 'Are you sure you want to change this option? yes/no' prompt, you'll need to do that as a separate page. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Dont just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javascript in validator -- html:javascript
fea jabi wrote: Is there a way to execute the javascript on server-side? Um... Simple answer is no. My application requirement is the users may not have javascript enabled on their browsers. Can I still use this html:javascript. Or is there any oher alternative to do this? I think you're confused about JavaScript in regards to server-side/client-side. JavaScript runs in the browser. If it's not enabled in the browser then JavaScript won't work. You can validate things server-side, but it's different behavior: server-side validation runs after a submit. That said, AJAX means that isn't necessarily true anymore and there's all sorts of games you can play with that, if you think you're up to it. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javascript in validator -- html:javascript
Dave Newton wrote: JavaScript runs in the browser. If it's not enabled in the browser then JavaScript won't work. There *was* in fact a server-side Javascript technology at one point, but it was short-lived, not used much and IIRC specific to Netscape's old web servers. I had the misfortune of having to deal with in app developed in it probably seven or so years ago... not pleasant :) (Not that this is relevant really, just an interesting historical footnote I suppose) Frank - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javascript in validator -- html:javascript
Frank W. Zammetti wrote: There *was* in fact a server-side Javascript technology at one point, but it was short-lived, not used much and IIRC specific to Netscape's old web servers. I had the misfortune of having to deal with in app developed in it probably seven or so years ago... not pleasant :) Yeah. I figured the OP was confused enough as it was and spared him :D Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javascript in validator
fea jabi wrote: One of the requirement in my application is that I should not use the client side javascript as the browsers the user use might not have the javascript enabled in their browsers. In my jsp there are 2 radio buttons. one of which is enable by default. When the user clicks on either of those he/she should be promted with some message depending on which radio button they pressed Yes/No. Using DynaValidatorForm. Can I do this in struts validator xml? if so how to do this? No, validator can check if a form is valid but it doesn't provide a way to generate arbitrary prompts and dialogs. Assuming you want something like an 'Are you sure you want to change this option? yes/no' prompt, you'll need to do that as a separate page. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JavaScript file in JSP with Struts
Thank you very much, I solved the problem. Francisco - São Paulo - Brazil escreveu: Hi all, How can I insert/use an .JS (javaScript) file in my .jsp which is using Struts? I have this: script.js: alert('testing...'); in my .jsp : ... head script type=text/javascript src=script.js/script /head But nothing happens whey I run the JSP file. It should show a window dialog saying testing..., right? PS. Both, .js and .jsp are in the same folder Thanks ___ Novo Yahoo! Messenger com voz: ligações, Yahoo! Avatars, novos emoticons e muito mais. Instale agora! www.yahoo.com.br/messenger/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ___ Novo Yahoo! Messenger com voz: ligações, Yahoo! Avatars, novos emoticons e muito mais. Instale agora! www.yahoo.com.br/messenger/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Javascript + Struts html:hidden write='true' tag problem
Thanks for your response. In the code in question, disabled is a local variable passed in as a parameter on the function, and does not refer to the form properties state. Although, this may lead to a hint of the 'reserved word' behavior I was trying to track. I suspected 'locked' was the culprit, but this gives me another avenue to test. Thanks! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Saturday, August 06, 2005 1:46 AM To: Struts Users Mailing List Subject: Re: Javascript + Struts html:hidden write='true' tag problem Duane, As far as I understand, disabled is a property of the form which should be denoted as document.forms[0].disabled and not just by disabled as you have done in if(disabled ==true ) change it to: if( document.forms[0].disabled == true ) and it should work. This is the reason the if(...) is always evaluating to false (i.e the 'else' case). Amitava Basak ASE Tata Consultancy Services Limited Mailto: [EMAIL PROTECTED] Website: http://www.tcs.com Duane Rosengartner [EMAIL PROTECTED] 08/06/2005 12:13 AM Please respond to Struts Users Mailing List user@struts.apache.org To struts-user@jakarta.apache.org cc Subject Javascript + Struts html:hidden write='true' tag problem I have the following Javascript primarily used to manipulate a CSS style and make a portion of a form visible. In the process, the achor invoking the JavaScript passes parameters from a table Row(resultset) displayed. In this Row, I have two bean properties declared as Java type Boolean. The toString() on the link resolves to 'true'/'false' correctly. I have placed alert tags in the javascript and have determined that the 'if' statements are working correctly also. The problem is that the two properties are behaving differently in the view, for reasons I cannot pin down. document.forms[0].disabled shows the correct status of the Row, document.forms[0].locked always shows false. I suspected 'locked' may be a reserved word, but have rewritten the bean and supporting code to rename the property, and this has had no effect. Things that DO WORK: The link is passing the correct values to JS, No JS error being thrown, as it would if the form property were not found. The visible, not visible works, also a checkbox instead shows the appropriate checked/not checked condition, so I can assume a page refresh is not the issue. Any other debug tips would be appreciated. Javascript: function PortalFilterForm_AccountDetails(rowId,rewardSummaryId,pin,inUse,disabled ) { //alert(rowId = + rowId + \nrewardSummaryId = + rewardSummaryId + \ninUse = + inUse + \ndisabled = + disabled); var detailElement = document.getElementById(accountDetail); detailElement.style.visibility = visible; var rid = document.getElementById(rid); rid.innerHTML = rowId; document.forms[0].rewardSummaryId.value = rewardSummaryId; document.forms[0].pin.value = pin; if(inUse == true){ document.forms[0].locked.checked = true; //alert(evaluated true); } else{ document.forms[0].locked.checked = false; //alert(evaluated false); } if(disabled == true) document.forms[0].disabled.checked = true; else document.forms[0].disabled.checked = false; //document.forms[0].locked.value = inUse; //document.forms[0].disabled.value = disabled; // also tried: //document.forms[0].locked.value = inUse + ; //document.forms[0].disabled.value = disabled + ; } JSP - Note the commented out code does not work (hidden write=true). The checkbox does work on both.. (Boolean type on both) ( Struts API says HTML:hidden requires String, but Boolean can be cast, and remember I have one working property, plus one not working ? ? ) td align=left width=15% %--html:hidden property=locked write=true/ --% html:checkbox property=locked disabled=true/ /td td align=right class=form-td-label width=15%span class=form-element-label Disabled /span/td td align=left %--html:hidden property=disabled write=true/--% html:checkbox property=disabled disabled=true/ /td * * a href=javascript:PortalFilterForm_AccountDetails(${row_rowNum},${row.rew ardSummaryId},${row.acctId},${row.inUse},${row.disabled}); class=fancy %=pageContext.getAttribute(row_rowNum)%/a ForwardSourceID:NT7576 Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you
Re: Javascript + Struts html:hidden write='true' tag problem
Duane, As far as I understand, disabled is a property of the form which should be denoted as document.forms[0].disabled and not just by disabled as you have done in if(disabled ==true ) change it to: if( document.forms[0].disabled == true ) and it should work. This is the reason the if(...) is always evaluating to false (i.e the 'else' case). Amitava Basak ASE Tata Consultancy Services Limited Mailto: [EMAIL PROTECTED] Website: http://www.tcs.com Duane Rosengartner [EMAIL PROTECTED] 08/06/2005 12:13 AM Please respond to Struts Users Mailing List user@struts.apache.org To struts-user@jakarta.apache.org cc Subject Javascript + Struts html:hidden write='true' tag problem I have the following Javascript primarily used to manipulate a CSS style and make a portion of a form visible. In the process, the achor invoking the JavaScript passes parameters from a table Row(resultset) displayed. In this Row, I have two bean properties declared as Java type Boolean. The toString() on the link resolves to 'true'/'false' correctly. I have placed alert tags in the javascript and have determined that the 'if' statements are working correctly also. The problem is that the two properties are behaving differently in the view, for reasons I cannot pin down. document.forms[0].disabled shows the correct status of the Row, document.forms[0].locked always shows false. I suspected 'locked' may be a reserved word, but have rewritten the bean and supporting code to rename the property, and this has had no effect. Things that DO WORK: The link is passing the correct values to JS, No JS error being thrown, as it would if the form property were not found. The visible, not visible works, also a checkbox instead shows the appropriate checked/not checked condition, so I can assume a page refresh is not the issue. Any other debug tips would be appreciated. Javascript: function PortalFilterForm_AccountDetails(rowId,rewardSummaryId,pin,inUse,disabled ) { //alert(rowId = + rowId + \nrewardSummaryId = + rewardSummaryId + \ninUse = + inUse + \ndisabled = + disabled); var detailElement = document.getElementById(accountDetail); detailElement.style.visibility = visible; var rid = document.getElementById(rid); rid.innerHTML = rowId; document.forms[0].rewardSummaryId.value = rewardSummaryId; document.forms[0].pin.value = pin; if(inUse == true){ document.forms[0].locked.checked = true; //alert(evaluated true); } else{ document.forms[0].locked.checked = false; //alert(evaluated false); } if(disabled == true) document.forms[0].disabled.checked = true; else document.forms[0].disabled.checked = false; //document.forms[0].locked.value = inUse; //document.forms[0].disabled.value = disabled; // also tried: //document.forms[0].locked.value = inUse + ; //document.forms[0].disabled.value = disabled + ; } JSP - Note the commented out code does not work (hidden write=true). The checkbox does work on both.. (Boolean type on both) ( Struts API says HTML:hidden requires String, but Boolean can be cast, and remember I have one working property, plus one not working ? ? ) td align=left width=15% %--html:hidden property=locked write=true/ --% html:checkbox property=locked disabled=true/ /td td align=right class=form-td-label width=15%span class=form-element-label Disabled /span/td td align=left %--html:hidden property=disabled write=true/--% html:checkbox property=disabled disabled=true/ /td * * a href=javascript:PortalFilterForm_AccountDetails(${row_rowNum},${row.rew ardSummaryId},${row.acctId},${row.inUse},${row.disabled}); class=fancy %=pageContext.getAttribute(row_rowNum)%/a ForwardSourceID:NT7576 Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you
Re: JavaScript question?
Hi Sezhiyan, There isn't any standard way of doing this... what's happening is that the request is coming back just like any other would that updates what the user sees. As you mentioned though, the save as dialog appears instead... there is no event you can hook that will tell you when the page is loaded because, in essence, the browser is expecting a new page that would overwrite any event you could hook even if one existed. There's a couple of ways I can think of to do this... (1) Perhaps the easiest is to target your form submission (or link) that gets the CSV to _new. This will open a popup that will be the target of the return... since it's a save as dialog, the popup should, I believe, go away, leaving just the save as dialog. This wouldn't help you determine when to change back to the default cursor though... you could kick off a timer to change it back in a few seconds. Before I forget, note that changing to an hourglass isn't stopping the user from clicking more than once, it's just a visual cue that they shouldn't. You may want to disable the button instead of changing cursors. The same problem of knowing when to change back applies though :) (2) Use AJAX to get the CSV, then display it to the user, perhaps in a new window, perhaps in a div on the same page. You'll know exactly when to switch the cursor back in this case. (3) If you can use frames, have a hidden frame (cols/rows=0) and target that... you can then kick off a timer in your main frame that checks the document status. When its complete, change the cursor back. (4) Kind of a hybrid of 1 and 3... open a new window, and in response to onLoad, make the call that gets the CSV... Put a message that says After the Save As dialog appears, please click here and when they click here, call a function back in the parent window that resets the cursor. Hope that helps! Frank Balasubramaniam, Sezhiyan wrote: Though this is not a direct struts question, hope I will some guidance for my issue. In one of our struts application, we have a CSV download functionality. We use response.setContentType(application/csv;). When the download happens, user has no clue about the state of the request and keeps on clicking the submit button. So we changed cursor to hour-glass on the form submit. This technique works well with the other pages where response shown in the browser itself. But in the csv download, the page stays as it is, but the response comes as a windows dialog for saving it or to open it. What happens is, even after the download, the mouse stays as hourglass. Can somebody advice me, which event, we have to look for, to turn the mouse to default, after the page download? Thanks in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: JavaScript question?
Hi Frank, Thanks a lot for taking time to explain the options. Based on our requirements, the option 3 looks more promising to me (we already use frames for this solution) BTW, is there anyway, I can check the child window document status from the main widow, in this case? As the result comes in the dialog, which event or attribute may indicate the main window about the successful csv download on the child window? As a note, we took care of multiple submissions by disabling the button. Once again thanks. -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Monday, July 25, 2005 4:10 PM To: Struts Users Mailing List Subject: Re: JavaScript question? Hi Sezhiyan, There isn't any standard way of doing this... what's happening is that the request is coming back just like any other would that updates what the user sees. As you mentioned though, the save as dialog appears instead... there is no event you can hook that will tell you when the page is loaded because, in essence, the browser is expecting a new page that would overwrite any event you could hook even if one existed. There's a couple of ways I can think of to do this... (1) Perhaps the easiest is to target your form submission (or link) that gets the CSV to _new. This will open a popup that will be the target of the return... since it's a save as dialog, the popup should, I believe, go away, leaving just the save as dialog. This wouldn't help you determine when to change back to the default cursor though... you could kick off a timer to change it back in a few seconds. Before I forget, note that changing to an hourglass isn't stopping the user from clicking more than once, it's just a visual cue that they shouldn't. You may want to disable the button instead of changing cursors. The same problem of knowing when to change back applies though :) (2) Use AJAX to get the CSV, then display it to the user, perhaps in a new window, perhaps in a div on the same page. You'll know exactly when to switch the cursor back in this case. (3) If you can use frames, have a hidden frame (cols/rows=0) and target that... you can then kick off a timer in your main frame that checks the document status. When its complete, change the cursor back. (4) Kind of a hybrid of 1 and 3... open a new window, and in response to onLoad, make the call that gets the CSV... Put a message that says After the Save As dialog appears, please click here and when they click here, call a function back in the parent window that resets the cursor. Hope that helps! Frank Balasubramaniam, Sezhiyan wrote: Though this is not a direct struts question, hope I will some guidance for my issue. In one of our struts application, we have a CSV download functionality. We use response.setContentType(application/csv;). When the download happens, user has no clue about the state of the request and keeps on clicking the submit button. So we changed cursor to hour-glass on the form submit. This technique works well with the other pages where response shown in the browser itself. But in the csv download, the page stays as it is, but the response comes as a windows dialog for saving it or to open it. What happens is, even after the download, the mouse stays as hourglass. Can somebody advice me, which event, we have to look for, to turn the mouse to default, after the page download? Thanks in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JavaScript question?
The property document.readyState can be used to get the current status of any document... I forget all the possible states it can return, I always only check for complete to trigger some event when the page loads. You can use this to check the status of the child window as long as you keep a reference to it when you open it. I don't think this will work if you simply load the CSV into the child though... Give it a try, but I'm not sure when readyState will return complete, assuming it does at all, when a save as dialog is in play. Frank Balasubramaniam, Sezhiyan wrote: Hi Frank, Thanks a lot for taking time to explain the options. Based on our requirements, the option 3 looks more promising to me (we already use frames for this solution) BTW, is there anyway, I can check the child window document status from the main widow, in this case? As the result comes in the dialog, which event or attribute may indicate the main window about the successful csv download on the child window? As a note, we took care of multiple submissions by disabling the button. Once again thanks. -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Monday, July 25, 2005 4:10 PM To: Struts Users Mailing List Subject: Re: JavaScript question? Hi Sezhiyan, There isn't any standard way of doing this... what's happening is that the request is coming back just like any other would that updates what the user sees. As you mentioned though, the save as dialog appears instead... there is no event you can hook that will tell you when the page is loaded because, in essence, the browser is expecting a new page that would overwrite any event you could hook even if one existed. There's a couple of ways I can think of to do this... (1) Perhaps the easiest is to target your form submission (or link) that gets the CSV to _new. This will open a popup that will be the target of the return... since it's a save as dialog, the popup should, I believe, go away, leaving just the save as dialog. This wouldn't help you determine when to change back to the default cursor though... you could kick off a timer to change it back in a few seconds. Before I forget, note that changing to an hourglass isn't stopping the user from clicking more than once, it's just a visual cue that they shouldn't. You may want to disable the button instead of changing cursors. The same problem of knowing when to change back applies though :) (2) Use AJAX to get the CSV, then display it to the user, perhaps in a new window, perhaps in a div on the same page. You'll know exactly when to switch the cursor back in this case. (3) If you can use frames, have a hidden frame (cols/rows=0) and target that... you can then kick off a timer in your main frame that checks the document status. When its complete, change the cursor back. (4) Kind of a hybrid of 1 and 3... open a new window, and in response to onLoad, make the call that gets the CSV... Put a message that says After the Save As dialog appears, please click here and when they click here, call a function back in the parent window that resets the cursor. Hope that helps! Frank Balasubramaniam, Sezhiyan wrote: Though this is not a direct struts question, hope I will some guidance for my issue. In one of our struts application, we have a CSV download functionality. We use response.setContentType(application/csv;). When the download happens, user has no clue about the state of the request and keeps on clicking the submit button. So we changed cursor to hour-glass on the form submit. This technique works well with the other pages where response shown in the browser itself. But in the csv download, the page stays as it is, but the response comes as a windows dialog for saving it or to open it. What happens is, even after the download, the mouse stays as hourglass. Can somebody advice me, which event, we have to look for, to turn the mouse to default, after the page download? Thanks in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: javascript
Vijay K Anand wrote: Hi This code is not actually translating html:button property=Create value=Create styleClass=NPIButton onclick=javascript:location.href=\'html:rewrite page='/portfoliomgmt'/\' / how do i do it? You can't embed tags in other tags... Off the top of my head try something like: bean:define id=onClickUrljavascript:location.href='html:rewrite page=/portfoliomgmt /'/bean:define html:button property=Create value=Create styleClass=NPIButton onclick=%=onClickUrl% / Cheers, -- Bob Arnott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javascript
Hi All I used the same way you have said bean:define id=create_portfoliojavascript:location.href='html:rewrite page=/portfoliomgmt/'/bean:define html:button property=Create value=Create styleClass=NPIButton onclick=%=create_portfolio % / html code generated is input type=button name=Create value=Create onclick=javascript:location.href='/portfoliomgmt' class=NPIButton but the problem is .do missing ... Any help brotheres? Bob Arnott wrote: Vijay K Anand wrote: Hi This code is not actually translating html:button property=Create value=Create styleClass=NPIButton onclick=javascript:location.href=\'html:rewrite page='/portfoliomgmt'/\' / how do i do it? You can't embed tags in other tags... Off the top of my head try something like: bean:define id=onClickUrljavascript:location.href='html:rewrite page=/portfoliomgmt /'/bean:define html:button property=Create value=Create styleClass=NPIButton onclick=%=onClickUrl% / Cheers, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javascript
bean:define id=onClickUrl_javascript_:location.href=''/bean:define html:button property=Create value=Create styleClass=NPIButton / Vijay K Anand [EMAIL PROTECTED] Vijay K Anand [EMAIL PROTECTED] 07/06/2005 10:11 AM Please respond to Struts Users Mailing List user@struts.apache.org To Struts Users Mailing List user@struts.apache.org cc Subject Re: _javascript_ Hi All I used the same way you have said bean:define id=create_portfolio_javascript_:location.href=''/bean:define html:button property=Create value=Create styleClass=NPIButton % / html code generated is input type=button name=Create value=Create >_javascript_:location.href='' class=NPIButton but the problem is .do missing ... Any help brotheres? Bob Arnott wrote: Vijay K Anand wrote: Hi This code is not actually translating html:button property=Create value=Create styleClass=NPIButton > page='/portfoliomgmt'/\' / how do i do it? You can't embed tags in other tags... Off the top of my head try something like: bean:define id=onClickUrl_javascript_:location.href=''/bean:define html:button property=Create value=Create styleClass=NPIButton / Cheers, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javascript
Use the action attribute instead of the page attribute in your html:rewrite/ tag. See http://struts.apache.org/userGuide/struts-html.html#rewrite for the tag documentation. -- Jeff On 7/6/05, Vijay K Anand [EMAIL PROTECTED] wrote: Hi All I used the same way you have said bean:define id=create_portfoliojavascript:location.href='html:rewrite page=/portfoliomgmt/'/bean:define html:button property=Create value=Create styleClass=NPIButton onclick=%=create_portfolio % / html code generated is input type=button name=Create value=Create onclick=javascript:location.href='/portfoliomgmt' class=NPIButton but the problem is .do missing ... Any help brotheres? Bob Arnott wrote: - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: javascript
Thanks buddy , it is great... Jeff Beal wrote: Use the action attribute instead of the page attribute in your html:rewrite/ tag. See http://struts.apache.org/userGuide/struts-html.html#rewrite for the tag documentation. -- Jeff On 7/6/05, Vijay K Anand [EMAIL PROTECTED] wrote: Hi All I used the same way you have said bean:define id=create_portfoliojavascript:location.href='html:rewrite page=/portfoliomgmt/'/bean:define html:button property=Create value=Create styleClass=NPIButton onclick=%=create_portfolio % / html code generated is input type=button name=Create value=Create onclick=javascript:location.href='/portfoliomgmt' class=NPIButton but the problem is .do missing ... Any help brotheres? Bob Arnott wrote: - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]