java-ee

Detecting type of operator stored as string in java [duplicate]

余生长醉 提交于 2019-12-20 07:53:17
问题 This question already has answers here : Is it possible to pass arithmetic operators to a method in java? (8 answers) Closed 3 years ago . In a Java program, I have these strings: a= 8,7,"+" b=1,5,"*" Each line is a separate process. I want in each line, that two number calculated with that operator. But I don't want to use any type of condition system for detecting which operator is in each line. In fact, my main problem is detecting the type of the operator without conditions. I don't want

What does the path get from the server by getRealPath () in jsp

你。 提交于 2019-12-20 07:41:19
问题 I am using struts 1.3,jsp for developing application. I want to know what following code will return path from the server. path = getServlet().getServletContext().getRealPath("/") +"images\\logos\\"+ formFile.getFileName(); What will be the path from the server.Can i use this path for showing image on the page. 回答1: First of all: getRealPath is deprecated. (compare: Interface ServletRequest). You should try this instead (since spec 2.1): ServletContext context = session.getServletContext();

Eclipse plug in to edit web.xml in Java EE?

故事扮演 提交于 2019-12-20 07:13:10
问题 I have a Java EE web page and web.xml descriptor of the project has not a interactive way to add information like servlet-servlet mapping, etc. all it's only manual Any plugin of eclipse to edit this automatic, like netbeans or jdeveloper web.xml descriptor? 回答1: Yes . JBoss Tool is an umbrella project for a set of Eclipse plugins that supports JBoss and related technology such as JSF, (X)HTML, Seam, Hibernate etc. It contains the web.xml editor .See this. 回答2: If you're using Servlets 3.0 in

BufferedReader.readLine() do not read and hang the system(wait) [closed]

牧云@^-^@ 提交于 2019-12-20 07:08:49
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . BufferedReader.readLine() do not read and hang the system(wait) . InputStream istrm = runtimeProcess.getInputStream(); InputStreamReader istrmrdr = new InputStreamReader(istrm); BufferedReader buffrdr = new

Login issue with DatabaseServerLoginModule in JBoss 6

穿精又带淫゛_ 提交于 2019-12-20 07:06:59
问题 I get a ServeletException: Failed to authenticate a principal when I attempt to login with the DatabaseServerLoginModule. I'm guessing the issue is either how passwords are written to the db or the rolesQuery that is incorrect. I certainly can use suggestions on how to troubleshoot at this point. Here is my setup: login-config.xml <application-policy name = "Avengers"> <authentication> <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule" flag = "required"> <module

application managed transactions in J2EE

与世无争的帅哥 提交于 2019-12-20 07:05:30
问题 Does anyone have an example of the best way to begin, commit/rollback a transaction from within a CDI managed bean within a J2EE 6 container.? I have run into a particular case where the annotated approach won't work for me (I'm calling the method from another method in the same class) and I need to set the transaction boundaries manually. I would like to know what I can do in my code that would replicate the behavior of the following annotation: @TransactionAttribute(TransactionAttributeType

How to update page for all users

烂漫一生 提交于 2019-12-20 06:47:06
问题 For example, i have page with comments. I want page update for all users watching that page, every time someone adds comment. I can do it, using ajax update every few minutes. But there mast be a cleverer way, may be some java EE service is using for this purpose? 回答1: Take a look Server Push and Websocket examples, that are the terms to search for. 来源: https://stackoverflow.com/questions/22426637/how-to-update-page-for-all-users

Login with Hibernate and store username logged

守給你的承諾、 提交于 2019-12-20 06:39:53
问题 I'm developing a simple project cloud in which a registered user after login can download and upload files. I'm developing with Eclipse Java EE, JSF and Hibernate. In my project I can sign in to the user and if the data are correct I open the user menu but can not figure out where to store the information about the user logged. It is not clear so the concept of session. I've read several things about Hibernate and the session but I do not understand yet. I need to keep at least the username

Why am I getting Mapping Exception?

你说的曾经没有我的故事 提交于 2019-12-20 06:29:42
问题 I am getting : org.hibernate.MappingException: Foreign key (FKBB979BF4266AA123:address [a_id])) must have same number of columns as the referenced primary key (address [p_id,a_id]) as I try to run the following (though incomplete) snippet : public static void main(String args[]) { Configuration config = new Configuration().configure(); SessionFactory sessFact = config.buildSessionFactory(); Session sess = sessFact.openSession(); Transaction trans = sess.beginTransaction(); } The hibernate

Why doesn't the WebSphere 7 console “_Save_ directly to master configuration” appear when I make a change?

依然范特西╮ 提交于 2019-12-20 06:26:50
问题 I'm using WebSphere 7 (running my web app from within IBM RAD 7). I'm trying to enable application security for my web app. In the console, when I select Security > Global Security > Administrative Security, check "Enable administrative security" and click "Apply" ... there appears a box at the top of the console that says (among other things) " Save directly to the master configuration". I click "Save" and the changes are saved. However, when I select Applications > Application Types >