Here I am using some crystal report which will connect to database and fetch the data to create report.
It will expect username and password from the calling function.
Also it will expect some parameter(Name) from the calling function. Below is the code
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Date;
import com.crystaldecisions.sdk.occa.report.application.ReportClientDocument;
import com.crystaldecisions.*;
import com.crystaldecisions.sdk.occa.report.data.Connections;
import com.crystaldecisions.sdk.occa.report.data.Fields;
import com.crystaldecisions.sdk.occa.report.data.IConnection;
import com.crystaldecisions.sdk.occa.report.data.ParameterField;
import com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat;
public [...]
Archive for the ‘Java’ Category
Export Crystal Report to PDF by using Java Program
Posted in Java, tagged Crystal report, export to pdf, Java on August 20, 2009 | Leave a Comment »
Difference between Struts and Spring Framework,
Posted in Spring, tagged difference between struts and spring framework on July 24, 2009 | Leave a Comment »
Sl. No
Struts
Spring
1
Struts is a web framework
Spring is an application
framework
2
Using MVC pattern
spring MVC is one of the
modules
3
Hard code to use applications
like hibernate, JDBC
Inbuilt hibernate, JDBC etc
4
Struts allows only JSP
Support JSPs, Velocity,
Free maker etc.,
5
Struts is heavy weight
Spring is light weight
6
Struts is tightly coupled
Spring is loosely coupled.
7
Excellent support for
Tag Library
Not that Much
8
Easy to integrate with other
client side technologies
Not [...]
Spring Framework
Posted in Spring, tagged AOP, IOC, POJO, Spring DAO, Spring Framework, Spring ORM on July 24, 2009 | 2 Comments »
Spring is standard in lightweight enterprise application framework. Layered architecture, which allows you to be selective about which of its components you use there are seven modules in Spring Frame work
I> Spring Core:
Uses IOC pattern to separate the application configuration with dependency specification from the actual application code.
IOC (Inversion of control)
No creation of object but [...]
Groovy and Grails
Posted in Java on June 29, 2009 | 1 Comment »
Groovy…
is an agile and dynamic language for the Java Virtual Machine
builds upon the strengths of Java but has additional power features inspired by languages like Python, Ruby and Smalltalk
makes modern programming features available to Java [...]
Example : MultiActionController in Spring
Posted in Spring, tagged controller, example, Java, mutiactioncontroller, Spring on March 18, 2009 | 6 Comments »
1> Controller Contains
public class testController extends MultiActionController {
public ModelAndView action_name1(HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse) {
System.out.println(“In Action1″);
return new ModelAndView(“view1″, “date”,”date”);
}
public ModelAndView action_name2(HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse) {
System.out.println(“In Action 2″);
return new ModelAndView(“view2″, “date”,”date”);
}
}
2> View contains
<a href=”test.htm?action=action_name1″ >Go to Action1 </a> |
<a href=”test.htm?action=action_name2″ >Go to Action2 </a>
3> Change in Application-servlet.xml
<bean name=”/test.htm” class=”testController”>
<property name=”methodNameResolver”>
<ref bean=”paramResolver”/>
</property>
</bean>
<bean id=”paramResolver” class=”org.springframework.web.servlet.mvc.multiaction.ParameterMethodNameResolver”>
<property name=”paramName”><value>action</value></property>
</bean>
Simple Way:
1> Controller Contains
same as above
2> [...]