Hi all,
I am having a weird problem with my jsp page when I try to do the following.
1 I have a form where user can input some information
2 When the form submit I handle the request by a servlet and store the information into a bean.
org.apache.jasper.JasperException: Cannot find any information on property 'Type' in a bean of type 'Product.ProductBean'
Here is my code for it
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, java.io.IOException {
ProductBean MyProduct = getSubmittedProduct(request);
request.setAttribute("product", MyProduct);
String url = "/list.jsp";
ServletContext sc = getServletContext();
RequestDispatcher rd = sc.getRequestDispatcher(url);
rd.forward(request, response);
}
private ProductBean getSubmittedProduct(HttpServletRequest request){
String Type = request.getParameter("txt_Type");
String Description = request.getParameter("txt_ Description");
double Balance = Double.parseDouble(request.getParameter("txt_Balance"));
double Unit_Price = Double.parseDouble(request.getParameter("txt_Unit_Price"));
String Unit_Measure = request.getParameter("txt_Unit_Measure");
int Sell_By_Yard = Integer.parseInt(request.getParameter("txt_Sell_By_Yard"));
throws ServletException, java.io.IOException {
ProductBean MyProduct = getSubmittedProduct(request);
request.setAttribute("product", MyProduct);
String url = "/list.jsp";
ServletContext sc = getServletContext();
RequestDispatcher rd = sc.getRequestDispatcher(url);
rd.forward(request, response);
}
private ProductBean getSubmittedProduct(HttpServletRequest request){
String Type = request.getParameter("txt_Type");
String Description = request.getParameter("txt_ Description");
double Balance = Double.parseDouble(request.getParameter("txt_Balance"));
double Unit_Price = Double.parseDouble(request.getParameter("txt_Unit_Price"));
String Unit_Measure = request.getParameter("txt_Unit_Measure");
int Sell_By_Yard = Integer.parseInt(request.getParameter("txt_Sell_By_Yard"));
ProductBean MyProduct = new ProductBean();
MyProduct.setType(Type);
MyProduct.setDescription(Description);
MyProduct.setBalance(Balance);
MyProduct.setUnit_Price(Unit_Price);
MyProduct.setUnit_Measure(Unit_Measure);
MyProduct.setSell_By_Yard(Sell_By_Yard);
MyProduct.setType(Type);
MyProduct.setDescription(Description);
MyProduct.setBalance(Balance);
MyProduct.setUnit_Price(Unit_Price);
MyProduct.setUnit_Measure(Unit_Measure);
MyProduct.setSell_By_Yard(Sell_By_Yard);
return MyProduct;
}
}
3 From the Servlet I forward my bean result to the jsp page to display the information.
4 I got an error on the display.jsp page saying that
<jsp:useBean id="product" class="Product.ProductBean" scope="request" />
<table>
<tr>
<td><jsp:getProperty name="product" property="Type" /></td>
<td><jsp:getProperty name="product" property="Description" /></td>
<td><jsp:getProperty name="product" property="Balance" /></td>
<td><jsp:getProperty name="product" property="Unit_Price" /></td>
<td><jsp:getProperty name="product" property="Unit_Measure" /></td>
<td><jsp:getProperty name="product" property="Sell_By_Yard" /></td>
</tr>
</table>
<tr>
<td><jsp:getProperty name="product" property="Type" /></td>
<td><jsp:getProperty name="product" property="Description" /></td>
<td><jsp:getProperty name="product" property="Balance" /></td>
<td><jsp:getProperty name="product" property="Unit_Price" /></td>
<td><jsp:getProperty name="product" property="Unit_Measure" /></td>
<td><jsp:getProperty name="product" property="Sell_By_Yard" /></td>
</tr>
</table>
It cannot find any information for any of my get Property method.
I want to get it to work with tomcat and I am using version 4.0.3.
What weird is that I am able to get it to work with Jrun without any problem it just tomcat giving me a hard time. If you know anything that I might of done wrong please let me know.
Thanks,
Duc
Join the world’s largest e-mail service with MSN Hotmail. Click Here
=========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com