Skip to content

Commit

Permalink
commits for ajax example
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitanya414 committed Apr 12, 2015
1 parent 62f010c commit 276d528
Show file tree
Hide file tree
Showing 18 changed files with 256 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ajaxapp1/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="lib" path="servlet-api.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
36 changes: 36 additions & 0 deletions ajaxapp1/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ajaxapp1</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
12 changes: 12 additions & 0 deletions ajaxapp1/.settings/.jsdtscope
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="WebContent"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>
7 changes: 7 additions & 0 deletions ajaxapp1/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
9 changes: 9 additions & 0 deletions ajaxapp1/.settings/org.eclipse.wst.common.component
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="ajaxapp1">
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
<wb-resource deploy-path="/" source-path="/ajaxapp"/>
<property name="java-output-path" value="/ajaxapp1/build/classes"/>
<property name="context-root" value="ajaxapp1"/>
</wb-module>
</project-modules>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="java"/>
<fixed facet="wst.jsdt.web"/>
<fixed facet="jst.web"/>
<installed facet="java" version="1.6"/>
<installed facet="jst.web" version="3.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
1 change: 1 addition & 0 deletions ajaxapp1/.settings/org.eclipse.wst.jsdt.ui.superType.name
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Window
3 changes: 3 additions & 0 deletions ajaxapp1/ajaxapp/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

19 changes: 19 additions & 0 deletions ajaxapp1/ajaxapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:web="http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<servlet>
<servlet-name>fs</servlet-name>
<servlet-class>org.errichen.FirstServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>ajax</servlet-name>
<servlet-class>org.errichen.AjaxServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ajax</servlet-name>
<url-pattern>/ajax</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>fs</servlet-name>
<url-pattern>/fs</url-pattern>
</servlet-mapping>
</web-app>
32 changes: 32 additions & 0 deletions ajaxapp1/ajaxapp/one.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<html>
<head>
<script>
function callAjax(){
alert('we are in test ajax');
var url='http://localhost:8500/ajaxapp/ajax?fone=ajax';
var result;
if (window.XMLHttpRequest)
{
a=new XMLHttpRequest();
}
else
{
a=new ActiveXObject("Microsoft.XMLHTTP");
}
a.onreadystatechange=function(){
if (a.readyState==4){
result=a.responseText;
}
};
a.open("POST",url,false);
a.send();
alert(result);
}
</script>
</head>
<body>
<form name="ajaxapp" action="/ajaxapp/fs">
Give i/p here :<input type="text" name="fone"/>
<input type="submit" value="clickme" onclick="callAjax()"/>
</body>
</html>
Binary file not shown.
Binary file not shown.
32 changes: 32 additions & 0 deletions ajaxapp1/build/classes/org/errichen/one.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<html>
<head>
<script>
function callAjax(){
alert('we are in test ajax');
var url='http://localhost:8500/ajaxapp/ajax?fone=ajax';
var result;
if (window.XMLHttpRequest)
{
a=new XMLHttpRequest();
}
else
{
a=new ActiveXObject("Microsoft.XMLHTTP");
}
a.onreadystatechange=function(){
if (a.readyState==4){
result=a.responseText;
}
};
a.open("POST",url,false);
a.send();
alert(result);
}
</script>
</head>
<body>
<form name="ajaxapp" action="/ajaxapp/fs">
Give i/p here :<input type="text" name="fone"/>
<input type="submit" value="clickme" onclick="callAjax()"/>
</body>
</html>
Binary file added ajaxapp1/servlet-api.jar
Binary file not shown.
29 changes: 29 additions & 0 deletions ajaxapp1/src/org/errichen/AjaxServlet.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package org.errichen;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class AjaxServlet extends HttpServlet {

public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
System.out.println("we are in service method of ajax servlet");
System.out.println(request.getParameter("fone"));
PrintWriter out=null;
try{
out=response.getWriter();
out.println("true");
}catch(Exception exp){
exp.printStackTrace();
}finally{

}
}

}
21 changes: 21 additions & 0 deletions ajaxapp1/src/org/errichen/FirstServlet.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.errichen;

import java.io.PrintWriter;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class FirstServlet extends HttpServlet {
public void service(HttpServletRequest request,HttpServletResponse response){
System.out.println("we are in first servlet request object");
PrintWriter out=null;
try{
out=response.getWriter();
out.println("we are in first servlet");
}catch(Exception exp){
exp.printStackTrace();
}finally{
}
}
}
32 changes: 32 additions & 0 deletions ajaxapp1/src/org/errichen/one.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<html>
<head>
<script>
function callAjax(){
alert('we are in test ajax');
var url='http://localhost:8500/ajaxapp/ajax?fone=ajax';
var result;
if (window.XMLHttpRequest)
{
a=new XMLHttpRequest();
}
else
{
a=new ActiveXObject("Microsoft.XMLHTTP");
}
a.onreadystatechange=function(){
if (a.readyState==4){
result=a.responseText;
}
};
a.open("POST",url,false);
a.send();
alert(result);
}
</script>
</head>
<body>
<form name="ajaxapp" action="/ajaxapp/fs">
Give i/p here :<input type="text" name="fone"/>
<input type="submit" value="clickme" onclick="callAjax()"/>
</body>
</html>

0 comments on commit 276d528

Please sign in to comment.