当前位置: 技术问答>java相关
多么简单的一个问题啊,帮帮我吧~
来源: 互联网 发布时间:2015-06-02
本文导语: 我用JB6建了一个工程,里面两个类: package t; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.*; /** * Title: * Description: * Copyright: Copyright (c) 2002 * Company: * @author unascribed * @version...
我用JB6建了一个工程,里面两个类:
package t;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
/**
*
*
*
*
* @author unascribed
* @version 1.0
*/
public class TServlet extends HttpServlet
{
private static final String CONTENT_TYPE = "text/xml";
public void service(HttpServletRequest req,HttpServletResponse res)
{
res.setContentType("text/xml");
MakeXml myxml=new MakeXml();
myxml.outputPage();
}
}
package t;
/**
*
*
*
*
* @author unascribed
* @version 1.0
*/
import java.io.*;
public class MakeXml
{
public void outputPage()
{
System.out.println("");
System.out.println("");
System.out.println("");
System.out.println("Tom");
System.out.println("20");
System.out.println("");
System.out.println("");
}
}
然后按TServlet.java右键的WEB RUN后,界面什么都没有,是空白!在MESSAGES里有
Tom
20
请问这是怎么回事,我该怎么做能让TOM 20显示在界面上(用我这种思路),谢谢!
package t;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
/**
*
Title:
*
Description:
*
Copyright: Copyright (c) 2002
*
Company:
* @author unascribed
* @version 1.0
*/
public class TServlet extends HttpServlet
{
private static final String CONTENT_TYPE = "text/xml";
public void service(HttpServletRequest req,HttpServletResponse res)
{
res.setContentType("text/xml");
MakeXml myxml=new MakeXml();
myxml.outputPage();
}
}
package t;
/**
*
Title:
*
Description:
*
Copyright: Copyright (c) 2002
*
Company:
* @author unascribed
* @version 1.0
*/
import java.io.*;
public class MakeXml
{
public void outputPage()
{
System.out.println("");
System.out.println("");
System.out.println("");
System.out.println("Tom");
System.out.println("20");
System.out.println("");
System.out.println("");
}
}
然后按TServlet.java右键的WEB RUN后,界面什么都没有,是空白!在MESSAGES里有
Tom
20
请问这是怎么回事,我该怎么做能让TOM 20显示在界面上(用我这种思路),谢谢!
|
没有println()就用writeln();