Tag Archives: text

XMLHttpRequest status 0 (responseText is empty)

Questions: Cannot get data with XMLHttpRequest (status 0 and responseText is empty): xmlhttp=new XMLHttpRequest(); xmlhttp.open(“GET”,”http://www.w3schools.com/XML/cd_catalog.xml”, true); xmlhttp.onreadystatechange=function() { if(xmlhttp.readyState==4) alert(“status ” + xmlhttp.status); } xmlhttp.send(); It alerts “status 0”. The same situation with the localhost request (cd_catalog.xml is saved as a local file) xmlhttp.open(“GET”,”http://localhost/cd_catalog.xml”, true); But with the localhost IP request xmlhttp.open(“GET”,”http://127.0.0.1/cd_catalog.xml”, true); and with… Read More »

Changing Tomcat context path of web project in Eclipse

Questions: I’m using Tomcat 6 and using the Servers functionality in Eclipse to manage it. I have a project named foobar and I’d like to change the context path so that the URLs referenced are http://localhost:8080/app instead of http://localhost:8080/foobar. I’ve tried everything that I can think of: Updated the server.xml path value in the Context… Read More »

Where to put a textfile I want to use in eclipse?

Questions: I need to read a text file when I start my program. I’m using eclipse and started a new java project. In my project folder I got the “src” folder and the standard “JRE System Library” + staedteliste.txt… I just don’t know where to put the text file. I literally tried every folder I… Read More »

Understanding contexts in Spring MVC

Questions: I am new to spring and I am creating a simple web application. I have been reading about contexts in Spring MVC. I am using STS plugin for eclipse. I created a Spring MVC project using the plugin. Now I have three xml documents in the project, web.xml, root-context.xml and servlet-context.xml. These were created… Read More »

How to bridge Spring Application Context events to an other context

Questions: I have a Spring web application with two contexts: one (applicationContext) built by ContextLoaderListener and a second (webContext) built by DispatcherServlet. Within the applicationContext is a bean (org.springframework.security.authentication.DefaultAuthenticationEventPublisher) that fires spring context events. But the receiver for the event is defined in the webContext. And that receiver did not get the event. (If put… Read More »

Spring ApplicationContext Bean Scope

Questions: When you create a Service bean or Dao bean in your Spring applicationContext.xml file, what is the scope of those beans? Will every person who accesses the web application use the same instance of the bean, or is the bean instantiated for each user’s session? Answers: By default a bean created in Spring is… Read More »

How exactly are the root context and the dispatcher servlet context into a Spring MVC web application?

Questions: I am studying Spring MVC and I have some doubt related So, I have this configuration class that configure my DispatcherServlet that handle the user requests: public class MyWebAppInitializer implements WebApplicationInitializer { @Override public void onStartup(ServletContext container) { // Create the ‘root’ Spring application context AnnotationConfigWebApplicationContext rootContext = … // Create the dispatcher servlet’s… Read More »