在新的环境下(更换机器、tomcat、java版本不一致等),之前能够正常运行的程序,却出现以下的运行错误: An error occurred at line: in the generated java file: The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory An error occurred at line: in the generated java file: The method getDispatcherType() is undefined for the type HttpServletRequest 这个异常是由于包冲突引起的,如果你使用的是tomcat,检查tomcat的lib目录与工程的WEB-INF/lib目录下有无重复的包,若有则删除工程下的重复包,若没有检查工程下有无servlet.jar,有则删除。
一、按照POST方式,解决乱码:request.setCharacterEncoding(UTF-8)但是这只对POST提交方式 有效,而对于get或者multipart/form-data无效。 %@ 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 % request.setCharacterEncoding(UTF-8); % html head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 title中文处理/title /head body form action=ConvertTo_01.jsp method=post div 用户名:input type=text name=namebr input type=submit value=submit /div /form /body /html %@ page language=java contentType=text/html; charset=UTF-8 pageEncoding=UTF-8% %@ taglib prefix=s uri=/struts-tags% !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd %request.setCharacterEncoding(UTF-8); % html head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 title中文乱码解决方案/title /head body %=request.getParameter(name)% /body /html
Directive tag do not produce any visible output but when the page is requested but changed the way the JSP Engine processes the page. page - processing information for this page page directive - 11 optional attributes, must be included in the same tag include - files to be included tag library - tag library to be used in this page Action tag enable the user of server side Javabeasns transfer control between pages browser independent support for applets Scrptlet tag