Struts 自动将字符串转换为垃圾值时出错
Struts Error auto converting string to garbage value
我正在从数据库中获取字符串值和其他数据并设置为 class 对象的字符串,但我在网页中显示的字符串显示垃圾值,如 -3892 之类的东西
在ClassTravelVO String
private String travelCombnationId;
//Setter getters
public String getTravelCombnationId() {
return travelCombnationId;
}
public void setTravelCombnationId(String travelCombnationId) {
this.travelCombnationId = travelCombnationId;
}
在数据库中 Class
while (rs.next()) {
travel = new TravelVO();
travel.setTravelId(rs.getLong("TRAVEL_ID"));
travel.setTravelCombnationId(rs.getString("TRAVEL_COMB_ID")); // Showing Value properly here
System.out.println(travel.getTravelCombnationId());
travel.setTravelReason(rs.getString("TRAVEL_REASON"));
myApprovedRequests.add(travel);
}
操作Class
iAcceptForwardList = TravelDAO.getInstance().myPendingRequest();
JSP 页数
<s:iterator value="iAcceptForwardList" var="quesvar" status="questat">
<tr>
<td><s:text name="%{iAcceptForwardList[#questat.index].travelCombnationId}"/></td>
</tr>
</s:iterator>
当我进入 DAO 时它正确显示了值
显示在系统输出 T-268-300-2018-Jul
其在 jsp 页上的显示值 -72737
请帮忙..
使用属性而不是直接使用对象变量
<s:property value="%{iAcceptForwardList[#questat.index].travelCombnationId}" />
我正在从数据库中获取字符串值和其他数据并设置为 class 对象的字符串,但我在网页中显示的字符串显示垃圾值,如 -3892 之类的东西
在ClassTravelVO String
private String travelCombnationId;
//Setter getters
public String getTravelCombnationId() {
return travelCombnationId;
}
public void setTravelCombnationId(String travelCombnationId) {
this.travelCombnationId = travelCombnationId;
}
在数据库中 Class
while (rs.next()) {
travel = new TravelVO();
travel.setTravelId(rs.getLong("TRAVEL_ID"));
travel.setTravelCombnationId(rs.getString("TRAVEL_COMB_ID")); // Showing Value properly here
System.out.println(travel.getTravelCombnationId());
travel.setTravelReason(rs.getString("TRAVEL_REASON"));
myApprovedRequests.add(travel);
}
操作Class
iAcceptForwardList = TravelDAO.getInstance().myPendingRequest();
JSP 页数
<s:iterator value="iAcceptForwardList" var="quesvar" status="questat">
<tr>
<td><s:text name="%{iAcceptForwardList[#questat.index].travelCombnationId}"/></td>
</tr>
</s:iterator>
当我进入 DAO 时它正确显示了值
显示在系统输出 T-268-300-2018-Jul
其在 jsp 页上的显示值 -72737
请帮忙..
使用属性而不是直接使用对象变量
<s:property value="%{iAcceptForwardList[#questat.index].travelCombnationId}" />