简体   繁体   English

如何将Struts1.0标签ResponseUtils方法写入Struts2

[英]How to convert Struts1.0 tag ResponseUtils method write to Struts2

I am working on converting a Struts 1 site to Struts 2, not easy task as everything have changed from one framework to the next.我正在将 Struts 1 站点转换为 Struts 2,这不是一件容易的事,因为从一个框架到下一个框架都发生了变化。

I was hoping someone has used or know about the org.apache.struts.util.ResponseUtils specifically the write method.我希望有人使用过或了解org.apache.struts.util.ResponseUtils特别是 write 方法。 We are using Struts 1.0 and we are currently using this line in the code:我们正在使用 Struts 1.0,我们目前在代码中使用这一行:

 ResponseUtils.write(pageContext, results.toString());

Has anyone seen this tag?有人见过这个标签吗? use this tag?使用这个标签? and then convert it to Struts 2?然后将其转换为 Struts 2?

I have searched online and found some good tutorials and I am also reading "Struts2 in Action" which I saw recommended here in other post.我在网上搜索并找到了一些很好的教程,我也在阅读“Struts2 in Action”,我在其他帖子中看到了推荐。 But, very few sites or posts talk about specific tags.但是,很少有网站或帖子谈论特定标签。

I will appreciate any advice or hint that can let me to the path of success.我将感谢任何可以让我走上成功之路的建议或提示。

Create your own ResponseUtils with the method使用该方法创建您自己的ResponseUtils

public void write(PageContext pageContext, String text)
        throws JspException {

    JspWriter writer = pageContext.getOut();

    try {
        writer.print(text);

    } catch (IOException e) {
        throw new JspException(e);
    }

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM