java-ee

Setting Multipart for email that has attachment

て烟熏妆下的殇ゞ 提交于 2020-01-05 06:58:24
问题 From my application i am send mails that has attachments. the complete code is here public int sendMail(MailDraft mailDraftInstance, mailInstance, path){ //Send the mail String mailSubject = mailDraftInstance.subject String toAddress = mailDraftInstance.toAddress String ccAddress = mailDraftInstance.ccAddress String bccAddress = mailDraftInstance.bccAddress String fromAddress = mailDraftInstance.fromAddress String body = mailDraftInstance.body String smtpUsername = 'myusername' String

Where to close an Elasticsearch client connection?

限于喜欢 提交于 2020-01-05 06:57:07
问题 Where should I close the connection to a client for Elasticsearch? I am using Spring, and I don't want to use the Elasticsearch integration because I want to learn how to do it without first. Should only one client be created for the application? Meaning that it would have singleton scope? Or should it have prototype scope and close the connection for each interaction? 回答1: You should use one client per application, make it a singleton and close on application shutdown. 来源: https:/

CXF 2.7.3 give error with spring 3.2.1.RELEASE possible conflict with libraries

谁说胖子不能爱 提交于 2020-01-05 06:53:50
问题 I have a project prev working fine with Spring 3.0.1 and apache CXF 2.4, but as there were memory leak issues in apache CXF 2.4 I have upgrade to version apache CXF 2.7.3 but it is not working with either spring 3.0.1 nor latest spring version Spring version 3.2.1. Exception is provided below. I am using maven and provided depedencies in pom.xml Feb 27, 2013 11:16:05 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Allocate exception for servlet CXFServlet java.lang

Printer Friendly Pages With a Header on Every Page?

你说的曾经没有我的故事 提交于 2020-01-05 05:12:08
问题 I'm working in a J2EE environment with a web app that displays large amounts of tabular data. We want to be able to print these tables with each page displaying the header and footer. I understand some browsers support this through the thead,tbody,tfooter tags, but the users are using IE6 only. A row is normally only one line but on occasion can be two or three (maybe more). What are my options here? Is there a quick and easy way that I'm not aware of? Do I need to some how "calculate" the

Printer Friendly Pages With a Header on Every Page?

孤街浪徒 提交于 2020-01-05 05:11:11
问题 I'm working in a J2EE environment with a web app that displays large amounts of tabular data. We want to be able to print these tables with each page displaying the header and footer. I understand some browsers support this through the thead,tbody,tfooter tags, but the users are using IE6 only. A row is normally only one line but on occasion can be two or three (maybe more). What are my options here? Is there a quick and easy way that I'm not aware of? Do I need to some how "calculate" the

How to pass an object from a java class to servlet?

为君一笑 提交于 2020-01-05 04:49:26
问题 I am using Apache's HttpClient to call a servlet from a Java class. I want to send an object to the servlet which should save the object using Serialization. How to send the object to the servlet? public static void main(String[] args) { Names names = new Names(); names.setName("ABC"); names.setPlace("Bangalore"); HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet("http://localhost:9080/HttpClientPractice/FirstServlet"); //Rest of the code In the above code snippet

Maven dependecies for Mojarra 2.1

可紊 提交于 2020-01-05 04:40:16
问题 I want to use Mojarra 2.1 http://javaserverfaces.java.net/download.html and my container is Tomcat 7 and I am using IceFaces 2 . Should I include the API only as follows? <dependency> <groupId>javax.faces</groupId> <artifactId>javax.faces-api</artifactId> <version>2.1</version> </dependency> UPDATE: I am using servlet 3.0.1, jsp 2.2.1, el 2.2 maybe it's conflicting: <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.0.1</version> <scope

criteria.list() shows null pointer exception

余生长醉 提交于 2020-01-05 04:40:12
问题 I'am working on Hibernate 3.3. Recently I started using criteria. My Annotation class is as follows.. @Entity @Table(name = "EMAG_ADMINLOGIN", schema = "EMAG_USER") public class Adminlogin implements java.io.Serializable { private String username; private String password; private String fullname; private long isenabled; @Id @Column(name = "USERNAME", unique = true, nullable = false, length = 40) public String getUsername() { return this.username; } public void setUsername(String username) {

WAS Liberty - EJB - bean does not have a public constructor that does not take parameters & java.lang.NoClassDefFoundError

丶灬走出姿态 提交于 2020-01-05 04:27:06
问题 I am experiencing issue when migrating from WAS 7.0 to WAS Liberty Base. I have deployed EAR file in WAS Liberty Base. When I add the mdb-3.2 to server.xml for JMS Messaging, I get the following run-time error on EJB MDB Bean. [ERROR ] CNTR5007E: The com.companyname.appname.AdminMDBBean bean class for the AppEAR#AppEJB.jar#AdminMDBBean bean does not have a public constructor that does not take parameters. [ERROR ] CNTR4002E: The AppEJB.jar EJB module in the AppEAR application failed to start.

Need help on connecting to database using datasource connection pool

核能气质少年 提交于 2020-01-05 04:03:10
问题 I'd like to create a simple program where it connects to a database. I don't know what the problem is. Here is my code: Products.java / getters and setters * / ProductsDao.java public class ProductsDao { public ArrayList getAllProducts() throws NamingException, SQLException{ Connection conn = null; Statement stmt = null; ResultSet rs = null; conn = ConnectionFactory.getConnection(); stmt = conn.createStatement(); rs = stmt.executeQuery("SELECT * FROM products"); ArrayList products = new