gpt4 book ai didi

java - 如何从struts中的类文件中换行jsp

转载 作者:行者123 更新时间:2023-12-01 14:07:36 24 4
gpt4 key购买 nike

美好的一天,

下面是我在campaignListing.jsp中的jsp代码的一部分:

<td><bean:write name="row" property="campaignPeriod" /></td>

下面是我在类文件中的代码的一部分:

String cp = null;
cp= "From " + "<br>" + "To ";
cmForm.setCampaignPeriod(cp); //set the campaignPeriod to display cp string

我有一个 td:property="campaignPeriod"在我的 jsp 文件中。我想让“From”和“To”在浏览器中显示为两行。

想请教如何制作。我尝试输入 "<br />" , "\n"但它仍然只显示 1 行。

我是在struts2 java项目中做的。

最佳答案

不确定,但您可以尝试使用过滤器

<bean:write name="row" property="campaignPeriod" filter="false"/>

这就是文档关于过滤器的说法

if this attribute is set to true, the rendered property value will be filtered for characters that are sensitive in HTML, and any such characters will be replaced by their entity equivalents.

关于java - 如何从struts中的类文件中换行jsp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18778278/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com