tomcat没有打印system.out.println()

发布网友 发布时间:2024-10-24 07:42

我来回答

5个回答

热心网友 时间:2024-10-25 09:15

是不是System.out.println("hhhhh");这条语句写在if else语句中,但是运行时程序并未进入if else 语句中;你仔细看看

热心网友 时间:2024-10-25 09:13

兄台,你怎么弄好的?我也遇到这种问题了

热心网友 时间:2024-10-25 09:19

这就是servlet的部分代码:
public class MyServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private MyConfig mMyConfig;
private Hashtable<String,RequestProcessor> mRequestProcessor;

@Override
public void init() throws ServletException {
String configPath=this.getInitParameter("config");
InputStream ins=this.getServletContext().getResourceAsStream(configPath);
mMyConfig=new MyConfig(ins);
mRequestProcessor=new Hashtable<String,RequestProcessor>();
System.out.println("为什么没有字符串输出????");
}

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("为什么没有字符串输出????2222222222222222");
myProcess(request,response);
}

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("为什么没有字符串输出?333333333333333333");
myProcess(request,response);
}

protected void myProcess(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
RequestProcessor aCurrentProcessor=null;
String aName=getRequestType(request.getRequestURI());
System.out.println("为什么没有字符串输出????44444444444444444444444");
if(mRequestProcessor.containsKey(aName)){
aCurrentProcessor=mRequestProcessor.get(aName);
}else{
MyActionMapping aMyActionMapp=mMyConfig.getBusinessAction(aName);

if(aMyActionMapp==null){
response.sendError(400, "这是一个无效的请求");
return;
}
aCurrentProcessor=getProcessor(aName,aMyActionMapp);
if(aCurrentProcessor!=null){
mRequestProcessor.put(aName, aCurrentProcessor);
}
}
if(aCurrentProcessor==null){
response.sendError(404);
return;
}
FormBean aFormBean= getFormBean(request,aCurrentProcessor.getmFormPath());
//每一次请求都会有不同的表单,formBean可以为空
String showPage=aCurrentProcessor.getForwordURI(aFormBean, request, response);
//show是直接显示的页面地址
if(showPage==null){
response.sendError(404);
// response.sendRedirect(response.encodeRedirectURL("http://www.baidu.com"));
}
request.getRequestDispatcher(showPage).forward(request, response);

}

热心网友 时间:2024-10-25 09:15

怎么好的?

热心网友 时间:2024-10-25 09:15

代码不贴出来,还想解决问题?

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com