DisplayGridAction.java

package com.dotj.web.struts; 
 
import java.util.Locale; 
import javax.servlet.http.HttpSession; 
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpServletResponse; 
 
import org.apache.commons.logging.Log; 
import org.apache.commons.logging.LogFactory; 
import org.apache.struts.action.Action; 
import org.apache.struts.action.ActionForm; 
import org.apache.struts.action.ActionForward; 
import org.apache.struts.action.ActionMapping; 
import org.apache.struts.util.MessageResources; 
import com.dotj.io.DataSet; 
 
 
public final class DisplayGridAction extends Action { 
    /** 
     * The <code>Log</code> instance for this application. 
     */ 
    protected static Log log = 
            LogFactory.getLog(DisplayGridAction.class); 
 
 
    // --------------------------------------------------------- Public Methods
/** * Process the specified HTTP request, and create the corresponding HTTP * response (or forward to another web component that will create it). * Return an <code>ActionForward</code> instance describing where and how * control should be forwarded, or <code>null</code> if the response has * already been completed. * * @param mapping The ActionMapping used to select this instance * @param form The optional ActionForm bean for this request (if any) * @param request The HTTP request we are processing * @param response The HTTP response we are creating * @throws Exception if the application business logic throws * an exception */ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Extract attributes we will need Locale locale = getLocale(request); MessageResources messages = getResources(request); HttpSession session = request.getSession(); // Set a transactional control token to prevent double posting if (log.isTraceEnabled()) { log.trace(" Setting transactional control token"); } saveToken(request); String sql = "SELECT A.*, B.name, B.email, D.name AS forum " + "FROM jiveMessage A, jiveUser B, jiveThread C, jiveForum D " + "WHERE A.userID = B.userID " + "AND A.threadID = C.threadID " + "AND C.forumID = D.forumID " + "AND A.messageID < 40 " + "ORDER BY A.messageID ASC"; DataSet ds = JDBCUtil.executeQuery(servlet.getServletContext(), sql); if (ds != null) request.setAttribute("dataset", ds); // Forward control to the edit user registration page if (log.isTraceEnabled()) { log.trace(" Forwarding to 'success' page"); } return (mapping.findForward("success")); } }