【推荐阅读:JDBC基础知识(1)】
【扩展信息:[总结]J2EE综合应用】
本文描述的场景是:turbine2.31+velocity-1.4+torque-3.1.要解决在该场景下提交编码模式为multipart/form-data的表单不能正确处理中文的问题,虽然application/x-www-form-urlencoded编码下可以正确处理中文.纠正本问题需要提供:maven,ant两个工具以及turbine源码.首先,看turbine的入口servlet turbine.java中的代码片段,是doget方法:目的是看原始的web服务器请求对象(request)是如何被传递入turbine中的,以及turbine如何处理request对象. public final void doget(httpservletrequest req, httpservletresponse res) throws ioexception, servletexception { // set to true if the request is to be redirected by the page boolean requestredirected = false;
// placeholder for the rundata object. rundata data = null; try { // check to make sure that we started up properly. if (initfailure != null) { throw initfailure; }
// get general rundata here... // perform turbine specific initialization below.
data = rundataservice.getrundata(req, res, getservletconfig());
// if this is the first invocation, perform some // initialization. certain services need rundata to initialize // themselves. if (firstdoget) { init(data); }
// set the session timeout if specified in turbines properties // file if this is a new session if (data.getsession().isnew()) { int timeout = configuration.getint(session_timeout_key, session_timeout_default);
if (timeout != session_timeout_default) { data.getsession().setmaxinactiveinterval(timeout); } }
// fill in the screen and action variables. data.setscreen(data.getparameters().getstring(uriconstants.cgi_screen_param)); data.setaction(data.getparameters().getstring(uriconstants.cgi_action_param));
// special case for login and logout, this must happen before the // session validator is executed in order either to allow a user to... 下一页