• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Tomorrow is the first day of the new metric calendar. Comfort me tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic