java-ee

How to ajax jsf 2 outputLink

自古美人都是妖i 提交于 2019-12-30 11:01:05
问题 I want to make a webpage that is working on ajax(everything ajax). I mean.. whenever you click a link(I refer to < h:outputLink ...> ) to change a certain div using data from another link. For example: <h:outputLink value="/page.jsf" onclick="myfunction(this); return false;"> My page </h:outputLink> page.jsf is a normal jsf page... displayed using a page layout.xhtml like: <ui:composition template="/layout.xhtml"> <ui:define name="main"> //my content here </ui:define> </ui:composition> Is

How Tomcat handles multiple requests

拜拜、爱过 提交于 2019-12-30 09:58:14
问题 I am aware of creating web application but there is one basic doubt I have. I am sorry for asking very silly question but want to clear my doubt. How Tomcat Container handle request, I mean to say when I send a request for home.jsp page then I get the response as home.jsp page only and not a register.jsp page which at the same time might be the request given by other person requested from other corner of the world. Eg: Client A --------request(a.jsp)----------> Tomcat (check request received

@Autowired objects getting null value

浪尽此生 提交于 2019-12-30 08:24:33
问题 Trying to set up a project but fail at Autowiring objects through Spring. package se.hsr.web; public class TestRunner { public static void main(String[] args) { ContactDAO cd = new ContactDAOImpl(); Contact contact = new Contact(); contact.setFirstname("Zorro"); cd.addContact(contact); } } package se.hsr.web; Running this gives me a NullPointerException when cd.addContact is invoked. The ContactDaoImpl: import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation

In java EE, which jars should I put in the library dir?

会有一股神秘感。 提交于 2019-12-30 08:13:15
问题 I have a Java EE project. The project is built using maven into an .ear archive. There is a library jar containing a JPA 2 persistence unit, which is located in the library directory of the ear (so multiple other modules can use it). While adding an implementation of Shiro's Permission interface as an entity in this persistence unit, I had trouble getting the ear to deploy correctly, because the shiro classes where unavailable in the persistence unit. I eventually figured out that I needed to

How to use JAX-RS and Angular 2+ to download a zip file

試著忘記壹切 提交于 2019-12-30 07:53:19
问题 How to download a zip file exposed by a JAX-RS resource and serve it to the user with Angular2 final? 回答1: Given a JAX-RS resource as: @Produces({MediaType.APPLICATION_JSON}) @Consumes({MediaType.APPLICATION_JSON}) @Path("/myresource") public class MyResource { @Inject MyFacade myFacade; @POST @Path("/download") @Produces({"application/zip"}) public Response download(@NotNull Request req) { byte[] zipFileContent = myFacade.download(req); return Response .ok(zipFileContent) .type("application

How to intercept custom HTTP header value and store it in Wicket's WebSession?

泄露秘密 提交于 2019-12-30 07:53:10
问题 I need to grab a certain custom HTTP header value from every request and put it in WebSession so that it will be available on any WebPage later on. (I believe the Wicket way to do this is to have a custom class extending WebSession that has appropriate accessors.) My question is, what kind of Filter (or other mechanism) I need to be able to both intercept the header and access the WebSession for storing the value? I tried to do this with a normal Java EE Filter, using CustomSession session =

Newbie at JAAS authentication; Sign in using a token in the URL Bar

和自甴很熟 提交于 2019-12-30 07:12:15
问题 I have an interesting project requirement where we must accept a token as a GET paramenter that will authenticate a user coming into an application. This is to allow trusted third parties to seamlessly send a user over to our site without having to make them log in again. An example might be: http://www.myproj.com/appName/index.jsf?user_token=asdf123randomstuffaf12fsaasdf appName would be the context root, and user_token would be a token that could be checked. The token will be used once,

Path segment sequence to vararg array in JAX-RS / Jersey?

假如想象 提交于 2019-12-30 07:03:12
问题 JAX-RS/Jersey allows URL path elements to be converted to Java method arguments using @PathParam annotations. Is there a way to convert an unknown number of path elements into arguments to a vararg Java method? I. e. /foo/bar/x/y/z should go to method: foo(@PathParam(...) String [] params) { ... } where params[0] is x , params[1] is y and params[2] is z Can I do this in Jersey/JAX-RS or some convenient way? 回答1: Not sure if this is exactly what you were looking for but you could do something

Hibernate save object (one to many relationship) foreign key is null

梦想的初衷 提交于 2019-12-30 06:45:30
问题 I have one to many relationships between person class and car class. A person can own many cars and vice versa. I am using restful API to post data. My annotations and Get service is working fine but my post service throws " java.sql.SQLIntegrityConstraintViolationException: ORA-01400: cannot insert NULL" error whenever I try to insert new data. Child table foreign key is being inserted as null . Here is part of my code. Person.java private List<Car> cars = new ArrayList<Car>(); @OneToMany

Can't use spring-modules-validation with spring 3

狂风中的少年 提交于 2019-12-30 06:19:08
问题 i have following pom file: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <!-- Maven Coordinates(groupId,artifactId,version):define a unique location for a project CONSIDERING that groupId and artifactId combination must be unique.--> <!-- A groupId groups a set of