Re: GET method action current value encoding

2010-07-07 Thread Greg Lindholm
Maybe this will help.

The Page Encoding is separate and distinct from the URI encoding.  On
a GET the parameters are encoded according to the URI encoding (not
the page encoding).

If you are using Tomcat then you need to specify the URI encoding on
the Connector in the server.xml file.

Example:

Connector port=80 protocol=HTTP/1.1
   enableLookups=false redirectPort=443
   connectionTimeout=2
   URIEncoding=UTF-8/

If you are using a different container then you will need to lookup
how URI encoding is configured for your container.


2010/7/5 Wataru Kou kou...@gmail.com:
 Dear Struts users.

 It reports because it investigated a little more.
 When StrutsPrepareAndExecuteFilter is used, the value passed with POST in
 GET at the end of the passed value ,  is handed over by switching off the
 district.

 Isn't does not it investigate with RFC
 when the same value is handed over with POST after the value is passed with
 GET,
 it nor correct operation that only the value of POST is handed over?

 Moreover, the operation of the METHOD type was investigated with processing
 in ValueStack.
 When GET is processed, it is stored with ISO-8859-1.
 When POST is processed, it is stored with UTF-8.

 Therefore, when the value is acquired with GET, it is necessary to convert
 it into UTF-8 from ISO-8859-1.
 However, ISO-8859-1 in POST afterwards + It becomes UTF-8. The sufficient
 result cannot be obtained.

 It devised, and I assumed to the value handed over I evaded this problem.

 Thank you.


 2010年7月3日18:23 kou kou...@gmail.com:

 I've create GET method action Page with apache struts 2.1.8.1.
 I'm making a page in encoding UTF-8.

 struts action is setter value.
 POST method 's setter value is encoding UTF-8.
 but
 GET method 's value is encoding ISO-8859-1.

 This trouble resolved this Action setter.
 but When GET was performed and went on POST.
 The value is Incomplete.


 Fundamentally, would there be a way to correct a change in a character
 string besides this way?


 web.xml:
 filter-class
 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
 /filter-class

 java :
  action:
 public class SampleAction extends ActionSupport{
  public String execute(){return SUCCESS;}
  public void setData(String data){
  if(ServletActionContext.getRequest().getMethod().equals(GET)){
   try {
    this._data = StringUtils.encoding(data);
   } catch (UnsupportedEncodingException e) {
   }
  }else{
   this._data = data;
  }
  }
  public String getData(){return _data;}
 }

  class:
 public class StringUtils {
  static public String encoding(String str) throws
 UnsupportedEncodingException {
  return new
 String(str.getBytes(ServletActionContext.getResponse().getCharacterEncoding()),ServletActionContext.getRequest().getCharacterEncoding());
  }
 }

 jsp Page:

 %@ page language=java contentType=text/html; charset=UTF-8
 pageEncoding=UTF-8%
 !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN 
 http://www.w3.org/TR/html4/loose.dtd;
 html
  body
 GET form method=GET 
  input name=data value=日本語/
  input type=submit /
 /form
 POST form method=POST 
  input name=data value=日本語/
  input type=submit /
 /formbr /
 s:property value=data/
  /body
 /html



 thank you.

 --
 kou kou...@gmail.com



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: GET method action current value encoding

2010-07-04 Thread Wataru Kou
Dear Struts users.

It reports because it investigated a little more.
When StrutsPrepareAndExecuteFilter is used, the value passed with POST in
GET at the end of the passed value ,  is handed over by switching off the
district.

Isn't does not it investigate with RFC
when the same value is handed over with POST after the value is passed with
GET,
it nor correct operation that only the value of POST is handed over?

Moreover, the operation of the METHOD type was investigated with processing
in ValueStack.
When GET is processed, it is stored with ISO-8859-1.
When POST is processed, it is stored with UTF-8.

Therefore, when the value is acquired with GET, it is necessary to convert
it into UTF-8 from ISO-8859-1.
However, ISO-8859-1 in POST afterwards + It becomes UTF-8. The sufficient
result cannot be obtained.

It devised, and I assumed to the value handed over I evaded this problem.

Thank you.


2010年7月3日18:23 kou kou...@gmail.com:

 I've create GET method action Page with apache struts 2.1.8.1.
 I'm making a page in encoding UTF-8.

 struts action is setter value.
 POST method 's setter value is encoding UTF-8.
 but
 GET method 's value is encoding ISO-8859-1.

 This trouble resolved this Action setter.
 but When GET was performed and went on POST.
 The value is Incomplete.


 Fundamentally, would there be a way to correct a change in a character
 string besides this way?


 web.xml:
 filter-class
 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
 /filter-class

 java :
  action:
 public class SampleAction extends ActionSupport{
  public String execute(){return SUCCESS;}
  public void setData(String data){
  if(ServletActionContext.getRequest().getMethod().equals(GET)){
   try {
this._data = StringUtils.encoding(data);
   } catch (UnsupportedEncodingException e) {
   }
  }else{
   this._data = data;
  }
  }
  public String getData(){return _data;}
 }

  class:
 public class StringUtils {
  static public String encoding(String str) throws
 UnsupportedEncodingException {
  return new
 String(str.getBytes(ServletActionContext.getResponse().getCharacterEncoding()),ServletActionContext.getRequest().getCharacterEncoding());
  }
 }

 jsp Page:

 %@ page language=java contentType=text/html; charset=UTF-8
 pageEncoding=UTF-8%
 !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN 
 http://www.w3.org/TR/html4/loose.dtd;
 html
  body
 GET form method=GET 
  input name=data value=日本語/
  input type=submit /
 /form
 POST form method=POST 
  input name=data value=日本語/
  input type=submit /
 /formbr /
 s:property value=data/
  /body
 /html



 thank you.

 --
 kou kou...@gmail.com



GET method action current value encoding

2010-07-03 Thread kou
I've create GET method action Page with apache struts 2.1.8.1.
I'm making a page in encoding UTF-8.

struts action is setter value.
POST method 's setter value is encoding UTF-8.
but 
GET method 's value is encoding ISO-8859-1.

This trouble resolved this Action setter.
but When GET was performed and went on POST.
The value is Incomplete.


Fundamentally, would there be a way to correct a change in a character string 
besides this way?


web.xml:
filter-class
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
/filter-class

java :
 action:
public class SampleAction extends ActionSupport{
 public String execute(){return SUCCESS;}
 public void setData(String data){
  if(ServletActionContext.getRequest().getMethod().equals(GET)){
   try {
this._data = StringUtils.encoding(data);
   } catch (UnsupportedEncodingException e) {
   }
  }else{
   this._data = data;
  }
 }
 public String getData(){return _data;}
}

 class:
public class StringUtils {
 static public String encoding(String str) throws UnsupportedEncodingException {
  return new 
String(str.getBytes(ServletActionContext.getResponse().getCharacterEncoding()),ServletActionContext.getRequest().getCharacterEncoding());
  }
}

jsp Page:

%@ page language=java contentType=text/html; charset=UTF-8 
pageEncoding=UTF-8%
!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN 
http://www.w3.org/TR/html4/loose.dtd;
html
 body
GET form method=GET 
 input name=data value=日本語/
 input type=submit /
/form
POST form method=POST 
 input name=data value=日本語/
 input type=submit /
/formbr /
s:property value=data/
 /body
/html



thank you.

-- 
kou kou...@gmail.com

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org