我有以下JSP:
<jsp:useBean id="trackingBean" class="tracking.Tracking" scope="session">
<jsp:setProperty name="trackingBean" property="*" />
</jsp:useBean>
<form action="TrackingController" method="post">
<div id="upper_frequency">
Upper Freq: <input type="text" name="upperFreq"
>
</div>
<div id="lower_frequency">
Lower Freq: <input type="text" name="lowerFreq"
>
</div>
<div id="if_frequency">
IF Freq: <input type="text" name="ifFreq"
>
</div>
<div id="cap_high">
Tuning Cap highest value: <input type="text" name="capHigh"
>
</div>
<div id="cap_low">
Tuning Cap lowest value: <input type="text" name="capLow"
>
</div>
<input type="submit" value="Submit" />
</form>
这应该将trackingBean传递给其doGet的sevlet,与doPost相同:
doGet..
{
Tracking trackingBean = (Tracking) request.getSession(),getAttribute("tackingBean");
....
}
trackingBrean不为null,但是从不设置所有值?
豆子是:
package tracking;
public class Tracking {
public Tracking() {
}
private double upperFreq;
private double lowerFreq;
private double ifFreq;
private double capHigh;
private double capLow;
public double getUpperFreq() {
return upperFreq;
}
public void setUpperFreq(double upperFreq) {
this.upperFreq = upperFreq;
}
public double getLowerFreq() {
return lowerFreq;
}
public void setLowerFreq(double lowerFreq) {
this.lowerFreq = lowerFreq;
}
public double getIfFreq() {
return ifFreq;
}
public void setIfFreq(double ifFreq) {
this.ifFreq = ifFreq;
}
public double getCapHigh() {
return capHigh;
}
public void setCapHigh(double capHigh) {
this.capHigh = capHigh;
}
public double getCapLow() {
return capLow;
}
public void setCapLow(double capLow) {
this.capLow = capLow;
}
}
答案 0 :(得分:2)
你正在申请“tackingBean”你不需要“trackingBean”吗?