In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article is to share with you about the report designer using the spring framework to achieve custom datasets, the editor feels very practical, so share it with you to learn, I hope you can get something after reading this article, do not say much, follow the editor to have a look.
Spring is an open source framework created to address the complexity of enterprise application development. In the web development environment, it is often used in conjunction with struts and hibernate to develop a standard framework. The secondary development in moisturizing can also be deployed in web projects in conjunction with the SSH framework. This article describes the use of spring in the designer to implement custom datasets without starting the web service at design time.
Implementation idea: write two custom datasets, one for use in the designer and one for use in the web project. The classes used in the designer need to write code to temporarily load the spring framework configuration file to start the spring framework. Web project does not need to be written, can be directly integrated with struts, through listeners to start the struts framework at the same time start the spring framework.
Step 1: copy the spring framework jar package.
To write a simple custom dataset using spring injection, you first need to copy spring's IOC core container and the jar package supported for web to the designer's lib directory (\ reportHome\ designer\ web\ WEB-INF\ lib).
Step 2: write a simple custom dataset.
Public class Test {public DataSet getDataSet (Context ctx, DataSetConfig dsc, boolean retrieve) {DataSet ds = new DataSet ("ds1"); / / define the dataset name ds.addCol ("product ID"); / / define the display column ds.addCol ("product name"); List col1 = new ArrayList (); / / first column analog data set for (int I = 1; I
< bean id="SpringTest" class="com.runqian.SpringTest "> < property name="test"> < ref bean="Test" /> < /property> < /bean> < /beans>The code of the Spring calling class is as follows:
Public class SpringTest implements IDataSetFactory {private Test test; public SpringTest () {} public void setTest (Test test) {this.test = test;} public DataSet createDataSet (Context ctx, DataSetConfig dsc, boolean retrieve) {ApplicationContext cxt = new ClassPathXmlApplicationContext (new String\ [\] {"applicationContext.xml"}); / / manually load the configuration file test = (Test) cxt.getBean ("Test") / / load the previously defined custom dataset class return test.getDataSet (ctx, dsc, retrieve);}}
After compiling the previously written custom dataset and spring calling class, place the .class file in the designer's\ reportHome\ designer\ web\ WEB-INF\ classes directory (add the package file)
Step 4: start the designer to implement a custom dataset.
Open the designer, select the custom dataset, and fill in the package name and class name of the spring calling class
The column name defined in the previous class is displayed, and the dataset is generated successfully
This enables a custom dataset to be implemented in the designer using the spring framework without starting the web service.
The above is the report designer using the spring framework to achieve custom datasets, the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.