Tuesday, 23 April 2013

Google App Engine Simple tutorial

Step 1:

In Eclipse 

Help->install new Application->Work With

Google application  - http://dl.google.com/eclipse/plugin/3.7


Step 2:

Create  Google App Web Project.















Name this Project And select Check box






















Finish


Step 3:

Ctreate Simple JSP Page and Place control on it.

for eg Tax.Jsp

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Tax Project</title>
</head>
<body>
<h1>Tax Calculation</h1>
<center>
<form action="taxcalulation" method="get">
Enter Amount <input type="text" id="amount" name="amount"/>
<input type="submit" value="Tax">
</form>
</center>
</body>
</html>

Step 4:

Create Servlet  And Mapping to web.xml


Step 5:

Write code on Servlet
for eg.


protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
System.out.println("out");
int tax=Integer.parseInt(request.getParameter("amount"));
System.out.println(tax);
int val=0;
if(tax <= 20000)
{
val=0;
}
else
if(tax >= 20000 && tax <= 30000)
{
val=tax/10;
}
else
{
val=tax/30;
}
response.setContentType("text/plain");
response.getWriter().println("Tax Amount="+val);

}


Step 6:

Run the program on  (G)  Web Application 


















Console output Lite this 
















Dev App Server is running.....

Step 7:

Open Browser
And  write into address bar
http://Localhost:8888

Show the home page
















Click Tax Calculation

Open tax.jsp










Enter Amount And Click Tax button

Show the result











Done......



No comments:

Post a Comment