JSP参数转换出错.

liangkandy2002 2005-11-28 03:57:56
本SQLServer数据库字段是money型.
在JSP页面上,利用
<jsp:useBean id="invoice" scope="request" class="entities.Invoice"/>
<jsp:setProperty name="invoice" property="*"/>
出错.错误代码:
ERROR - Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: jsp.error.beans.property.conversion
at org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:885)
at org.apache.jasper.runtime.JspRuntimeLibrary.convert(JspRuntimeLibrary.java:267)
at org.apache.jasper.runtime.JspRuntimeLibrary.internalIntrospecthelper(JspRuntimeLibrary.java:353)
at org.apache.jasper.runtime.JspRuntimeLibrary.introspecthelper(JspRuntimeLibrary.java:306)
at org.apache.jasper.runtime.JspRuntimeLibrary.introspect(JspRuntimeLibrary.java:284)
at org.apache.jsp.jsp.invoiceMaintenance.modfiyInvoice_jsp._jspService(org.apache.jsp.jsp.invoiceMaintenance.modfiyInvoice_jsp:125)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:831)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:652)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1203)
at java.lang.Thread.run(Unknown Source)
由于Invoice类里,定义了BigDecimal,主要是setBigDecimal(),getBigDecimal()与
<jsp:setProperty name="invoice" property="*"/>
有数据转换的错误.如果在Invoice类里,定义更用float或者double型,由于精度问题,用float和double时有误差.高手帮助...
...全文
154 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
liangkandy2002 2006-01-17
  • 打赏
  • 举报
回复
没人回复,结贴
liangkandy2002 2005-11-30
  • 打赏
  • 举报
回复
d
liangkandy2002 2005-11-29
  • 打赏
  • 举报
回复
什么意思.
woolceo 2005-11-29
  • 打赏
  • 举报
回复
晕...楼主的bean...无语...
liangkandy2002 2005-11-29
  • 打赏
  • 举报
