private void htmlShowEntitySpelling(HttpServletRequest req,
            HttpServletResponse res) throws ServletException, IOException {
        
        String entityId = req.getParameter("entityId");
        if (entityId == null) {
            displayHtmlJsp(req, res, "error.jsp");
            return;
        }
        
        String buttonPressed = req.getParameter("buttonPressed");
        if (buttonPressed == null)
            buttonPressed = "";
        
        BeanCollection entityBeanList = this.retrieveEntityBeanList(req);
        
        EntityBean entity = null;
        if (buttonPressed.equalsIgnoreCase("next")) {
            entity = findNextEntityBean(entityBeanList, Integer
                    .parseInt(entityId));
        } else if (buttonPressed.equalsIgnoreCase("previous")) {
            entity = findPreviousEntityBean(entityBeanList, Integer
                    .parseInt(entityId));
        } else {
            entity = findEntityBeanById(entityBeanList, entityId);
        }
        
        if (entity == null) {
            displayErrorMessage(req, res, ERROR_ID_NOTFOUND);
            return;
        }
        // entity found
        req.setAttribute("entity", entity);
        
        // check to see if there is a parentEntity
        EntityBean parentEntity = this.getParentEntity(entityBeanList, entity);
        if (parentEntity != null) {
            req.setAttribute("navigate", setNavigate(parentEntity
                    .getSubEntities(), entity));
            req.setAttribute("parentEntity", parentEntity);
        } else {
            req.setAttribute("navigate", setNavigate(entityBeanList, entity));
        }
        // redirect
        displayHtmlJsp(req, res, "entitySpelling.jsp");
    }