java-ee-6

How to extract text from forms marked with enctype:multipart/form-data(JSF 2.0)

自闭症网瘾萝莉.ら 提交于 2019-12-08 10:38:18
问题 I have a JSF page that has a h:form that has some textfields and also an imageupload gadget from primefaces My question is: How can i get the text from the fields and assign them to some variable.(The objective is to separate the uploaded image/s from the text) -What should i do? -Do i need a filter, for that? -Is there any easy way to achieve it with primefaces fileupload tool? 回答1: This is not trivial with PrimeFaces 2.2.1. The PF 2 file upload handling is a bit an epic fail. Under the

Faces Navigation not really working in JSF2

白昼怎懂夜的黑 提交于 2019-12-08 09:56:32
问题 I'm using JSF 2.0 this is my faces-config.xml <?xml version="1.0" encoding="UTF-8"?> <!-- This file is not required if you don't need any extra configuration. --> <faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"> <navigation-rule> <from-view-id>/pages/test/test.html</from-view-id> <navigation-case> <from

DAO and Service layer design

≯℡__Kan透↙ 提交于 2019-12-08 09:35:21
问题 I am developing web application with Java EE 6. In order to minimize calls to database will it be a good idea to have classes: Data access class (DAO) will call only basic methods getAllClients, getAllProducts, getAllOrders, delete, update methods - CRUD methods. Service class which will call CRUD methods but in addition filter methods e.g. findClientByName, findProuctByType, findProductByYear, findOrderFullyPaid/NotPaid etc... which will be based on basic DAO methods. Thank you 回答1: In my

How do i Send POST method with the JSON data (java)?

我怕爱的太早我们不能终老 提交于 2019-12-08 08:36:59
问题 i need toSend POST method with the JSON data ,Make sure i need to send JSON Object serialized into string. Not the JSON string itself.so how can i implement this using JAVA 回答1: public static String sendPostRequest(String postURL) throws Exception{ String responseStr=null; //make POST request String jsonContent = "{'name': 'newIndia','columns': [{'name': 'Species','type': 'STRING'}],'description': 'Insect Tracking Information.','isExportable': true}"; //String data = "{\"document\" : {\"_id\"

How can I push messages from Activemq to Java Application

假如想象 提交于 2019-12-08 08:30:49
问题 Hi developers, I want to write 2 .java files using JMS library names are MessageProducer and MessageConsumer . I added activemq-all-5.8.0.jar and commons-io-2.4.jar files in my lib folder.and I changed port number of Activemq from 61616 to 61617 . using MessageProducer.java file,I will send messages to Activemq .For this I wrote code it's working fine.If you want to see click on this Link. I want to send messages from Activemq to MessageConsumer.java .This is Application is in Apache Tomcat (

Expose current progress of an @Asynchronous function to use in View

孤者浪人 提交于 2019-12-08 07:18:14
问题 In my JEE6-App (running on Glassfish 3.0.1) I have an EmailEJB which has to send lots of mails. The mails are sent asynchronously, so its annotated with the new EJB3.1 @Asynchronous, letting it be run in a separate Thread. Now i want the user to be informed about the current status of the method: How many mails have already been sent? Sending the mails asynchronously works fine, but i can't figure out how to let the progress be accessible from outside. Seems like my approach to do that is

How can I send http request to another servlet

牧云@^-^@ 提交于 2019-12-08 06:56:27
问题 In my project folder,We have 2 java files under ContextPath/WEB-INF/Classes/*.class names are App1.class and App2.class If I want to Run App1.class ,Just i need to trigger URL in browser. http://localhost:8080/Mapping/App1 in the same way,if you want to trigger App2.class ,use the following link http://localhost:8080/Mapping/App2 I want to trigger App2 from App1 ,means If you trigger App1 with corresponding URL in browser,It will be trigger App2 . I don't want to any response also. How can I

How to limit an upload speed in java servlet?

谁说我不能喝 提交于 2019-12-08 05:45:46
问题 I'm working on an app (based on Spring as DI and MVC framework) that has a file upload function which is currently implemented using Spring Multipart Upload (which in it's turn utilizes commons fileupload libs). So what I'm looking for is a way to lower the upload bandwidth consumption. How can I accomplish that? 回答1: Limiting the upload bandwidth consumption may not be possible unless you are using a custom file uploader on the client. Assuming that the Spring Multipart Upload is just an

Could not open JPA EntityManager for transaction; org.hibernate.exception.GenericJDBCException: Could not open connection

无人久伴 提交于 2019-12-08 05:34:19
问题 I am working on spring hibernate with jpa specification when my web application try to connect to database it gives the above exception Caused by: java.sql.SQLException: Access denied for user 'sandip'@'localhost' (using password: YES) , sandip is my linux user. data source set is like....... @Bean public DataSource getDataSource() { DriverManagerDataSource ds = new DriverManagerDataSource( env.getProperty("url")); ds.setDriverClassName(env.getProperty("driver")); ds.setUsername(env

Installing Java EE 6 SDK

走远了吗. 提交于 2019-12-08 05:31:46
问题 This is the installation file: Java Platform, Enterprise Edition 6 SDK Update 3 (with JDK 6u27) The error occured during glassfish installation domain is: C:\glassfish3\glassfish\bin\asadmin.bat --user admin --passwordfile - create-domain --savelogin --checkports=false --adminport 4848 --instanceport 8080 --domainproperties=jms.port=7676:domain.jmxPort=8686:orb.listener.port=3700:http.ssl.port=8181:orb.ssl.port=3820:orb.mutualauth.port=3920 domain1 Error: could not open `C:\glassfish3\jdk\jre