package a;import java.io.IOException;
import java.io.PrintWriter;import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;public class showServlet extends HttpServlet{
/**
 * 
 */
private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String percentage = (String) request.getSession().getAttribute(
"uploadvalue");
String res = "<percent>" + percentage + "</percent>";
PrintWriter out = response.getWriter();
response.setContentType("text/xml");
response.setHeader("Cache-Control", "no-cache");//让浏览器对重复请求不做缓存
out.println("<response>");
out.println(res);
out.println("</response>");
out.close();
/*PrintWriter out=response.getWriter();
out.println("hello");*/
} protected void doPost(HttpServletRequest arg0, HttpServletResponse arg1)
throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(arg0, arg1);
}
}

解决方案 »

  1.   

    1、不需要自己改了,你运行过去了 ,弹出页面 ,然后查看源码,就可以得到了2、percent、response这些标签jsp都是有的 ?
      

  2.   

    给你一个例子。。
    <%@ page language="java" pageEncoding="UTF-8"%><%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
    <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
    <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
    <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html:html lang="true">
      <head>
        <html:base />
        
        <title>test.jsp</title> <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
    <style type="text/css">#dd li{
    width:150px;
    overflow:hidden;
    white-space:nowrap;
    text-overflow:ellipsis; //末尾用省略号显示 
    }
    </style>  </head>
      
      <body>
      <div  id="dd" >
      <table width="150px;" border="1">
      <tr>
      <td id="dd">
      <span id="dd"><li>发生大法师的发生大法师的发生的阿斯顿发生大法师的发生大法师的发生的</li></span>
      </td>
      </tr>
      </table>
      <ul>
      <li>等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等等</li>
      </ul>
      
      </div>
      </body>
    </html:html>