• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

No Result defined for action in struts2.samples.actions.ReportsAction and result success

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

In my Struts2 project I had an error
"No result defined for action struts2.samples.actions.ReportsAction and result success"

when I tried to use jasperreports plugin with result type="jasper" and the struts.xml action mapping is as follows,

<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<!-- Author: SCO03_2 -->

<struts>
<!-- Add your configuration elements here -->
<package name="default" extends="struts-default,jasperreports-default">
<default-interceptor-ref name="defaultStack"/>
<action name="persons" class="struts2.samples.actions.PersonAction">
<result name="input">index.jsp</result>
<result type="chain">reports</result>
</action>
<action name="reports" class="struts2.samples.actions.ReportsAction">
<interceptor-ref name="params"/>
<interceptor-ref name="validation"/>
<interceptor-ref name="workflow"/>
<result name="success" type="jasper">
<param name="location">${reportLocation}</param>
<param name="dataSource">${persons}</param>
<param name="format">pdf</param>
</result>
<result name="input">index.jsp</result>
</action>
</package>
</struts>

PersonsAction.java (a required part)

public String execute() throws Exception {
try {
PersonsDao personsDao=new PersonsDao();
//calling helper class method to create a Person record on the data store
personsDao.create(firstname, lastname, age,sex,address,document,documentFileName);
return "success";
} catch (Exception ex) {
addActionError(ex.getMessage());
return "input";
}
}

ReportsAction.java

public String execute(){
try{
PersonsDao personDao=new PersonsDao();
persons=(List<Person>)personDao.list();
setReportLocation(new PersonsReport().createReport(request,"reports/Persons.jrxml","reports/Persons.jasper"));
return "success";
}catch(Exception ex){
ex.printStackTrace();
addActionError(ex.getMessage());
return "input";
}

}



In Actions,(PersonsAction.java and ReportsAction.java) functionality was perfect except the result view as jasper.File was properly uploaded in the desired location. I need the solution for this. I require your help.

Best Regards,
Ramesh K

 
We can fix it! We just need some baling wire, some WD-40, a bit of duct tape and this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic