Java Beans, JSP and Access 2003 problem

I have problem with Access 2003 and Servlets

I have two beans:

MessageListBean and Message Bean;

A PageHandler class and a JSP page.

There are records in the tables message and actor and on the Single message page where I get just specific message record it works fine (SELECT * FROM message WHERE messageId=1).
When I try to get all records from the message table and to list them on the JSP page, nothing is returned.
No error messages.
Thanks,
Bill
public class MessageListBean {
    
    private ArrayList messages;
    
    /** Creates a new instance of MessageListBean */
    public MessageListBean() {
        messages = new ArrayList();
        i = 0;
    }
    public void addMessage (MessageBean message) {
        messages.add(message);
    }
    public ArrayList getMessages() {
        return messages;
    }
}
 
public class MessageBean {
    
    private String messageDate, subject, body, username, messageId, userImage;
    
    /** Creates a new instance of MessageBean */
    public MessageBean() {
        messageId="";
        body= "";
        subject="";
        username="";
        messageDate = "";
        userImage = "";
    }
    public String getMessageDate()
    {
        return messageDate;
    }
    public String getSubject()
    {
        return subject;
    }
    public String getBody()
    {
        return body;
    }
    public String getUsername()
    {
        return username;
    }
     public String getUserImage()
    {
        return userImage;
    }
    public String getMessageId()
    {
        return messageId;
    }
    public void setMessageDate(String mDate) throws Exception
    {  
        Date d = new SimpleDateFormat("yyyy-MM-dd").parse(mDate);
        messageDate = new SimpleDateFormat("dd-MM-yyyy").format(d);
    }
    
    public void setSubject(String subject)
    {
        this.subject = subject;
    }
    public void setBody(String body)
    {
        this.body = body;
    }
    public void setUsername(String username)
    {
        this.username = username;
    }
     public void setUserImage(String userImage)
    {
        this.userImage = userImage;
    }
    public void setMessageId(String messageId)
    {
        this.messageId = messageId;
    }
}
 
PageHandler class - processRequest method
 
 protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {    
        try
      {
        HttpSession mySession=request.getSession(true);
        //Validate if user is trying to avoid login
        
            MessageListBean MessageListBean = new MessageListBean();
            String order = request.getParameter("order");
 
            String orderText="ORDER BY messageDate DESC";
            if(order==null || order.trim().length()<1){
                orderText="ORDER BY messageDate DESC";
            }
            else {
               int o = new Integer(order).intValue();
                switch(o){
                    case 1: orderText="ORDER BY messageDate DESC";break;
                    case 2: orderText="ORDER BY messageDate ASC";break;
                    case 3: orderText="ORDER BY message.username DESC";break;
                    case 4: orderText="ORDER BY message.username ASC";break;
                    case 5: orderText="ORDER BY subject DESC";break;
                    case 6: orderText="ORDER BY subject ASC";break;
                }
 
            }
            ServletContext context = getServletContext();
            String appDirRoot = context.getRealPath("/");
            String connString = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)}; DBQ=" + appDirRoot + "forumDB.mdb";
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
            Connection connForum = DriverManager.getConnection(connString);
            Statement stmtMessages = connForum.createStatement();
            String sqlMessages = "SELECT * FROM message, actor WHERE message.username=actor.username " + orderText;
            ResultSet rsMessages = stmtMessages.executeQuery(sqlMessages);
           MessageBean message;
           int i=0;
            while (rsMessages.next())
            {
                i++;
               message = new MessageBean();
                message.setMessageDate(rsMessages.getString("messageDate"));
                message.setSubject(rsMessages.getString("subject"));
                message.setBody(rsMessages.getString("body"));
                message.setUsername(rsMessages.getString("username"));
                message.setMessageId("" + rsMessages.getInt("messageId") );
                message.setUserImage(rsMessages.getString("userImage"));
                MessageListBean.addMessage(message);
            }
            MessageListBean.setI(i);
            mySession.setAttribute("MessageListBean",MessageListBean);
           //mySession.setAttribute("c",i);
            connForum.close();
            response.sendRedirect("test.jsp");
          
        }
          catch (Exception e)
          {
             response.sendRedirect("default.jsp?message=Exception in MessageListGenerator");
          }   
    }
 
JSP page:
 
 <c:forEach items="${MessageListBean.messages}" var="message">
        <tr>
          <td colspan="3"></td>
          <td width="7%">
          <c:choose>
          <c:when test="${message.userImage!=null}">
            <img src="images/${message.userImage}" border="0" width="59" height="59">
          </c:when>
          <c:otherwise>
            <img src="images/default.gif" border="0" width="59" height="59"> 
          </c:otherwise>
          </c:choose>
          </td>
          <td colspan="3"><c:out value="${message.username}"/></td>
          <td colspan="2"><c:out value="${message.subject}"/></td>
          <td colspan="2" align="center"><a href="ViewMessage?messageId=${message.messageId}">View</a></td>
        </tr>
        </c:forEach>

Open in new window

bdimitryAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
>>response.sendRedirect("default.jsp?message=Exception in MessageListGenerator");

The above is incorrect btw (urls can't contain spaces)

You should really log an error and *then* do a redirect

Check server logs for errors you might have missed
0
bdimitryAuthor Commented:
I forgot to include a call in the JSP page  to the JSTL jar files.
Now it's working.
b.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.