如题!期待高手回复!谢谢!

解决方案 »

  1.   

    以下代码,在我的程序可用。可以参照一下:
    <action name="EA0001Code" method="doCode"
    class="ea0001Action">
    <result type="plainText">
    <param name="location">
    /WEB-INF/jsp/debug/expres/aognl/EA0001.jsp
    </param>
    <param name="charSet">UTF-8</param>
    </result>
    </action>
      

  2.   

    //struts.xml----------------------------------------------
    <action name="plaintext">
            <result type="plainText">
             <param name="location">/index.jsp</param>
             <param name="charSet">UTF-8</param>
            </result>
    </action>
    //index.jsp------------------------------------------------
    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <title>My JSP 'index.jsp' starting page</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
      </head>
      
      <body>
        <%=new Date() %><br>
      </body>
    </html>
    显示:什么都没有
      

  3.   

    index.jsp<%@page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8" import="java.util.*"%>

    <%@taglib prefix="s" uri="/struts-tags"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
      <head>
      <title>My JSP 'index.jsp' starting page</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">   
      </head>
       
      <body>
    <%=new Date() %><br>
      </body>
    </html>
      

  4.   

    我也遇到了同样的问题,但是现在解决了,如下:ExampleTextAction.javapackage sample;public class ExampleTextAction {
        public String preview() throws Exception {
            return "textreport";
    }
    }
     struts.xml<?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd">
    <struts>
        <package name="text-example" namespace="/sample-text"
                     extends="struts-default">
            <action name="test" class="sample.ExampleTextAction" 
                           method="preview">
                <result name="textreport" type="plainText">
                  <param name="location">/test.jsp</param>
                </result>
            </action>
        </package>
    </struts>说明:
    struts.xml file should have a result name as textreport with
    type as plainText and having location param pointing to the
    actual text file, whose content is to be shown on screen as plain
    text.
      

  5.   

    在ie6,下面显示的确是不是源码;但是查看源码时,就是我们的jsp页面的代码了;当然这个查看源码的内容,不是经过servlet解析过的jsp文件!
    其结果,是一样的!
      

  6.   

    一直没解决,现在也没再弄struts2了,谢谢各位了,呵呵