标题:jsp问题
只看楼主
请问你好吗
Rank: 2
等 级:论坛游民
帖 子:64
专家分:51
注 册:2011-11-27
结帖率:81.48%
 问题点数:0 回复次数:1 
jsp问题
程序没问题 为什么跳出来的是三个 null
null
null

import javax.servlet.*;
import javax.servlet.http.*;

import *;

public class ThreeParams extends HttpServlet{

    private static final long serialVersionUID = 1L;

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=GBK");
        //解决post方式提交内容的乱码
        //一定要写在存取第一个参数之前
        request.setCharacterEncoding("GBK");
        
        //解决get方式乱码问题:-->URIEncoding="GBK"
        
        PrintWriter out = response.getWriter();
        out.println(request.getParameter("param1"));
        out.println("<br>");
        out.println(request.getParameter("param2"));
        out.println("<br>");
        out.println(request.getParameter("param3"));
        out.println("<br>");
        System.out.println("in doGet");
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        
        System.out.println("in doPost");
        doGet(request, response);
    }
}
搜索更多相关主题的帖子: html long request private public 
2012-04-07 14:48
smallmoon521
Rank: 9Rank: 9Rank: 9
等 级:蜘蛛侠
威 望:4
帖 子:517
专家分:1373
注 册:2008-4-21
得分:0 
request中没有这三个参数呗
看一下传递的URL或表单

为游戏狂~~!!    大家努力编哈!
2012-04-17 13:05



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-365318-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016291 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved