hi dave newton... 
i dont know y u r unable to see all the code how ever i am attaching the
files now and the action is as follows
and i am also uploading the project as "jreport.rar" file
http://old.nabble.com/file/p30235227/JReport.rar JReport.rar 

package com.action; 
> 
> import java.util.ArrayList; 
> import java.util.List; 
> 
> import javax.servlet.ServletContext; 
> 
> import org.apache.struts2.ServletActionContext; 
> import com.opensymphony.xwork2.ActionSupport; 
> 
> 
> import net.sf.jasperreports.engine.JasperCompileManager; 
> import com.Person; 
> 
> 
> 
> public class JasperAction extends ActionSupport { 
> 
>    /** 
>         * 
>         */ 
> 
>        private static final long serialVersionUID = 1L; 
>        /** List to use as our JasperReports dataSource. */ 
>    private List myList; 
> 
> 
>        public String execute() throws Exception { 
> 
>        // Create some imaginary persons. 
>        Person p1 = new Person(new Long(1), "Patrick", "Lightbuddie"); 
>        Person p2 = new Person(new Long(2), "Jason", "Carrora"); 
>        Person p3 = new Person(new Long(3), "Alexandru", "Papesco"); 
>        Person p4 = new Person(new Long(4), "Jay", "Boss"); 
> 
>        // Store people in our dataSource list (normally they would come 
> from a database). 
>        myList = new ArrayList(); 
>        myList.add(p1); 
>        myList.add(p2); 
>        myList.add(p3); 
>        myList.add(p4); 
> 
>        // Normally we would provide a pre-compiled .jrxml file 
>        // or check to make sure we don't compile on every request. 
>        try { 
>                ServletContext context = null ; 
> 
>                context = ServletActionContext.getServletContext(); 
> 
> 
> JasperCompileManager.compileReportToFile(context.getRealPath("/jasper/Report.jrxml"),context.getRealPath("/jasper/Report.jasper"));
>  
> 
> 
>        } catch (Exception e) { 
>            e.printStackTrace(); 
>            return ERROR; 
>        } 
> 
>        return SUCCESS; 
>    } 
> 
>    public List getMyList() { 
>        return myList; 
>    } 
> 
> } 
-- 
View this message in context: 
http://old.nabble.com/result-type-Jasper--Struts-2--tp11004749p30235227.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to