[HELP] Can't not submit unicode form by ajax action in Struts + Velocity framework
Hi all, I got a trouble when I submit the unicode form by ajax. when I test the submitted url, it gives me the right unicode value for each parameter I sent. ex: .do?st1=tốivềst2=ngàyvề but when I retrieve it from bean, it was not unicode value :( this trouble happens only when I submit one form by ajax action, when I do it with normal struts action, it's okie, I mean I get all unicode values. I think that there's something wrong when the Struts servlet receive the url (GET methods) help me, thanks in advance bowlkhin, PS: * in web.xml, I use SetCharacterEncodingFilter class to convert string to utf8 !-- Filter to set character encoding on each request -- filter filter-nameSet Character Encoding/filter-name filter-classfilters.SetCharacterEncodingFilter/filter-class init-param param-nameencoding/param-name param-valueUTF-8/param-value /init-param /filter filter-mapping filter-nameSet Character Encoding/filter-name url-pattern*.do/url-pattern /filter-mapping filter-mapping filter-nameSet Character Encoding/filter-name servlet-name*.vm/servlet-name /filter-mapping * in velocity.properties: input.encoding=UTF-8 output.encoding=UTF-8 default.contentType=text/html; charset=UTF-8 * in vm file: . head meta http-equiv=Content-Type content=text/html; charset=utf-8 /header .. form name=searchQuickFormBean action=javascript:retrieveURL('$link.setAction('/t/search')', 'searchQuickFormBean','wpm'); table border=0 cellpadding=0 cellspacing=0 width=100% id=table3 tr td width=20/td td width=80 select size=1 name=searchConstraint.searchType option selected value=0[$text.get(guest.index.top_banner.search.select)]/option option value=1$text.get(guest.index.top_banner.search.company)/option option value=2$text.get(guest.index.top_banner.search.product)/option option value=3$text.get(guest.index.top_banner.search.member)/option option value=4$text.get(guest.index.top_banner.search.news)/option /select /td td width=10/td td width=99 input type=text name=searchConstraint.keyWord size=17 maxlength=50 style=font-size: 11px; font-weight: 500; float:left /td /tr /table ##end simple search /form * below is my ajax.js function retrieveURL(url,nameOfFormToPost, spanTagName) { // set name of span tag curSpanTagName = spanTagName; //get the (form based) params to push up as part of the get request url=url+?noPara=yes+getFormAsString(nameOfFormToPost); //Do the Ajax call if (window.XMLHttpRequest) { // Non-IE browsers req = new XMLHttpRequest(); req.onreadystatechange = processStateChange; try { req.open(GET, url, true); //was get } catch (e) { alert(Problem Communicating with Server\n+e); } req.send(null); } else if (window.ActiveXObject) { // IE req = new ActiveXObject(Microsoft.XMLHTTP); if (req) { req.onreadystatechange = processStateChange; req.open(GET, url, true); req.send(); } } } function getFormAsString(formName){ //Setup the return String returnString =; //Get the form values formElements=document.forms[formName].elements; //loop through the array , building up the url //in the form /strutsaction.doname=value for ( var i=formElements.length-1; i=0; --i ){ //we escape (encode) each value returnString=returnString++formElements[i].name+=+formElements[i].value; } //return the values return returnString; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [HELP] Can't not submit unicode form by ajax action in Struts + Velocity framework
Antonio, would you mind showing an example how to use POST method with AJAX ? thanks in advace bowlkhin - Original Message - From: Pham Anh Tuan [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, September 26, 2006 4:16 PM Subject: Re: [HELP] Can't not submit unicode form by ajax action in Struts + Velocity framework oh ... :O ... I just forgot Post method :( ... thank you for reminding me ... I will try it. Again, thanks for ur feedback :) - Original Message - From: Antonio Petrelli [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, September 26, 2006 4:13 PM Subject: Re: [HELP] Can't not submit unicode form by ajax action in Struts + Velocity framework Pham Anh Tuan ha scritto: when I test the submitted url, it gives me the right unicode value for each parameter I sent. ex: .do?st1=tốivềst2=ngàyvề but when I retrieve it from bean, it was not unicode value :( st1: tốivề --- tá»i vá» st2: ngàyvề --- ngà y vá» I don't know what's wrong? If you want to send special characters in the URL you have to encode them. Anyway I know how to do it in Java, using URLEncoder.encode(myString, UTF-8). I don't know if there is such a feature in JavaScript... Just a question, why don't you post those parameters? - 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: [HELP] Can't not submit unicode form by ajax action in Struts + Velocity framework
Pham Anh Tuan ha scritto: Antonio, would you mind showing an example how to use POST method with AJAX ? Your question is too generic. Maybe you need simply JavaScript, in this case I suggest to read this piece of tutorial http://www.w3schools.com/htmldom/dom_obj_form.asp HTH Antonio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [HELP] Can't not submit unicode form by ajax action in Struts + Velocity framework
ah ha, yeahh, thanks a lot Antonio, I solved my problem! again, thank u (^-^) bowlkhin - Original Message - From: Antonio Petrelli [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, September 26, 2006 4:41 PM Subject: Re: [HELP] Can't not submit unicode form by ajax action in Struts + Velocity framework Pham Anh Tuan ha scritto: Antonio, would you mind showing an example how to use POST method with AJAX ? Your question is too generic. Maybe you need simply JavaScript, in this case I suggest to read this piece of tutorial http://www.w3schools.com/htmldom/dom_obj_form.asp HTH Antonio - 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: [HELP] Can't not submit unicode form by ajax action in Struts + Velocity framework
when I test the submitted url, it gives me the right unicode value for each parameter I sent. ex: .do?st1=tốivềst2=ngàyvề but when I retrieve it from bean, it was not unicode value :( st1: tốivề --- tá»i vá» st2: ngàyvề --- ngà y vá» I don't know what's wrong? - Original Message - From: Pham Anh Tuan [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, September 26, 2006 2:09 PM Subject: [HELP] Can't not submit unicode form by ajax action in Struts + Velocity framework Hi all, I got a trouble when I submit the unicode form by ajax. when I test the submitted url, it gives me the right unicode value for each parameter I sent. ex: .do?st1=tốivềst2=ngàyvề but when I retrieve it from bean, it was not unicode value :( this trouble happens only when I submit one form by ajax action, when I do it with normal struts action, it's okie, I mean I get all unicode values. I think that there's something wrong when the Struts servlet receive the url (GET methods) help me, thanks in advance bowlkhin, PS: * in web.xml, I use SetCharacterEncodingFilter class to convert string to utf8 !-- Filter to set character encoding on each request -- filter filter-nameSet Character Encoding/filter-name filter-classfilters.SetCharacterEncodingFilter/filter-class init-param param-nameencoding/param-name param-valueUTF-8/param-value /init-param /filter filter-mapping filter-nameSet Character Encoding/filter-name url-pattern*.do/url-pattern /filter-mapping filter-mapping filter-nameSet Character Encoding/filter-name servlet-name*.vm/servlet-name /filter-mapping * in velocity.properties: input.encoding=UTF-8 output.encoding=UTF-8 default.contentType=text/html; charset=UTF-8 * in vm file: . head meta http-equiv=Content-Type content=text/html; charset=utf-8 /header .. form name=searchQuickFormBean action=javascript:retrieveURL('$link.setAction('/t/search')', 'searchQuickFormBean','wpm'); table border=0 cellpadding=0 cellspacing=0 width=100% id=table3 tr td width=20/td td width=80 select size=1 name=searchConstraint.searchType option selected value=0[$text.get(guest.index.top_banner.search.select)]/option option value=1$text.get(guest.index.top_banner.search.company)/option option value=2$text.get(guest.index.top_banner.search.product)/option option value=3$text.get(guest.index.top_banner.search.member)/option option value=4$text.get(guest.index.top_banner.search.news)/option /select /td td width=10/td td width=99 input type=text name=searchConstraint.keyWord size=17 maxlength=50 style=font-size: 11px; font-weight: 500; float:left /td /tr /table ##end simple search /form * below is my ajax.js function retrieveURL(url,nameOfFormToPost, spanTagName) { // set name of span tag curSpanTagName = spanTagName; //get the (form based) params to push up as part of the get request url=url+?noPara=yes+getFormAsString(nameOfFormToPost); //Do the Ajax call if (window.XMLHttpRequest) { // Non-IE browsers req = new XMLHttpRequest(); req.onreadystatechange = processStateChange; try { req.open(GET, url, true); //was get } catch (e) { alert(Problem Communicating with Server\n+e); } req.send(null); } else if (window.ActiveXObject) { // IE req = new ActiveXObject(Microsoft.XMLHTTP); if (req) { req.onreadystatechange = processStateChange; req.open(GET, url, true); req.send(); } } } function getFormAsString(formName){ //Setup the return String returnString =; //Get the form values formElements=document.forms[formName].elements; //loop through the array , building up the url //in the form /strutsaction.doname=value for ( var i=formElements.length-1; i=0; --i ){ //we escape (encode) each value returnString=returnString++formElements[i].name+=+formElements[i].value; } //return the values return returnString; } - 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: [HELP] Can't not submit unicode form by ajax action in Struts + Velocity framework
Pham Anh Tuan ha scritto: when I test the submitted url, it gives me the right unicode value for each parameter I sent. ex: .do?st1=tốivềst2=ngàyvề but when I retrieve it from bean, it was not unicode value :( st1: tốivề --- tá»i vá» st2: ngàyvề --- ngà y vá» I don't know what's wrong? If you want to send special characters in the URL you have to encode them. Anyway I know how to do it in Java, using URLEncoder.encode(myString, UTF-8). I don't know if there is such a feature in JavaScript... Just a question, why don't you post those parameters? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [HELP] Can't not submit unicode form by ajax action in Struts + Velocity framework
oh ... :O ... I just forgot Post method :( ... thank you for reminding me ... I will try it. Again, thanks for ur feedback :) - Original Message - From: Antonio Petrelli [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, September 26, 2006 4:13 PM Subject: Re: [HELP] Can't not submit unicode form by ajax action in Struts + Velocity framework Pham Anh Tuan ha scritto: when I test the submitted url, it gives me the right unicode value for each parameter I sent. ex: .do?st1=tốivềst2=ngàyvề but when I retrieve it from bean, it was not unicode value :( st1: tốivề --- tá»i vá» st2: ngàyvề --- ngà y vá» I don't know what's wrong? If you want to send special characters in the URL you have to encode them. Anyway I know how to do it in Java, using URLEncoder.encode(myString, UTF-8). I don't know if there is such a feature in JavaScript... Just a question, why don't you post those parameters? - 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: [HELP] Can't not submit unicode form by ajax action in Struts + Velocity framework
just out of curiosity have you implemented your Ajax Control with RPC or doc-literal or some other type of transport? Thanks, M- * This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed. If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the original message without making a copy. Thank you. - Original Message - From: Pham Anh Tuan [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, September 26, 2006 5:47 AM Subject: Re: [HELP] Can't not submit unicode form by ajax action in Struts + Velocity framework ah ha, yeahh, thanks a lot Antonio, I solved my problem! again, thank u (^-^) bowlkhin - Original Message - From: Antonio Petrelli [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, September 26, 2006 4:41 PM Subject: Re: [HELP] Can't not submit unicode form by ajax action in Struts + Velocity framework Pham Anh Tuan ha scritto: Antonio, would you mind showing an example how to use POST method with AJAX ? Your question is too generic. Maybe you need simply JavaScript, in this case I suggest to read this piece of tutorial http://www.w3schools.com/htmldom/dom_obj_form.asp HTH Antonio - 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: [HELP] I use struts + Velocity, I couldn't submit 1 form with unicode information! :(
Hi Xuan Tinh, I had created a filter, which set request.setCharacterEncoding('UTF-8') and filtering all url-pattern: *.do or *.vm ... now, everything is fine :) thank you all :) - Original Message - From: Truong Xuan Tinh [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, June 21, 2006 5:44 PM Subject: Re: [HELP] I use struts + Velocity, I couldn't submit 1 form with unicode information! :( You must set both attributes like this:%@ page pageEncoding=UTF-8 contentType=text/html; charset=UTF-8% By the way, which version of Tomcat are you using? You can search the JIRA database of Tomcat to check whether it's a bug ot Tomcat. Pham Anh Tuan wrote: yes, I had set contentType=text/html; charset=UTF-8 but there's no effect :( - Original Message - From: Truong Xuan Tinh [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, June 21, 2006 1:56 PM Subject: Re: [HELP] I use struts + Velocity, I couldn't submit 1 form with unicode information! :( Did you set the page directive in you JSP files like this? %@ page pageEncoding=UTF-8 contentType=text/html; charset=UTF-8% Pham Anh Tuan wrote: Sorry all you, I don't intend to flood the mailling list, but yesterday, after I had sent this email, mail server feedback to me that my email couldn't send :( ... So, that the reason why I sent this email so many times, sorry all :( about my situation, I can only save unicode characters into my DB with the form which has the header contains the attribute: enctype=multipart/form-data, if not I can not have unicode characters :( @ Tinh: I did the same thing like you suggested, make a filter and set request.setCharacterEncoding(encoding); but as you know, the result was there's no effect :( .. .it's still ISO-8859-1. if you must change encoding for every string ... hiz, that's a heavy work ... is there's any solution :( thanks all, - Original Message - From: Truong Xuan Tinh [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, June 20, 2006 10:23 PM Subject: Re: [HELP] I use struts + Velocity, I couldn't submit 1 form with unicode information! :( Hi Tuan, Did you set the page encoding to UTF-8? And one more thing, set the characterEncoding of your request to UTF-8 before it hit your action (ie, in a filter or something like that). PS: I've found a bug in Tomcat with when encoding data to UTF-8 with the GET method (the POST method is OK). Although you set the characterEncoding of the request to UTF-8 in filter, but when it hit the action of Struts, the character is still in ISO-8859-1 :-( . Here is the quick fit for this: byte[] temp = originalString.getBytes(ISO-8859-1); String result = new String (temp, UTF8); Hope this may help. PS: Do not flood the mailing list with duplicate message, you'll get ignored quickly. Pham Anh Tuan wrote: Hi all, I use Struts framework + Velocity, and I have a form with a text field, something like below: form method=POST action=$link.setAction(/saveIt) table tr td input type=text name=something /td /tr /table /form in velocity.properties file, I set: input.encoding=UTF-8 output.encoding=UTF-8 hiz, but with all above, I couldn't save unicode value of something property into my DB (Mysql 4.1, I had set all utf-8) :( but ... when I change the header of form tag like below, everything is fine, it's mean, I can save unicode value into DB :( ... I don't know why, help me plz :( form enctype=multipart/form-data method=POST action=$link.setAction(/saveIt) thanks in advance, bowlkhin - 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] - 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: [HELP] I use struts + Velocity, I couldn't submit 1 form with unicode information! :(
Did you set the page directive in you JSP files like this? %@ page pageEncoding=UTF-8 contentType=text/html; charset=UTF-8% Pham Anh Tuan wrote: Sorry all you, I don't intend to flood the mailling list, but yesterday, after I had sent this email, mail server feedback to me that my email couldn't send :( ... So, that the reason why I sent this email so many times, sorry all :( about my situation, I can only save unicode characters into my DB with the form which has the header contains the attribute: enctype=multipart/form-data, if not I can not have unicode characters :( @ Tinh: I did the same thing like you suggested, make a filter and set request.setCharacterEncoding(encoding); but as you know, the result was there's no effect :( .. .it's still ISO-8859-1. if you must change encoding for every string ... hiz, that's a heavy work ... is there's any solution :( thanks all, - Original Message - From: Truong Xuan Tinh [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, June 20, 2006 10:23 PM Subject: Re: [HELP] I use struts + Velocity, I couldn't submit 1 form with unicode information! :( Hi Tuan, Did you set the page encoding to UTF-8? And one more thing, set the characterEncoding of your request to UTF-8 before it hit your action (ie, in a filter or something like that). PS: I've found a bug in Tomcat with when encoding data to UTF-8 with the GET method (the POST method is OK). Although you set the characterEncoding of the request to UTF-8 in filter, but when it hit the action of Struts, the character is still in ISO-8859-1 :-( . Here is the quick fit for this: byte[] temp = originalString.getBytes(ISO-8859-1); String result = new String (temp, UTF8); Hope this may help. PS: Do not flood the mailing list with duplicate message, you'll get ignored quickly. Pham Anh Tuan wrote: Hi all, I use Struts framework + Velocity, and I have a form with a text field, something like below: form method=POST action=$link.setAction(/saveIt) table tr td input type=text name=something /td /tr /table /form in velocity.properties file, I set: input.encoding=UTF-8 output.encoding=UTF-8 hiz, but with all above, I couldn't save unicode value of something property into my DB (Mysql 4.1, I had set all utf-8) :( but ... when I change the header of form tag like below, everything is fine, it's mean, I can save unicode value into DB :( ... I don't know why, help me plz :( form enctype=multipart/form-data method=POST action=$link.setAction(/saveIt) thanks in advance, bowlkhin - 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: [HELP] I use struts + Velocity, I couldn't submit 1 form with unicode information! :(
yes, I had set contentType=text/html; charset=UTF-8 but there's no effect :( - Original Message - From: Truong Xuan Tinh [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, June 21, 2006 1:56 PM Subject: Re: [HELP] I use struts + Velocity, I couldn't submit 1 form with unicode information! :( Did you set the page directive in you JSP files like this? %@ page pageEncoding=UTF-8 contentType=text/html; charset=UTF-8% Pham Anh Tuan wrote: Sorry all you, I don't intend to flood the mailling list, but yesterday, after I had sent this email, mail server feedback to me that my email couldn't send :( ... So, that the reason why I sent this email so many times, sorry all :( about my situation, I can only save unicode characters into my DB with the form which has the header contains the attribute: enctype=multipart/form-data, if not I can not have unicode characters :( @ Tinh: I did the same thing like you suggested, make a filter and set request.setCharacterEncoding(encoding); but as you know, the result was there's no effect :( .. .it's still ISO-8859-1. if you must change encoding for every string ... hiz, that's a heavy work ... is there's any solution :( thanks all, - Original Message - From: Truong Xuan Tinh [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, June 20, 2006 10:23 PM Subject: Re: [HELP] I use struts + Velocity, I couldn't submit 1 form with unicode information! :( Hi Tuan, Did you set the page encoding to UTF-8? And one more thing, set the characterEncoding of your request to UTF-8 before it hit your action (ie, in a filter or something like that). PS: I've found a bug in Tomcat with when encoding data to UTF-8 with the GET method (the POST method is OK). Although you set the characterEncoding of the request to UTF-8 in filter, but when it hit the action of Struts, the character is still in ISO-8859-1 :-( . Here is the quick fit for this: byte[] temp = originalString.getBytes(ISO-8859-1); String result = new String (temp, UTF8); Hope this may help. PS: Do not flood the mailing list with duplicate message, you'll get ignored quickly. Pham Anh Tuan wrote: Hi all, I use Struts framework + Velocity, and I have a form with a text field, something like below: form method=POST action=$link.setAction(/saveIt) table tr td input type=text name=something /td /tr /table /form in velocity.properties file, I set: input.encoding=UTF-8 output.encoding=UTF-8 hiz, but with all above, I couldn't save unicode value of something property into my DB (Mysql 4.1, I had set all utf-8) :( but ... when I change the header of form tag like below, everything is fine, it's mean, I can save unicode value into DB :( ... I don't know why, help me plz :( form enctype=multipart/form-data method=POST action=$link.setAction(/saveIt) thanks in advance, bowlkhin - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [HELP] I use struts + Velocity, I couldn't submit 1 form with unicode information! :(
You must set both attributes like this:%@ page pageEncoding=UTF-8 contentType=text/html; charset=UTF-8% By the way, which version of Tomcat are you using? You can search the JIRA database of Tomcat to check whether it's a bug ot Tomcat. Pham Anh Tuan wrote: yes, I had set contentType=text/html; charset=UTF-8 but there's no effect :( - Original Message - From: Truong Xuan Tinh [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, June 21, 2006 1:56 PM Subject: Re: [HELP] I use struts + Velocity, I couldn't submit 1 form with unicode information! :( Did you set the page directive in you JSP files like this? %@ page pageEncoding=UTF-8 contentType=text/html; charset=UTF-8% Pham Anh Tuan wrote: Sorry all you, I don't intend to flood the mailling list, but yesterday, after I had sent this email, mail server feedback to me that my email couldn't send :( ... So, that the reason why I sent this email so many times, sorry all :( about my situation, I can only save unicode characters into my DB with the form which has the header contains the attribute: enctype=multipart/form-data, if not I can not have unicode characters :( @ Tinh: I did the same thing like you suggested, make a filter and set request.setCharacterEncoding(encoding); but as you know, the result was there's no effect :( .. .it's still ISO-8859-1. if you must change encoding for every string ... hiz, that's a heavy work ... is there's any solution :( thanks all, - Original Message - From: Truong Xuan Tinh [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, June 20, 2006 10:23 PM Subject: Re: [HELP] I use struts + Velocity, I couldn't submit 1 form with unicode information! :( Hi Tuan, Did you set the page encoding to UTF-8? And one more thing, set the characterEncoding of your request to UTF-8 before it hit your action (ie, in a filter or something like that). PS: I've found a bug in Tomcat with when encoding data to UTF-8 with the GET method (the POST method is OK). Although you set the characterEncoding of the request to UTF-8 in filter, but when it hit the action of Struts, the character is still in ISO-8859-1 :-( . Here is the quick fit for this: byte[] temp = originalString.getBytes(ISO-8859-1); String result = new String (temp, UTF8); Hope this may help. PS: Do not flood the mailing list with duplicate message, you'll get ignored quickly. Pham Anh Tuan wrote: Hi all, I use Struts framework + Velocity, and I have a form with a text field, something like below: form method=POST action=$link.setAction(/saveIt) table tr td input type=text name=something /td /tr /table /form in velocity.properties file, I set: input.encoding=UTF-8 output.encoding=UTF-8 hiz, but with all above, I couldn't save unicode value of something property into my DB (Mysql 4.1, I had set all utf-8) :( but ... when I change the header of form tag like below, everything is fine, it's mean, I can save unicode value into DB :( ... I don't know why, help me plz :( form enctype=multipart/form-data method=POST action=$link.setAction(/saveIt) thanks in advance, bowlkhin - 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] - 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]
[HELP] I use struts + Velocity, I couldn't submit 1 form with unicode information! :(
Hi all, I use Struts framework + Velocity, and I have a form with a text field, something like below: form method=POST action=$link.setAction(/saveIt) table tr td input type=text name=something /td /tr /table /form in velocity.properties file, I set: input.encoding=UTF-8 output.encoding=UTF-8 hiz, but with all above, I couldn't save unicode value of something property into my DB (Mysql 4.1, I had set all utf-8) :( but ... when I change the header of form tag like below, everything is fine, it's mean, I can save unicode value into DB :( ... I don't know why, help me plz :( form enctype=multipart/form-data method=POST action=$link.setAction(/saveIt) thanks in advance, bowlkhin
[HELP] I use struts + Velocity, I couldn't submit 1 form with unicode information! :(
Hi all, I use Struts framework + Velocity, and I have a form with a text field, something like below: form method=POST action=$link.setAction(/saveIt) table tr td input type=text name=something /td /tr /table /form in velocity.properties file, I set: input.encoding=UTF-8 output.encoding=UTF-8 hiz, but with all above, I couldn't save unicode value of something property into my DB (Mysql 4.1, I had set all utf-8) :( but ... when I change the header of form tag like below, everything is fine, it's mean, I can save unicode value into DB :( ... I don't know why, help me plz :( form enctype=multipart/form-data method=POST action=$link.setAction(/saveIt) thanks in advance, bowlkhin
[HELP] I use struts + Velocity, I couldn't submit 1 form with unicode information! :(
Hi all, I use Struts framework + Velocity, and I have a form with a text field, something like below: form method=POST action=$link.setAction(/saveIt) table tr td input type=text name=something /td /tr /table /form in velocity.properties file, I set: input.encoding=UTF-8 output.encoding=UTF-8 hiz, but with all above, I couldn't save unicode value of something property into my DB (Mysql 4.1, I had set all utf-8) :( but ... when I change the header of form tag like below, everything is fine, it's mean, I can save unicode value into DB :( ... I don't know why, help me plz :( form enctype=multipart/form-data method=POST action=$link.setAction(/saveIt) thanks in advance, bowlkhin
[HELP] I use struts + Velocity, I couldn't submit 1 form with unicode information! :(
Hi all, I use Struts framework + Velocity, and I have a form with a text field, something like below: form method=POST action=$link.setAction(/saveIt) table tr td input type=text name=something /td /tr /table /form in velocity.properties file, I set: input.encoding=UTF-8 output.encoding=UTF-8 hiz, but with all above, I couldn't save unicode value of something property into my DB (Mysql 4.1, I had set all utf-8) :( but ... when I change the header of form tag like below, everything is fine, it's mean, I can save unicode value into DB :( ... I don't know why, help me plz :( form enctype=multipart/form-data method=POST action=$link.setAction(/saveIt) thanks in advance, bowlkhin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [HELP] I use struts + Velocity, I couldn't submit 1 form with unicode information! :(
First of all, do you think that posting your thread FOUR TIMES it will be read better than only one? It is a rude behaviour and you are discouraged to do so. Anyway, because I am not evil I will try to help you. Pham Anh Tuan ha scritto: Hi all, I use Struts framework + Velocity, and I have a form with a text field, something like below: form method=POST action=$link.setAction(/saveIt) table tr td input type=text name=something /td /tr /table /form in velocity.properties file, I set: input.encoding=UTF-8 output.encoding=UTF-8 hiz, but with all above, I couldn't save unicode value of something property into my DB (Mysql 4.1, I had set all utf-8) :( but ... when I change the header of form tag like below, everything is fine, it's mean, I can save unicode value into DB :( ... I don't know why, help me plz :( form enctype=multipart/form-data method=POST action=$link.setAction(/saveIt) Do you mean that you cannot save unicode special characters both with default enctype and with enctype=multipart/form-data? Or you cannot save them only with enctype=form-data? Antonio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [HELP] I use struts + Velocity, I couldn't submit 1 form with unicode information! :(
Hi Tuan, Did you set the page encoding to UTF-8? And one more thing, set the characterEncoding of your request to UTF-8 before it hit your action (ie, in a filter or something like that). PS: I've found a bug in Tomcat with when encoding data to UTF-8 with the GET method (the POST method is OK). Although you set the characterEncoding of the request to UTF-8 in filter, but when it hit the action of Struts, the character is still in ISO-8859-1 :-( . Here is the quick fit for this: byte[] temp = originalString.getBytes(ISO-8859-1); String result = new String (temp, UTF8); Hope this may help. PS: Do not flood the mailing list with duplicate message, you'll get ignored quickly. Pham Anh Tuan wrote: Hi all, I use Struts framework + Velocity, and I have a form with a text field, something like below: form method=POST action=$link.setAction(/saveIt) table tr td input type=text name=something /td /tr /table /form in velocity.properties file, I set: input.encoding=UTF-8 output.encoding=UTF-8 hiz, but with all above, I couldn't save unicode value of something property into my DB (Mysql 4.1, I had set all utf-8) :( but ... when I change the header of form tag like below, everything is fine, it's mean, I can save unicode value into DB :( ... I don't know why, help me plz :( form enctype=multipart/form-data method=POST action=$link.setAction(/saveIt) thanks in advance, bowlkhin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[HELP] I use struts + Velocity, I couldn't submit 1 form with unicode information! :(
Hi all, I use Struts framework + Velocity, and I have a form with a text field, something like below: form method=POST action=$link.setAction(/saveIt) table tr td input type=text name=something /td /tr /table /form in velocity.properties file, I set: input.encoding=UTF-8 output.encoding=UTF-8 hiz, but with all above, I couldn't save unicode value of something property into my DB (Mysql 4.1, I had set all utf-8) :( but ... when I change the header of form tag like below, everything is fine, it's mean, I can save unicode value into DB :( ... I don't know why, help me plz :( form enctype=multipart/form-data method=POST action=$link.setAction(/saveIt) thanks in advance, bowlkhin
[HELP] I use struts + Velocity, I couldn't submit 1 form with unicode information! :(
Hi all, I use Struts framework + Velocity, and I have a form with a text field, something like below: form method=POST action=$link.setAction(/saveIt) table tr td input type=text name=something /td /tr /table /form in velocity.properties file, I set: input.encoding=UTF-8 output.encoding=UTF-8 hiz, but with all above, I couldn't save unicode value of something property into my DB (Mysql 4.1, I had set all utf-8) :( but ... when I change the header of form tag like below, everything is fine, it's mean, I can save unicode value into DB :( ... I don't know why, help me plz :( form enctype=multipart/form-data method=POST action=$link.setAction(/saveIt) thanks in advance, bowlkhin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [HELP] I use struts + Velocity, I couldn't submit 1 form with unicode information! :(
Sorry all you, I don't intend to flood the mailling list, but yesterday, after I had sent this email, mail server feedback to me that my email couldn't send :( ... So, that the reason why I sent this email so many times, sorry all :( about my situation, I can only save unicode characters into my DB with the form which has the header contains the attribute: enctype=multipart/form-data, if not I can not have unicode characters :( @ Tinh: I did the same thing like you suggested, make a filter and set request.setCharacterEncoding(encoding); but as you know, the result was there's no effect :( .. .it's still ISO-8859-1. if you must change encoding for every string ... hiz, that's a heavy work ... is there's any solution :( thanks all, - Original Message - From: Truong Xuan Tinh [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, June 20, 2006 10:23 PM Subject: Re: [HELP] I use struts + Velocity, I couldn't submit 1 form with unicode information! :( Hi Tuan, Did you set the page encoding to UTF-8? And one more thing, set the characterEncoding of your request to UTF-8 before it hit your action (ie, in a filter or something like that). PS: I've found a bug in Tomcat with when encoding data to UTF-8 with the GET method (the POST method is OK). Although you set the characterEncoding of the request to UTF-8 in filter, but when it hit the action of Struts, the character is still in ISO-8859-1 :-( . Here is the quick fit for this: byte[] temp = originalString.getBytes(ISO-8859-1); String result = new String (temp, UTF8); Hope this may help. PS: Do not flood the mailing list with duplicate message, you'll get ignored quickly. Pham Anh Tuan wrote: Hi all, I use Struts framework + Velocity, and I have a form with a text field, something like below: form method=POST action=$link.setAction(/saveIt) table tr td input type=text name=something /td /tr /table /form in velocity.properties file, I set: input.encoding=UTF-8 output.encoding=UTF-8 hiz, but with all above, I couldn't save unicode value of something property into my DB (Mysql 4.1, I had set all utf-8) :( but ... when I change the header of form tag like below, everything is fine, it's mean, I can save unicode value into DB :( ... I don't know why, help me plz :( form enctype=multipart/form-data method=POST action=$link.setAction(/saveIt) thanks in advance, bowlkhin - 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: Struts Velocity
Thanks Joe, Im aware of the list so I will post there, I just thought it was more of a Struts related thing :) Sorry for that. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts Velocity
Hi all, Im just trying to get my head around this. Struts is meant to work with actions. You create the mappings of the actions in the struts-config.xml and define things like action handlers, forwards, etc. Suppose I use Velocity to render the view. Is there a standar place in struts or anywhere else that I can populate the velocity context? (Doing it through request.put() of course) My problem comes when I need to change the Locale for a page which fires up a LocaleAction class which then renders the page Ive specified *but* without the velocity context being populated since all the logic to populate the context is defined in a different class. In Turbine for example there is method which gets called and serves for populating the context. Thanks for your input. Markos Charatzas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Velocity
Have you checked out http://jakarta.apache.org/velocity/tools/struts/ The community of Struts/Velocity users is quite healthy. I'm not actually one of them, but I bet you'll find that they've got you covered if you check out that URL. Joe At 5:48 PM +0200 2/7/05, Markos Charatzas wrote: Hi all, Im just trying to get my head around this. Struts is meant to work with actions. You create the mappings of the actions in the struts-config.xml and define things like action handlers, forwards, etc. Suppose I use Velocity to render the view. Is there a standar place in struts or anywhere else that I can populate the velocity context? (Doing it through request.put() of course) My problem comes when I need to change the Locale for a page which fires up a LocaleAction class which then renders the page Ive specified *but* without the velocity context being populated since all the logic to populate the context is defined in a different class. In Turbine for example there is method which gets called and serves for populating the context. Thanks for your input. Markos Charatzas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]