java-ee

Get Parameter Encoding

馋奶兔 提交于 2020-01-09 03:20:16
问题 I have a problem using spring mvc and special chars in a GET request. Consider the following method: @RequestMapping("/update") public Object testMethod(@RequestParam String name) throws IOException { } to which I send a GET request with name containing an "ä" (german umlaut), for instance. It results in spring receiving "ä" because the browser maps "ä" to %C3%A4 . So, how can I get the correct encoded string my controller? Thanks for your help! 回答1: What about this? Could it help? In your

Creating a java program that given 3 terms as input(a,b,c) in that order prints their roots

女生的网名这么多〃 提交于 2020-01-07 23:59:12
问题 Wrie a method printRoots that given 3 terms as input(a,b,c) in that order prints their roots We have the following given information If b²-4ac is a positive number , your program should print “The two roots are X and Y” where X is the larger root and Y is the smaller root If b²-4ac * equals 0 * , the program should print. “The equation has one X” where X is the only root If b²-4ac is a negative number , the program should print.” The equation has two roots(-X1 + Y1i) and (-X2 and Y2i) The

how to save pdf reports automatically in database?

天涯浪子 提交于 2020-01-07 09:21:25
问题 My programming language is java. My application is a web based application. I am using BIRT for generating pdf reports but the requirement is to automatically save them to the database after viewing the pdf report. In BIRT the pdf document is generated on the fly from the rpt templates. When user clicks on a URL the pdf document is displayed by the BIRT viewer application. The requirement is once the pdf is generated i need to save a copy of the pdf file in the MySql database. This should

JMS message to remote server

眉间皱痕 提交于 2020-01-07 08:18:58
问题 I need to send a message to a remote server's queue (running "JBoss MQ") so that it can process the message and act on it. Properties properties = new Properties(); properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); properties.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces"); properties.put(Context.PROVIDER_URL, "jnp://192.168.1.131.129:1299"); InitialContext jndiContext = new InitialContext(properties); //[2] Look up connection factory and queue.

CSRFGuard - request token does not match page token & How can generate token per session

情到浓时终转凉″ 提交于 2020-01-07 06:48:20
问题 I am trying to incorporate the CSRFGuard library(< org.owasp csrfguard 3.1.0 >) in order to rectify some CSRF vulnerabilities in an application. However after configuring as specified here I am now getting the below message: Here I would like to explain scenario when I am getting this message - For suppose my application landing page like this And code snippet for this page(HelloWorld.jsp) is <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@

Throwing an application exception causes TransactionalException

萝らか妹 提交于 2020-01-07 05:46:11
问题 I am implementing an JEE7 web application. During my work i have found a problem with handling my custom exceptions. I edited my account's property to have a non-unique login field. Then i invoked the AccountEditBean#editAccount() to run the editing process. When the process comes to AccountFacade#edit() i can see (in debug) that PersistenceException is caught and my custom NonUniqueException is thrown. The problem is, the exception is not propagated out of the facade class and it is not

selectOneMenu Converter [duplicate]

时间秒杀一切 提交于 2020-01-07 05:44:09
问题 This question already has answers here : Validation Error: Value is not valid (3 answers) Closed 4 years ago . Hi every body I'm working on Primfaces pages and I have to make a selectOneMenu wich get items from dataBase so I tried to make it this way but I still have problem's with the converter so my source Codes are the folowing : selectOneMenu : <p:selectOneMenu id="devises" required="true" value="#{pret.devise}" effect="fade" converter="devise"> <f:selectItem itemLabel="Select One"

Entitymanager throwing NullPointerException

拟墨画扇 提交于 2020-01-07 04:55:09
问题 Am developing a JavaEE application using Netbeans.The Entity Manager is getting a null value in the application. The em is not getting injected. Still am getting a nullPointerException as em is getting a null value in createNamedQuery. Could anyone please let me know what am I missing. JSP page- index.jsp: <%@page import="managed.userBean" %> <jsp:useBean id="bean" class="managed.userBean" scope="session" /> ..... <input type="submit" value="Submit" onclick="<jsp:scriptlet> bean.validate();<

Get if a user is in a specific alfresco site

随声附和 提交于 2020-01-07 03:01:45
问题 I am working in a JavaEE project and i want simply see if a user is a member of an private Alfresco site using CMIS. I need to see if the user is a member of this (private,public) Site and his current situation in this site. 回答1: You cannot easily do this with CMIS alone. But you can use the SiteService because it has an isMember method. This would only work if your code is running in the same process as Alfresco (like in an action, behavior, or web script). If you are running code in a

In JPA which type of parameter is better to use “positional/named”?

混江龙づ霸主 提交于 2020-01-07 02:56:12
问题 With Hibernate as provider. In terms of performance (or others), which type of parameter is better to use? and why? Positional TypedQuery<Client> query = em.createQuery ("FROM Client c WHERE c.clientId = ?1",Client.class); query.setParameter(1, clientId); or Named TypedQuery<Client> query = em.createQuery ("FROM Client c WHERE c.clientId = :clientId",Client.class); query.setParameter("clientId", clientId); 回答1: You should not be really considering performance in this case, named parameters