gpt4 book ai didi

java - html :text tag not working

转载 作者:行者123 更新时间:2023-12-02 08:37:25 25 4
gpt4 key购买 nike

我有一个看起来有点像这样的表单:

public class MaintainForecastInputForm extends ActionForm {
private MainMenuForm mainMenuForm = new MainMenuForm();
public SelectProdLineAssociationForm selectProdLineAssociationForm = new SelectProdLineAssociationForm();
private EconometricDataForm econometricDataForm = new EconometricDataForm();
private EconometricImportDownloadForm econometricImportDownloadForm = new EconometricImportDownloadForm();
private String userAction;
private List<MaintainForecastInputForm.DemandForecast> demands = new ArrayList<MaintainForecastInputForm.DemandForecast>();
private List<MaintainForecastInputForm.DemandForecast> forecasts = new ArrayList<MaintainForecastInputForm.DemandForecast>();
private DemandForecast iimsForecast = new DemandForecast();
private DemandForecast econometricForecast = new DemandForecast();

public static class DemandForecast {
private String subType;
private String shortTermWtAvg="0.0";
private String midTermWtAvg="0.0";
private String longTermWtAvg="0.0";
private String shortTermPct="0.0";
private String midTermPct="0.0";
private String longTermPct="0.0";
private List yearDemands = new ArrayList();

public static class Year {
private String fyTotalValue="0.0";
private String fyPctChange="0.0";
private List monthDemands = new ArrayList();

public String getFyPctChange() {
return fyPctChange;
}

public void setFyPctChange(String fyPctChange) {
this.fyPctChange = fyPctChange;
}

public String getFyTotalValue() {
return fyTotalValue;
}

public void setFyTotalValue(String fyTotalValue) {
this.fyTotalValue = fyTotalValue;
}
} // Year

public static class Month {
private String demandValue="0.0";
private String demandQuantity="0.0";

public String getDemandQuantity() {
return demandQuantity;
}

public void setDemandQuantity(String demandQuantity) {
this.demandQuantity = demandQuantity;
}

public String getDemandValue() {
return demandValue;
}

public void setDemandValue(String demandValue) {
this.demandValue = demandValue;
}
} // Month

public String getLongTermPct() {
return longTermPct;
}

public void setLongTermPct(String longTermPct) {
this.longTermPct = longTermPct;
}

public String getLongTermWtAvg() {
return longTermWtAvg;
}

public void setLongTermWtAvg(String longTermWtAvg) {
this.longTermWtAvg = longTermWtAvg;
}

public String getMidTermPct() {
return midTermPct;
}

public void setMidTermPct(String midTermPct) {
this.midTermPct = midTermPct;
}

public String getMidTermWtAvg() {
return midTermWtAvg;
}

public void setMidTermWtAvg(String midTermWtAvg) {
this.midTermWtAvg = midTermWtAvg;
}

public String getShortTermPct() {
return shortTermPct;
}

public void setShortTermPct(String shortTermPct) {
this.shortTermPct = shortTermPct;
}

public String getShortTermWtAvg() {
return shortTermWtAvg;
}

public void setShortTermWtAvg(String shortTermWtAvg) {
this.shortTermWtAvg = shortTermWtAvg;
}

public String getSubType() {
return subType;
}

public void setSubType(String subType) {
this.subType = subType;
}

public List getYearDemands() {
return yearDemands;
}

public void setYearDemands(List yearDemands) {
this.yearDemands = yearDemands;
}
} // DemandForecast
}

在我的 JSP 中我有以下内容:

<c:forEach items="${form.iimsForecast.yearDemands}" var="yearDemand"             varStatus="year">
<tr>
<td>${yearDemand.fiscalYear}</td>
<c:forEach items="${yearDemand.monthDemands}" var="yearMonth" varStatus="month">
<c:choose>
<c:when test="${year.count == 1 && month.count < yearDemand.currentMonth}">
<td class="lightShaded dmnd">
<html-el:text property="form.iimsForecast.yearDemands.monthDemands.demandValue">
</td>
...

我收到 JSP 异常 - 尽管存在 getter 属性,但在表单中未找到该属性。有人可以帮我解决这个问题吗?

最佳答案

您的代码不显示您是否有 getIimsForecast()表单上的方法(它只显示 iimsForecast 属性) - 如果没有,则需要添加它。然而,这并不是唯一的问题。

您的属性路径包括 yearDemandsmonthDemands和 getter 方法都返回 List s。这是非法的 - 嵌套属性路径必须具有单个 bean 或具有列表元素的索引访问权限(例如 iimsForecast.yearDemands[0].monthDemands[0].demandValue )。

最后,您可能不需要在属性路径前添加 form 前缀。 ,尽管这取决于您的配置以及您是否有封闭的 <html:form>标签。

关于java - html :text tag not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1201252/

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