|
From: AC <ac...@ac...> - 2006-08-30 13:12:12
|
Hi there,
I was evaluating WebMacro with Servlet for one Web application, fulfilling
both English and Big5 Chinese UI.
It worked very well and I could see the great convenience and simplicity
behind. However, when come to using a template for Chinese, I found all
big5 characters in my .wm files were strangely encoded when viewing through
a servlet. Wondering if this was experienced before and have had solution or
fix developed.
My environment:
Windows 2000 Professional
Tomcat Apache 5.5.16
WebMacro 2.0 (build date, 1st Nov 2005)
Options I have tried:
#1. use HttpServlet with WebMacro
---------------------------------------------------------------------------
public class WMHello extends HttpServlet {
...
public void init() ..{
..
private WebMacro _wm = new WM();
}
public void doGet(HttpServletRequest req, HttpServletResponse res) .. {
....
res.setContentType("text/html;charset=big5");
res.setLocale(new Locale("tw",""));
....
try {
WebContext c = _wm.getWebContext(req,res);
Template tmpl = _wm.getTemplate(WMFile);
/* have tried all below options and none works */
//tmpl.write(res.getOutputStream(), res.getCharacterEncoding(), c);
//tmpl.write(res.getOutputStream(), "BIG5", c);
tmpl.write(res.getOutputStream(), c);
}
catch (WebMacroException e) {
throw new ServletException(e);
...
}
}
#2, trying to directly use a WebMacro Servlet where "public class
WMServlet01 extends WMServlet()
"---------------------------------------------------
.
out.println("<h2>hfdhfdsf </h2>");
//trying to include one WM writer
RequestDispatcher disp = req.getRequestDispatcher("/WMServlet01");
disp.include(req, resp);
out.println("<p>the end");
....
-------------------------------------------------------------------------
Attached .wm template and screen captures for reference.
Please let me know if more info if needed. Thanks for any help in advance.
AC@hongkong
<< File: big5Problm.JPG >> << File: hello.wm >>
|