struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Madel,Kurt" <kma...@csmi.com>
Subject Is there a better way to dispatch to another servlet from an Acti on
Date Thu, 31 Oct 2002 21:33:00 GMT
    public ActionForward execute( ActionMapping mapping,
                                ActionForm form,
                                HttpServletRequest request,
                                HttpServletResponse response )
   throws Exception, java.io.IOException {
   	
    HttpSession session = request.getSession(true);
   	
	String year= (String) session.getAttribute("year");

    // Get the primary key of the item from the request
    String object = request.getParameter( "object" );
    String field = request.getParameter( "field" );
    String arg = request.getParameter( field );
    String order ;//= request.getParameter( "order" );
    
    if(request.getParameterMap().containsKey("order"))
           order = request.getParameter( "order" );
    else
        order=object;
    
    object = object + "." + field;
    
    // Call the project data access object 
    ProjectDAO dao = new ProjectDAO();
    List projectList = dao.getProjectList(object, arg, year);


    //request.setAttribute("object", object);
    request.setAttribute("projectList", projectList); 
    
    if(request.getParameterMap().containsKey("pdf")){
    	RequestDispatcher dispatcher;
 
dispatcher=request.getRequestDispatcher("/servlet/com.csmi.doe.core.view.pro
ject.ProjectListPDF");
    	dispatcher.forward(request, response);
    }   
    
    // Return the ActionForward that is defined for the success condition
    return mapping.findForward( "Success");
  }

Kurt Madel
Programmer, CSMi
(703) 823-4300 ext. 170

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message