java-ee

How to share session between php app and Java EE app?

北城以北 提交于 2019-12-18 05:24:08
问题 We may replace a PHP app with a Java EE app, but the problem is we wanna replace the modules one by one, which means two apps would co-exist and communicate with each other. So is it possible to share the user session between the 2 apps? Or use a cookie to solve the problem? 回答1: Save your session data to a database with session_set_save_handler(). UPDATE Efficiency wise it would be very mininal, the difference from reading a text file to querying a database (presumably using an existing

How can I initialize a Java FacesServlet

别等时光非礼了梦想. 提交于 2019-12-18 05:17:09
问题 I need to run some code when the FacesServlet starts, but as FacesServlet is declared final I can not extend it and overwrite the init() method. In particular, I want to write some data to the database during development and testing, after hibernate has dropped and created the datamodel. Is there a way to configure Faces to run some method, e.g. in faces-config.xml? Or is it best to create a singleton bean that does the initialization? 回答1: Use an eagerly initialized application scoped

How can I initialize a Java FacesServlet

大城市里の小女人 提交于 2019-12-18 05:17:09
问题 I need to run some code when the FacesServlet starts, but as FacesServlet is declared final I can not extend it and overwrite the init() method. In particular, I want to write some data to the database during development and testing, after hibernate has dropped and created the datamodel. Is there a way to configure Faces to run some method, e.g. in faces-config.xml? Or is it best to create a singleton bean that does the initialization? 回答1: Use an eagerly initialized application scoped

Explanation of Tenant Load Balancer in SaaS maturity model level 4

一笑奈何 提交于 2019-12-18 05:12:29
问题 I've already done some research about SaaS maturity level based on Gianpaolo SaaS maturity model. Right now I got confused about SaaS maturity level 4. It said, it has a "Tenant load balancer" that dynamically calls a new application instance to serve load balancing for a SaaS application. I want to know what this "Tenant load balancer" really means. How do we implement this "Tenant load balancer" in the real world or in an application server? Can anyone give me some good explanation and an

PDF generation using iText in Struts-2 : result type stream not working

☆樱花仙子☆ 提交于 2019-12-18 05:08:07
问题 My requirement is to generate PDF file using iText, I use below code to create a sample PDF Document document = new Document(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfWriter.getInstance(document, baos); document.open(); document.add(new Paragraph("success PDF FROM STRUTS")); document.close(); ServletOutputStream outputStream = response.getOutputStream() ; baos.writeTo(outputStream); response.setHeader("Content-Disposition", "attachment; filename=\"stuReport.pdf\"");

How to make a filter to detect if the user requested a page that is not found?

让人想犯罪 __ 提交于 2019-12-18 05:05:16
问题 I want to create a filter in my app such that before each request, it detects whether the requested page exists. If it doesn't exist, it will forward the user to an error page. How do I detect that the page exists? I need a solution with a filter and not using the web.xml tag method. 回答1: If you don't have authentication, you can. Make a Filter Use HttpServletResponseWrapper and override the sendError() and setStatus() Pass the wrapped response through chain.doFilter(req, wrapper) If you get

JSF tags not rendering - FacesServlet not working maybe?

假装没事ソ 提交于 2019-12-18 05:00:49
问题 I am just getting started with JSF 2.0 and I'm stuck on a problem at the very beginning. JSF tags are not parsed. Below are some details. Hope someone can help because none of the related SO questions have been able to solve my problem. hello.jsp <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui"> <h:head> </h:head> <h:body> <f:view> asd <h:inputText value="asd" label="UserName"></h

jsf (richfaces) readonly input text validation [duplicate]

我怕爱的太早我们不能终老 提交于 2019-12-18 04:54:14
问题 This question already has answers here : Force JSF to process, validate and update readonly/disabled input components anyway (3 answers) Closed 4 years ago . Is there any way I can validate a jsf input text that is readonly but the value is changed upon some other events triggered? 回答1: Set the readonly attribute to true only during render response phase. This way it won't be seen as readonly in all other phases than the render response phase. <h:inputText ... readonly="#{facesContext

Using reserved JPQL keywords with JPA

Deadly 提交于 2019-12-18 04:53:20
问题 I have an entity class called "Group" and NetBeans warns me "The entity table name is a reserved Java Persistence QL keyword". A similar case would be the use of reserved SQL keywords. Will this name be escaped? Would the use of a different table name solve the problem @Table(name="otherName"). Or should I rename the class? 回答1: Will this name be escaped? There is nothing in the JPA spec that says so, if your provider does, this is provider specific. Would the use of a different table name

Could not calculate build plan :artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3 is not available in the local repository

谁说我不能喝 提交于 2019-12-18 04:47:09
问题 I have a spring maven 2 project. I built it in terminal and everything is ok, I got build success, but when trying to import it to eclipse I got this error: Could not calculate build plan: The repository system is offline but the artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3 is not available in the local repository. although I am getting build success in terminal and projects run fine. I made maven offline in eclipse, and disabled download index on startup any ideas why I