0

Please help me. I am trying to search order no from Search2.jsp and display it in a table at Display2.jsp.

The error is

javax.el.PropertyNotFoundException: Property 'OrderNo' not found on type bean.OrderBean
    at javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:223)
    at javax.el.BeanELResolver$BeanProperties.access$400(BeanELResolver.java:200)
    at javax.el.BeanELResolver.property(BeanELResolver.java:311)
    at javax.el.BeanELResolver.getValue(BeanELResolver.java:85)
    at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:67)
    at org.apache.el.parser.AstValue.getValue(AstValue.java:169)
    at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
    at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:985)
    at org.apache.jsp.Display2_jsp._jspx_meth_c_005fforEach_005f0(Display2_jsp.java:111)
    at org.apache.jsp.Display2_jsp._jspService(Display2_jsp.java:69)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
    at servlet.SearchServlet.doGet(SearchServlet.java:48)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Dec 02, 2013 6:06:18 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [SearchServlet] in context with path [/SearchAndDeleteRecords] threw exception [An exception occurred processing JSP page /Display2.jsp at line 12

9:        <table>
10:              <c:forEach items="${orderno}" var="name">
11:    <tr>
12:        <td>${name.OrderNo}</td>
13:        <td>${name.menuid}</td>
14:        <td>${name.Quantity}</td>
15:        <td>${name.remarks}</td>


Stacktrace:] with root cause

Below are my codes.

Web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
  <display-name>SearchAndDeleteRecords</display-name>
  <servlet>
    <display-name>SearchServlet</display-name>
    <servlet-name>SearchServlet</servlet-name>
    <servlet-class>servlet.SearchServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>SearchServlet</servlet-name>
    <url-pattern>/SearchServlet</url-pattern>
  </servlet-mapping>
</web-app>

ConnectionManager.java Ignore the url. It is an example only.

public class ConnectionManager {
      static Connection conn;

        public static Connection getConnection()
        {
            try
            {
                String url = "localhost";
                String dbName = "tablename"; 
                String uname = "username";
                String pwd = "password";

                Class.forName("com.mysql.jdbc.Driver");
                try
                {
                    conn = DriverManager.getConnection(url+dbName,uname,pwd);
                }
                catch (SQLException ex)
                {
                    ex.printStackTrace();
                }
            }
            catch(ClassNotFoundException e)
            {
                System.out.println(e);
            }
            return conn;
        }
}

Search2.jsp

   <body>
        <center>
            <form name ="search" action="SearchServlet" method ="GET">
                <TABLE BORDER="1" >
                    <TR>
                        <TD> <h4 >Order number:</h4> </TD>
                        <TD> <input type="text" name="orderno" /> </TD>
                    </TR>
                    <TR>
                        <TD COLSPAN="2" ALIGN="CENTER"">
                            <input type="submit" value="search" />
                            <input type="reset" value="clear" />
                        </TD>
                    </TR>
                </TABLE>
            </form>
        </center>
    </body

SearchServlet.java

protected void doGet(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {

        String orderno = request.getParameter("orderno");
        int ordernoint = Integer.parseInt(request.getParameter("orderno"));
        OrderBean OrderBean = new OrderBean();
        OrderBean.setOrderNo(ordernoint);
        SearchOrderDAO dd = new SearchOrderDAO();

        request.setAttribute("orderno", dd.retrieveOrderList());
        RequestDispatcher view = request.getRequestDispatcher("Display2.jsp");
        view.forward(request, response);

    }
}

OrderBean.java

public class OrderBean {

    private static int OrderNo;
    private String menuid;
    private int Quantity;
    private String remarks;
    private int consumerid;
    private String status;



    public static int getOrderNo() {
        return OrderNo;
    }

    public void setOrderNo(int orderNo) {
        OrderNo = orderNo;
    }

    public String getMenuid() {
        return menuid;
    }

    public void setMenuid(String menuid) {
        this.menuid = menuid;
    }

    public int getQuantity() {
        return Quantity;
    }

    public void setQuantity(int quantity) {
        Quantity = quantity;
    }

    public String getRemarks() {
        return remarks;
    }

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

    public int getConsumerid() {
        return consumerid;
    }

    public void setConsumerid(int consumerid) {
        this.consumerid = consumerid;
    }

    public String getStatus() {
        return status;
    }

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


}

SearchOrderDAO.java

public class SearchOrderDAO {

    Statement stmt = null;
    static Connection currentCon = null;
    static ResultSet rs = null;



public ArrayList retrieveOrderList(){
{

     ArrayList<OrderBean> v = new ArrayList<OrderBean>();

     int orderno = OrderBean.getOrderNo();

    try {


    currentCon = ConnectionManager.getConnection();

    String searchQuery = "select * from f_b_orders where idF_B_Orders='" + orderno + "'";

    PreparedStatement ps = currentCon.prepareStatement(searchQuery);

    ResultSet rs = ps.executeQuery();
        OrderBean OrderBean = null;
        while (rs.next()) {

            OrderBean = new OrderBean();
            OrderBean.setOrderNo(rs.getInt("idF_B_Orders"));
            OrderBean.setConsumerid(rs.getInt("userId"));
            OrderBean.setMenuid(rs.getString("F_B_Menu_Id"));
            OrderBean.setRemarks(rs.getString("Remarks"));
            OrderBean.setQuantity(rs.getInt("Quantity")); 
            OrderBean.setStatus(rs.getString("Status"));
             v.add(OrderBean);


        }
    }catch(Exception asd){
        System.out.println(asd.getMessage());
    }
    return v;
}
}
}

Display2.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page language="java" import="java.util.*" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Display Page</title>
    </head>
    <body>
       <table>
             <c:forEach items="${orderno}" var="name">
   <tr>
       <td>${name.OrderNo}</td>
       <td>${name.menuid}</td>
       <td>${name.Quantity}</td>
       <td>${name.remarks}</td>
       <td>${name.consumerid}</td>
       <td>${name.status}</td>
    </tr>
</c:forEach>

            </table>
</table>


    </body>
</html>
2
Contributors
2
Replies
19
Views
3 Years
Discussion Span
Last Post by tr1stina
0

seems to me you are looking for 'OrderNo' while you should be looking for 'orderNo'.
your method is 'getOrderNo()', the name you should use is that methodname, without the get, starting with a lower case.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.