java-ee

Entity was referenced but not declared

让人想犯罪 __ 提交于 2019-12-17 20:58:01
问题 In my xml file of Spring MVC application for using tiles, I have written the following - <definition name="dashboard" extends="base.definition"> <put-attribute name="title" value="Dashboard - CMS ♦ ® Galactic NetOne" /> <put-attribute name="body" value="/WEB-INF/views/dashboard.jsp" /> </definition> However, ♦ and ® give the error that they are referenced but not declared. Please help. 回答1: You either need to declare those entities, or replace them with a hex or decimal equivalent. I'm

eclipse vs tomcat deployment - exported war (partially) fails while the project runs in eclipse

守給你的承諾、 提交于 2019-12-17 20:57:08
问题 I have a webapp in eclipse juno - when I hit Run on server runs fine - either inside eclipse's browser (I am on windows) or in FF. Right click > export war > dump this into $CATALINA_HOME/webapps > all is working fine (got unpacked alright) EXCEPT my custom tags - I had a WEB-INF\functions.tld file which is apparently not read. The only difference between the auto-generated eclipse server.xml (in Servers project) and the default Tomcat server.xml was the line : <Context docBase="ted2012" path

Start & Stop a ScheduledExecutorService in Java EE environment using servlet

主宰稳场 提交于 2019-12-17 20:51:05
问题 We have a requirement where in we need to monitor remote JVM details via JMX using a simple servlet application. So things done till now in a standalone application is 1) Creat a JMX connector & get the Memory data --> done 2) We need to constantly monitor & get the records (2.1 > which can be considered as scheduled task at constant delay & insert the records into DB Or 2.2> does the JMX gives the history if yes which MBean to access for the info?). Here I am planning to use an interface to

how to get client ip address?

牧云@^-^@ 提交于 2019-12-17 20:28:07
问题 I want to know that how can we know the IP address of client on server side in socket (java). Suppose there is a server "S" and 2 clients "A" and "B". Client A send me(server) some info, and Client B send me(server) some other info. I have to store that info coming from A and B in database in different tables. How can I Differentiate between client A and B request.? 回答1: Each socket has a getInetAddress() method which returns the IP address of the client connected to it. 回答2: The other answer

Is Struts2-Full-Hibernate plugin the standard way to integrate Struts2 and Hibernate? [closed]

百般思念 提交于 2019-12-17 19:57:51
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . I'm starting a project, willing to use Struts2 and Hibernate. Should I use the struts2-full-hibernate plugin , or integrate them differently ? Searching on Internet confused me: is it the standard way to integrate them ? If not, which is the standard way ? 回答1: In a nutshell:

Struts2 Action execution and response through AJAX

不问归期 提交于 2019-12-17 19:56:41
问题 I am trying to send an AJAX post request via jQuery to a Struts2 action class for processing a form and receiving JSON response, but I haven't figured out how to do it. First, I made the form and set up Struts for this form to work without JavaScript (trying to do progressive enhancement), and now I am trying to get it to work through jQuery. I could easily just create a new servlet that would call the validate and execute methods of the action class and print the response there, but I first

JSF View Scoped Bean Reconstructed Multiple Times [duplicate]

巧了我就是萌 提交于 2019-12-17 19:54:45
问题 This question already has an answer here : @ViewScoped calls @PostConstruct on every postback request (1 answer) Closed 3 years ago . I thought @ViewScoped was supposed to prevent the bean from being reconstructed while the user is on the same page... So why is my @ViewScoped JSf controller bean being created multiple times even before the action handler causes the browser to navigate away from that view? Can anyone point me in the right direction here? Here is my code: The View (domain/edit

Global Java Servlet Filter, is it possible?

人走茶凉 提交于 2019-12-17 19:38:55
问题 I'm writing a project for academic purposes which among other irrelevant stuff, includes writing a filter which monitors servlet/jsp response times. The thing is that the filter should work on every deployed web application in the server and not only over a specific one, I just couldn't find any information regarding applying "global" filters. Is it even possible? NOTE: It's important to mention that i'm using Apache Tomcat 7 as the server of choice. Thanks! Mikey 回答1: You could provide the

Java servlet read a file and send it as response

谁说胖子不能爱 提交于 2019-12-17 19:05:29
问题 I'm trying to write a servlet which will read (download) file from a remote location and simply send it as response, acting more-or-less like a proxy to hide the actual file from getting downloaded. I'm from a PHP background where I can do it as simply as calling file_get_contents. Any handy way to achieve this goal using servlet/jsp? Thanks 回答1: How about this one? FileUtils (Commons IO 2.5-SNAPSHOT API) example /src_directory_path/ is mount directory of remote server. @Override protected

Elegantly handling constraint violations in EJB/JPA environment?

浪尽此生 提交于 2019-12-17 18:28:51
问题 I'm working with EJB and JPA on a Glassfish v3 app server. I have an Entity class where I'm forcing one of the fields to be unique with a @Column annotation. @Entity public class MyEntity implements Serializable { private String uniqueName; public MyEntity() { } @Column(unique = true, nullable = false) public String getUniqueName() { return uniqueName; } public void setUniqueName(String uniqueName) { this.uniqueName = uniqueName; } } When I try to persist an object with this field set to a