Problematic example is:
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns:wicket="http://wicket.sourceforge.net/"><head>
<title>My Wicket Example</title>
</head>
<body>
<form wicket:id="testForm">
Czech text in markup: (ěšřčžýáíé)<br/>
Field: <input type="text" wicket:id="name"/>
Field output: <span wicket:id="fieldOutput">Output</span>
</form>
</body>
</html>
package wicket.examples.my;
import java.io.Serializable;
import wicket.markup.html.WebPage;
import wicket.markup.html.basic.Label;
import wicket.markup.html.form.Form;
import wicket.markup.html.form.RequiredTextField;
import wicket.model.IModel;
import wicket.model.PropertyModel;
public class TestFieldPage extends WebPage {
class Person implements Serializable {
private String name = "TEST";
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
public TestFieldPage() {
Person person = new Person();
add(new TestForm("testForm", new PropertyModel(person, "name")));
}
class TestForm extends Form {
public TestForm(String id, IModel model) {
super(id);
add(new RequiredTextField("name", model));
add(new Label("fieldOutput", model));
}
protected void onSubmit() {
System.out.println(get("name").getModelObject());
super.onSubmit();
}
}
}
Johan Compagner wrote:
I have couple of questions:
1. Why there is the redirect? Why one more client-server round trip?
This redirect is the default redirect strategy that we use
You can set yours if you want to something different see
ApplicationSettings RenderingStrategy
We use default the REDIRECT_TO_BUFFER
This has some advantages and you don't get that post message back when
you refresh the page
You ma try example above - text in parenthesis contains some czech
characters.
If using default REDIRECT_TO_BUFFER strategy, page before submit is
encoded in utf-8 and all texts are correct, after submiting, resulting
page is ISO-8859-1 encoded (why?) and text in markup and in textfield
are bad encoded.
If using REDIRECT TO RENDER situation is better, page before and after
redirect is correctly encoded in utf-8, but text in input field is bad
encoded :(
When I use servlet filter that sets utf-8 character (
request.setCharacterEncoding("UTF-8") ), it's correctly diplay text in
input field, but in model associated with this input field, data is
still bad encoded.
Situation is same in IE 6.0, FF 1.0.1 and 1.0.4, so i think that it's
not browser problem ....
Martin
2. Why the resulting page has wrong encoding? (The content type is
utf-8,
but the generated content is not utf-8).
Then it seems that the browser doesn't send the right headers with
that response in what type of encoding it wants it??
when it is responding to the redirect request? Can you check this with
a sniffer?
The problem IMHO is that request.getEncoding() returns null.
Or does a servlet container response with the same encoding the
browser sends something.
But then all redirects could be gone bad because what does the browser
send then?
johan
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user