java-ee

Cookie is not set in browser

偶尔善良 提交于 2019-12-13 05:59:41
问题 I have been trying to connect the JAX-RS web service with AngularJS frontend. As you can see at the attached screenshots, the Chrome can read and parse the Set-Cookie value, but dismisses it for unknown reason. JAX-RS snippet: c1 = new NewCookie("session_id", uuid, "/", null, null, COOKIE_MAX_AGE, false); return Response.status(200).cookie(c1).build(); Screenshots: 回答1: Surprisingly, it was caused by the bad request. I did't set the " withCredentials: true" field in my AngularJS $http.post

Scriptlets inserts arbitrary code into servlet's _jspService method

放肆的年华 提交于 2019-12-13 05:58:28
问题 Scriptlets let you insert arbitrary code into servlet's _jspService method. Can anyone explain this statement with an example containing a block of code? I am aware about syntactical stuff of JSP and Servlets, what I need to know is In what context arbitrary code is used? _jspService() is a method of JSP life cycle then, What does it mean by servlet's method ? 回答1: A JSP is in fact transformed by the container into a Java class extending HttpServlet, that class is then compiled and executed

What is the best way to implement multiple logs location using log4j?

大城市里の小女人 提交于 2019-12-13 05:37:32
问题 I have to implement multiple log location using log4j in out project which includes multiple modules, for each module i have to log the in separate location 回答1: Perhaps the log4j.properties on this articles would help you seek what you are looking for. http://ta.cnci.org/more-about-java/35-java-blogs/238-dailyfileappender and may be you could use the DailyFileAppender.java that I wrote a while back. The idea is simple and it is in 4 parts: Set the log4j.rootCategory to include your "FILE DEF

Google App Engine Getting Object by the Key

。_饼干妹妹 提交于 2019-12-13 05:37:15
问题 I am stuck with geting a persisted object by its id. I am getting an error: com.google.appengine.api.datastore.EntityNotFoundException: No entity was found matching the key: CNG("T78") I persist the object as below to the data store: Key cngKey = KeyFactory.createKey("CNG", jsonCNG.cNGID); Entity cngEntity = new Entity("CNG", cngKey); cngEntity.setProperty("cng_name", jsonCNG.cNGName); cngEntity.setProperty("cng_type", jsonCNG.cNGType); cngEntity.setProperty("cng_content", cng); Here cng is a

Storing entities for simultaneous edition in one session in EJB JSF

烈酒焚心 提交于 2019-12-13 05:35:47
问题 We have an ideological problem while creating a Web Application in JSF, EJB and JPA. Our example situation is: Admin displays the list of users in datatable. Next, he selects user1, which leads him to new user-edition site. The issue occure if he tries to open second card or window and select user2 for simultaneous edition in the same session. When we try to save user1 data after edition it is not possible, because it is being overwritten in Endpoint by user2. Data storing: Because we do not

Tommahawk Myfaces and CDI

Deadly 提交于 2019-12-13 05:31:09
问题 I'm having some problems using CDI with Tommahawk Myfaces when trying to create a JSF page to upload a file. Referring to this question it looks as though Tommahawk MyFaces isn't compatible with CDI but is this correct? My Bean is like this: @ManagedBean @RequestScoped public class Bean { private UploadedFile uploadedFile; public void submit() throws IOException { String fileName = FilenameUtils.getName(uploadedFile.getName()); String contentType = uploadedFile.getContentType(); byte[] bytes

using nested_tables in java

▼魔方 西西 提交于 2019-12-13 05:28:30
问题 How do I receive a nested table in java from pl/sql procedure's OUT parameter? Here is my example code. Connection connection = utilities.getConnectionToDb(); CallableStatement callableStatement = connection.prepareCall("{call procedure_name(?,?)}"); callableStatement.setLong(1, 23456); callableStatement.registerOutParameter(2, Types.ARRAY); callableStatement.executeQuery(); But when I try executing it I get the error PLS-00306: wrong number or types of arguments in call to 'procedure_name' I

JBoss and Quartz

时光毁灭记忆、已成空白 提交于 2019-12-13 05:27:43
问题 I'm trying to see if Quartz can solve a problem for me. But I can't get it to work. Right now I'm stuck at the following error (relevant part) Caused by: org.quartz.SchedulerConfigException: Unable to instantiate class load helper class: org.quartz.simpl.CascadingClassLoadHelper cannot be cast to org.quartz.spi.ClassLoadHelper [See nested exception: java.lang.ClassCastException: org.quartz.simpl.CascadingClassLoadHelper cannot be cast to org.quartz.spi.ClassLoadHelper] at org.quartz.impl

How to change the text of a label when a page is reloaded in JSP page?

折月煮酒 提交于 2019-12-13 05:23:33
问题 I am new to servlets. I have a servlet that i update the database in it. After clicking submit button, i want to show a message that tells whether update is succesfull or not. For this i am planning to put a label but label tag has no property like value, visible etc. How can i do that? Here is my code of servlet: protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //System.out.println("editservlet"); try { connect(); int

Is is possible to delete Component HTML Content with JSF

非 Y 不嫁゛ 提交于 2019-12-13 05:19:31
问题 hi i have HTML content like: <div id="j_idt33:summary"> <ul id="j_idt33:summary2" class="summary"> <li style="margin-right: 85%; Color:red;">Some Error Message.</li> </ul> </div> i want when the user click on a button to clear all the contents of that DIV to get output like: <div id="j_idt33:summary"> </div> is it possible to do something like that with JSF ? or achieve that with JavaScript ? what do you suggest guys ? please advise. 回答1: In JavaScript side, you could do something like this: