gpt4 book ai didi

java - struts2从2.3.16更新到2.3.32(修复S2-045)后,JSP文件无法解析某些Object的字段

转载 作者:太空宇宙 更新时间:2023-11-04 12:03:37 25 4
gpt4 key购买 nike

最近我们修复了struts2的'S2-045'问题。我更新了所有struts2相关的jar文件,包括freemarkerognlxWork等。我使用 tomcat8 部署我的动态 Web 项目。启动 tomcat 服务器时没有任何异常。但似乎出现了一些问题:一些值(从数据库获取)应该显示在jsp页面上不再显示。没有抛出异常。我还可以看到我已经在 Action Classes 中正确获取了这些对象。

<小时/>以下是一些示例

<小时/>
    // index.jsp ----- here is the list I want to show on the page.
// the list is the type of List<News> (Class News is my bussiness Class).
// I want to get the 'fTitle' and 'fCreatetime_s' from 'News' but they
// do not show up! (This used to be working very well.)
<s:bean name="org.ulibrary.web.Getarclist">
<s:iterator value="list">
<li>
<span class="listTitle">
<a target="_blank" href="ViewArc.action? uuid=${UUID}">${fTitle}</a>
</span>
<span class="listDate">${fCreatetime_s}</span>
</li>
</s:iterator>
</s:bean>
//=================================================================

以下是News.java相关字段id

    // News.java (**just some ralated fields**)
class News{
@Id
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid")
@Column(name = "f_uuid", length = 32, unique = true)
private String UUID;

@Column(name = "f_title", length = 200)
private String fTitle;

@Transient
private String fCreatetime_s;

public String getUUID() {
return UUID;
}
public void setUUID(String uuid) {
UUID = uuid;
}

public String getFTitle() {
return fTitle;
}


public void setFTitle(String title) {
fTitle = title;
}

public String getFCreatetime_s() {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
return formatter.format(Long.valueOf(fCreatetime));
}


public void setFCreatetime_s(String createtime_s) {
fCreatetime_s = createtime_s;
}
}

然后是GetarcList.java

    //GetarcList.java (just include some related fields)
class GetarcList{
private List list;

public void setList(List list) {
this.list = list;
}

//!!!!!!$$$$$$$$--- Attention -----$$$$$$$$$!!!!!!!!!!!
// this method returns a List<News> , I can successfully get every value of 'News' in the list
public List getList() throws AuctionException{
String orderby_str = (String) OrderByMap.get(String.valueOf(orderby));
list = webTagManager.getArcList(row, typeid, titlelen, infolen, orderby_str + " " + orderway);
return list;
}

}

我认为这可能是由 OGNL 或 JSP 相关的 jar 文件引起的。我在 index.jsp 或 java 文件中没有发现任何问题。

最佳答案

您需要按以下格式使用 getter/setter。只有一个开头小写字母的属性不是大写的。

    public String getfTitle() {
return fTitle;
}


public void setfTitle(String title) {
fTitle = title;
}

关于java - struts2从2.3.16更新到2.3.32(修复S2-045)后,JSP文件无法解析某些Object的字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40651036/

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