java-ee

Create Hello World with RESTful web service and Jersey

独自空忆成欢 提交于 2019-12-13 03:24:11
问题 I follow tutorial here on how to create web service using RESTful web service and Jersey and I get kind of stuck. The code is from HelloWorld3 in the tutorial I linked above. Here is the code. I use Netbean6.8 + glassfish v3 RESTGreeting.java create using JAXB . This class represents the HTML message in Java package com.sun.rest; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlElement; @XmlRootElement(name = "restgreeting") public class RESTGreeting {

get request parameter from a for each loop

风格不统一 提交于 2019-12-13 03:06:56
问题 I have a JSP with a table like this <table border="1"> <tr> <th>Step</th> <th>Date</th> </tr> <c:forEach var="myVar" items="${sessionScope.myBean.myList}" varStatus="status"> <tr> <td><input type="text" name="index" value="${status.count}" disabled></td> <td><input type="text" name="date" value="${myVar.date}"></td> </tr> </c:forEach> </table> This table is inside a form, with a submit input tag. Let's say myList (list attribute in the bean myBean) contains 2 elements, my table correctly

Spring-batch MultiResourceItemReader vs commit-interval

和自甴很熟 提交于 2019-12-13 03:06:47
问题 I am using spring-batch MultiResourceItemReader to read a directory of XMLs and delegating it to StaxEventItemReader. The commit-interval on the chunk acts on MultiResourceItemReader i.e. the commit happens for each XML. I want to make the commit-interval act on StaxEventItemReader so that I can commit my huge XML data in chunks instead of one XML at a time. Any help? 来源: https://stackoverflow.com/questions/29129056/spring-batch-multiresourceitemreader-vs-commit-interval

How to declare a Generics Action in struts2.xml file?

南楼画角 提交于 2019-12-13 03:03:56
问题 My problems is in a Struts2 action, where I have a class : public class MyAction<T> extends ActionSupport with a private member like this : private T myData; And I would like to declare this aciton in the struts.xml file, how can i manage to do so ? Thanks for the answer. Ps : I've tried without declaration of T, but it did not work 回答1: For example, you cannot obvioulsy write (in struts-XX.xml) <action name="doSomething" class="xx.xx.MyAction<java.util.Date>"> But you can easily code a class

MyBatis: java.sql.SQLException: Invalid java.sql.Types constant value -9 passed to set or update method

℡╲_俬逩灬. 提交于 2019-12-13 03:02:58
问题 Im getting this error when calling a Stored_Procedure in SqlServer from MyBatis: > ### Error querying database. Cause: java.sql.SQLException: Invalid java.sql.Types constant value -9 passed to set or update method. > ### The error may exist in mybatis-mapper/UpstreamMapper.xml > ### The error may involve callStoredProcedure > ### The error occurred while executing a query > ### SQL: {call dbo.get_discount_value(?,?, ?,?,?,?)} > ### Cause: java.sql.SQLException: Invalid java.sql.Types constant

Is it a bad design for a EJB to depend on FacesContext?

你离开我真会死。 提交于 2019-12-13 02:58:46
问题 Would it be better, for example, to pass context.getExternalContext().getRequestLocale() to the EJB by parameter, instead of using an import and getCurrentInstance from inside the EJB? import javax.faces.context.FacesContext; FacesContext.getCurrentInstance() (I'm new to web development) 回答1: If you think of your software system as a three layer architecture then the FacesContext (which is part of the JSF framework) belongs to the presentation layer and the EJB to the application layer. In

Can you use bean validation 1.1 (JSR 349) in JBoss EAP 6.4.4?

匆匆过客 提交于 2019-12-13 02:39:58
问题 We are using bean validation in JBoss EAP 6.4.4 (resteasy & hibernate-validator 4) to validate REST payload data. As it seems JBoss 6.4.4 uses bean validation 1.0 which doesn't support method validation. So, requests are not being blocked by bean validation and reach the db. Is there any jboss deployment file or something similar where I can enable version 1.1? I cannot change the bundled libs because we'll lose jboss support for the AS. JBoss 7 seems to work out of the box, but it's still in

org.apache.xerces.impl.dv.DVFactoryException: DTD factory class org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl does not extend from DTDDVFactory [duplicate]

白昼怎懂夜的黑 提交于 2019-12-13 02:36:16
问题 This question already has answers here : Xerces error: org.apache.xerces.impl.dv.dtd.DTDDVFactoryImpl (2 answers) Closed 2 years ago . I'm creating a JSF application in NetBeans7.1 using GlassFish3.1.1, when I make changes to a managed bean or any other .java file and try to redeploy the web app to GlassFish using NetBeans I get the exception posted below. I have tried clearing the NetBeans cache and have also tried downloading various versions of NetBeans and GlassFish and have gotten the

Remote EJB return type

吃可爱长大的小学妹 提交于 2019-12-13 02:35:53
问题 I want to return an instance of a class I created, named User. Where should I put this class, so that my EJB can return it when I call a method? I mean, should I put it only in the interface project, or in the ejb module and in the war module? Thanks 回答1: You should have a copy of your custom object in both EJB folder, and in your war project, if you want to use concrete implementation. Nevertheless, you might have an interface in your .war, which EJB module method returns, and EJB nethod

How to implement a custom ViewProcessor<T> (jax-rs)?

馋奶兔 提交于 2019-12-13 02:35:30
问题 Looking at the article here, there is an example of how to use a TemplateProcessor to resolve JSP views using Jersey. Apparently this class has been deprecated now and replaced by ViewProcessor<T>. I am somewhat confused about how to implement either (preferably the newer one since it isn't deprecated); what goes in as the template argument? How can I implement one to simply resolve jsps in /WebContent/WEB-INF/views/* and also evaluate the expression language of the returned view? The other