回复
以下是Bean代码:
package entities;
public class Invoice
{
private int voucherID;
private String voucherNumber; //存票票号
private String invoiceNumber; //发票编号
private String invoiceDate; //发票日期
private String dueDate; //最后期限
private String paymentDate; //支付日期
private int paymentTerm; //付款天数
private int paymentGracePeriod; //宽限天数
private float invoiceAmount; //发票总额
private BigDecimal discountAmount; //折扣金额
private float exchangeRate; //兑换率
private int invoiceTotalQuantity; //发票总粒数
private float invoiceTotalWeight; //发票总重量
private String differenceDescription; //价格差异描述
private String remarks; //发票备注
private int totalQuantity;
private float totalWeight;
private int status;
private String createdDate;
private String createdBy;

public CurrencyType currencyType;
public Buyer buyer;
public Vendor vendor;
public Material material;
public PublicFunc publicFunc;
/**
@roseuid 4233EDE50095
*/

public Invoice()
{
buyer=new Buyer();
vendor=new Vendor();
currencyType=new CurrencyType();
material=new Material();
publicFunc= new PublicFunc();
}

public int getVoucherID()
{
return voucherID;
}


/**
@return int
@roseuid 4233D8BA03BE
*/
public String getVoucherNumber()
{
return voucherNumber;
}

/**
@return String
@roseuid 4233D8C201DF
*/
public String getInvoiceNumber()
{
return invoiceNumber;
}

/**
@return java.sql.Date
@roseuid 4233D8CA019A
*/
public String getInvoiceDate()
{
return invoiceDate;
}

/**
@return java.sql.Date
@roseuid 4233D8D700F8
*/
public String getDueDate()
{
return dueDate;
}

/**
@return java.sql.Date
@roseuid 4233D8E00033
*/
public String getPaymentDate()
{
return paymentDate;
}

/**
@return int
@roseuid 4233D8E60349
*/
public int getPaymentTerm()
{
return paymentTerm;
}

/**
@return int
@roseuid 4233D8EE021E
*/

public int getPaymentGracePeriod()
{
return paymentGracePeriod;
}

/**
@return double
@roseuid 4233D8FB0281
*/
public float getInvoiceAmount()
{
return invoiceAmount;
}

/**
@return double
@roseuid 4233D9040234
*/
public BigDecimal getDiscountAmount()
{
return discountAmount;
}

/**
@return double
@roseuid 4233D9150057
*/
public float getExchangeRate()
{
return exchangeRate;
}

public int getInvoiceTotalQuantity()
{
return invoiceTotalQuantity;
}

public float getInvoiceTotalWeight()
{
return invoiceTotalWeight;
}

public int getTotalQuantity()
{
return totalQuantity;
}

public float getTotalWeight()
{
return totalWeight;
}
/**
@return String
@roseuid 4233D92000F3
*/
public String getDifferenceDescription()
{
return differenceDescription;
}

/**
@return String
@roseuid 4233D93C037F
*/
public String getRemarks()
{
return remarks;
}

public int getStatus()
{
return status;
}

public String getCreatedBy(){
return createdBy;
}

public String getCreatedDate(){
return createdDate;
}

public void setVoucherID(int voucherID)
{
this.voucherID=voucherID;
}


/**
@param int invoiceID
@roseuid 4233D95E0337
*/
public void setVoucherNumber(String voucherNumber)
{
this.voucherNumber=voucherNumber;
}

/**
@param invoiceNumber
@roseuid 4233D96D0375
*/
public void setInvoiceNumber(String invoiceNumber)
{
this.invoiceNumber=invoiceNumber;
}

/**
@param invoiceDate
@roseuid 4233D9810388
*/
public void setInvoiceDate(String invoiceDate)
{
this.invoiceDate=invoiceDate;
}

public void setDueDate(String dueDate)
{
this.dueDate=dueDate;
}

/**
@param paymentDate
@roseuid 4233D9900299
*/

public void setPaymentDate(String paymentDate)
{
this.paymentDate= paymentDate;
}

/**
@param paymentTerm
@roseuid 4233D99F00A6
*/
public void setPaymentTerm(int paymentTerm)
{
this.paymentTerm=paymentTerm;
}

/**
@param paymentGracePeriod
@roseuid 4233D9B303D0
*/
public void setPaymentGracePeriod(int paymentGracePeriod)
{
this.paymentGracePeriod=paymentGracePeriod;
}

/**
@param invoiceAmount
@roseuid 4233D9D50357
*/
public void setInvoiceAmount(float invoiceAmount)
{
this.invoiceAmount=invoiceAmount;
}

/**
@param discountAmount
@roseuid 4233DAB10349
*/
public void setDiscountAmount(BigDecimal discountAmount)
{
this.discountAmount=discountAmount;
}

/**
@param exchangeRate
@roseuid 4233D9F101BC
*/
public void setExchangeRate(float exchangeRate)
{
this.exchangeRate=exchangeRate;
}

public void setInvoiceTotalQuantity(int invoiceTotalQuantity)
{
this.invoiceTotalQuantity=invoiceTotalQuantity;
}

public void setInvoiceTotalWeight(float invoiceTotalWeight)
{
this.invoiceTotalWeight=invoiceTotalWeight;
}

/**
@param differenceDescription
@roseuid 4233DA0C0233
*/
public void setDifferenceDescription(String differenceDescription)
{
this.differenceDescription=differenceDescription;
}

/**
@param remarks
@roseuid 4233DA230381
*/

public void setRemarks(String remarks)
{
this.remarks=remarks;
}

public void setStatus(int status)
{
this.status=status;
}


public void setTotalQuantity(int totalQuantity)
{
this.totalQuantity=totalQuantity;
}

public void setTotalWeight(float totalWeight)
{
this.totalWeight=totalWeight;
}

public void setCreatedBy(String createdBy){
this.createdBy=createdBy;
}

public void setCreatedDate(String createdDate){
this.createdDate=createdDate;
}
public int updateInvoice(int userID)
{
//System.out.print(userID);
dbAccess dba=new dbAccess();
Date myDate = new Date();
SimpleDateFormat bartDateFormat = new SimpleDateFormat("yyyy-MM-dd");

String sql=
" update invoice set invoice_Number='"+getInvoiceNumber()+
"',Currency_type_id="+currencyType.getCurrencyTypeID()+
",Mt_ID="+material.getMtID()+
",Vendor_ID="+vendor.getVendorID()+",Buyer_ID="+buyer.getStaffID()+
",invoice_date='"+getInvoiceDate()+"',due_date='"+getDueDate()+
"',Payment_date='"+getPaymentDate()+"',Payment_term="+getPaymentTerm()+
",Payment_grace_period="+getPaymentGracePeriod()+",invoice_amount="+getInvoiceAmount()+
",Discount_amount="+getDiscountAmount()+",Exchange_Rate="+getExchangeRate()+
",Remarks='"+getRemarks()+"',total_Quantity="+getTotalQuantity()+
",total_Weight="+getTotalWeight()+",created_by="+userID+
",created_date='"+bartDateFormat.format(myDate)+"' where (voucher_Number='"+getVoucherNumber()+"')" +
" and (Status=0) " ;

System.out.print(sql);
return dba.execute(sql);
}
}
Bean的discountAmount变量定义成BigDecimal型,导致JSP的内部getX(),setX(),提示Bean属性转换出错.
wsk_228 2005-11-28
  • 打赏
  • 举报
回复
把bean放上来看一下。
liangkandy2002 2005-11-28
  • 打赏
  • 举报
回复
uping

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