初学者有问题请教 关于QQ聊天工具请问如何能在自己的页面上看到对方发的信息 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这为一个过滤器:public class EncodingFilter implements javax.servlet.Filter{ private String encoding="UTF-8"; public void init(FilterConfig cfg) throws ServletException { encoding=cfg.getInitParameter("encoding"); } public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { if(encoding!=null&&!"".equals(encoding)) req.setCharacterEncoding(encoding); chain.doFilter(req, res); } public void destroy() { }}这为一个servletpublic class MyServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String name=request.getParameter("name"); String msg=request.getParameter("msg");//说的内容 String face=request.getParameter("face");//什么的说 Object o=getServletContext().getAttribute("msgs"); if(o==null){ getServletContext().setAttribute("msgs",new ArrayList()); }else{ List msgs=(List)o; msgs.add(name+" "+face+"璇达細"+msg); this.getServletContext().setAttribute("msgs", msgs); request.setAttribute("name", name); request.getRequestDispatcher("/Submitmsg.jsp").forward(request, response); } } }加上你的页面即可 6楼的应该把web.xml也一起贴出来呀 spring 上下文 获取的问题 请教JTable的一个问题 ThreadLocal出错 菜鸟问题 ~~~~~~~~~~~~~ java环境变量的配置 sql语句 谁能看懂这段代码? 怎样看Java自带的类库,高人指点,在线等候~~~~ 请教:在一种语言中 能够调用另一种语言的原理是什么 请问怎样给.class文件加密 compareTo的具体用法 各位,能不能用ObjectInputStream去封装DataInputStream去读取发过来的对象
这为一个过滤器:
public class EncodingFilter implements javax.servlet.Filter{ private String encoding="UTF-8";
public void init(FilterConfig cfg) throws ServletException {
encoding=cfg.getInitParameter("encoding");
} public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
if(encoding!=null&&!"".equals(encoding))
req.setCharacterEncoding(encoding);
chain.doFilter(req, res);
} public void destroy() {
}}这为一个servlet
public class MyServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String name=request.getParameter("name");
String msg=request.getParameter("msg");//说的内容
String face=request.getParameter("face");//什么的说
Object o=getServletContext().getAttribute("msgs");
if(o==null){
getServletContext().setAttribute("msgs",new ArrayList());
}else{
List msgs=(List)o;
msgs.add(name+" "+face+"璇达細"+msg);
this.getServletContext().setAttribute("msgs", msgs);
request.setAttribute("name", name);
request.getRequestDispatcher("/Submitmsg.jsp").forward(request, response);
}
} }
加上你的页面即可