I use JavaFX 2.1 and I created GUI using FXML, in the controller of this GUI I added myTextField.requestFocus();. But I always get the focus in the other control. Answer At the time of initialize() controls are not yet ready to handle focus. You can try next trick: For tricky complex applications (like Pavel_…
Switch tabs using Selenium WebDriver with Java
Using Selenium WebDriver with Java. I am trying to automate a functionality where I have to open a new tab do some operations there and come back to previous tab (Parent). I used switch handle but it’s not working. And one strange thing the two tabs are having same window handle due to which I am not ab…
jax ws getting client ip
I’m trying to retrieve the client IP with JAX-WS, I used: I get a NullPointerException in req, mc is not null. My question is which JAR to use for HttpServletRequest because I’m using a Java stand-alone application? Thanks Answer How to get the webservice client address for a jax-ws service depend…
Write and Read Cookies in different Applications
I have two applications running in Jboss, can I write a cookie in a application and read in another? For example, if I have two Servlets: – WriterCookieServlet on localhost:8080/Application1 – ReaderCookieServlet on localhost:8080/Application2 WriterCookieServlet: Then on ReaderCookieServlet I wan…
Is PriorityQueue a FIFO Queue?
PriorityQueue implements Queue, but is PriorityQueue a FIFO data structure like Queue? Answer From the Queue interface: Queues typically, but do not necessarily, order elements in a FIFO (first-in-first-out) manner. Among the exceptions are priority queues, which order elements according to a supplied compara…
How to remove extra empty lines from XML file?
In short; i have many empty lines generated in an XML file, and i am looking for a way to remove them as a way of leaning the file. How can i do that ? For detailed explanation; I currently have this XML file : And i use this Java code to delete all tags, and add new ones instead
Permutations with duplicates
Before I start, I have to apologize for bringing up another case of permutations with duplicates. I have gone through most of the search results and can’t really find what I am looking for. I have read about the Lexicographical order and have implemented it. For this question, I am suppose to implement …
Java: “Local variable may not have been initialized” not intelligent enough?
Consider the following method: On x++ I get the “Local variable may not have been initialized” error. Clearly x will never be used uninitialized. Is there any way to suppress the warning except by initializing x? Thanks. Answer No, there is no way Java can examine all possible code paths for a pro…
How Can I View Glassfish Logs on Intellij Idea
I am working on making the switch from Netbeans to Intellij Idea. One thing I miss from Netbeans is the ability to view the Glassfish server logs in real-time in the IDE. It seems like with Idea I need to go out to the file system and tail them. Is there another way that I am missing? Answer Additional server
How to generate WSDD based on code or based on WSDL
I have access to remote sever that provides me wsdl back to my response. I prepared Client for this, based on that wsdl. Now I woud like to write a fake Server (for testing needs), what I should start first? Which steps I should implement? The test makes sense only if it is implemented by this WSDL. Is it pos…