File tree Expand file tree Collapse file tree 5 files changed +252
-0
lines changed
Expand file tree Collapse file tree 5 files changed +252
-0
lines changed Original file line number Diff line number Diff line change 1+ # Created by https://www.gitignore.io/api/java,macos,eclipse,java-web
2+
3+ # ## Eclipse ###
4+
5+ .metadata
6+ bin /
7+ tmp /
8+ * .tmp
9+ * .bak
10+ * .swp
11+ * ~.nib
12+ local.properties
13+ .settings /
14+ .loadpath
15+ .recommenders
16+
17+ # External tool builders
18+ .externalToolBuilders /
19+
20+ # Locally stored "Eclipse launch configurations"
21+ * .launch
22+
23+ # PyDev specific (Python IDE for Eclipse)
24+ * .pydevproject
25+
26+ # CDT-specific (C/C++ Development Tooling)
27+ .cproject
28+
29+ # Java annotation processor (APT)
30+ .factorypath
31+
32+ # PDT-specific (PHP Development Tools)
33+ .buildpath
34+
35+ # sbteclipse plugin
36+ .target
37+
38+ # Tern plugin
39+ .tern-project
40+
41+ # TeXlipse plugin
42+ .texlipse
43+
44+ # STS (Spring Tool Suite)
45+ .springBeans
46+
47+ # Code Recommenders
48+ .recommenders /
49+
50+ # Scala IDE specific (Scala & Java development for Eclipse)
51+ .cache-main
52+ .scala_dependencies
53+ .worksheet
54+
55+ # ## Eclipse Patch ###
56+ # Eclipse Core
57+ .project
58+
59+ # JDT-specific (Eclipse Java Development Tools)
60+ .classpath
61+
62+ # ## Java ###
63+ # Compiled class file
64+ * .class
65+
66+ # Log file
67+ * .log
68+
69+ # BlueJ files
70+ * .ctxt
71+
72+ # Mobile Tools for Java (J2ME)
73+ .mtj.tmp /
74+
75+ # Package Files #
76+ * .jar
77+ * .war
78+ * .ear
79+ * .zip
80+ * .tar.gz
81+ * .rar
82+
83+ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
84+ hs_err_pid *
85+
86+ # ## Java-Web ###
87+ # # ignoring target file
88+ target /
89+
90+ # ## macOS ###
91+ * .DS_Store
92+ .AppleDouble
93+ .LSOverride
94+
95+ # Icon must end with two \r
96+ Icon
97+
98+ # Thumbnails
99+ ._ *
100+
101+ # Files that might appear in the root of a volume
102+ .DocumentRevisions-V100
103+ .fseventsd
104+ .Spotlight-V100
105+ .TemporaryItems
106+ .Trashes
107+ .VolumeIcon.icns
108+ .com.apple.timemachine.donotpresent
109+
110+ # Directories potentially created on remote AFP share
111+ .AppleDB
112+ .AppleDesktop
113+ Network Trash Folder
114+ Temporary Items
115+ .apdisk
116+
Original file line number Diff line number Diff line change 1+ <project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
2+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" >
3+ <modelVersion >4.0.0</modelVersion >
4+ <groupId >com.web.cal</groupId >
5+ <artifactId >WebAppCal</artifactId >
6+ <packaging >war</packaging >
7+ <version >0.0.6</version >
8+ <name >WebAppCal Maven Webapp</name >
9+ <url >http://maven.apache.org</url >
10+ <dependencies >
11+ <dependency >
12+ <groupId >junit</groupId >
13+ <artifactId >junit</artifactId >
14+ <version >4.8.2</version >
15+ <scope >test</scope >
16+ </dependency >
17+ <!-- https://mvnrepository.com/artifact/javax.servlet/servlet-api -->
18+ <dependency >
19+ <groupId >javax.servlet</groupId >
20+ <artifactId >servlet-api</artifactId >
21+ <version >2.5</version >
22+ </dependency >
23+ </dependencies >
24+ <distributionManagement >
25+ <repository >
26+ <id >releases</id >
27+ <url >http://52.204.135.48:8081/nexus/content/repositories/releases</url >
28+ </repository >
29+ </distributionManagement >
30+ </project >
Original file line number Diff line number Diff line change 1+ package mypackage ;
2+
3+ import java .io .*;
4+ import javax .servlet .*;
5+ import javax .servlet .http .*;
6+
7+ public class Calculator extends HttpServlet
8+ {
9+ public long addFucn (long first , long second ){
10+
11+ return first +second ;
12+ }
13+
14+ public long subFucn (long first , long second ){
15+
16+ return second -first ;
17+ }
18+
19+ public long mulFucn (long first , long second ){
20+
21+ return first *second ;
22+ }
23+
24+
25+ public void doGet (HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException
26+ {
27+ try
28+ {
29+ response .setContentType ("text/html" );
30+ PrintWriter out = response .getWriter ();
31+ int a1 = Integer .parseInt (request .getParameter ("n1" ));
32+ int a2 = Integer .parseInt (request .getParameter ("n2" ));
33+
34+
35+
36+ if (request .getParameter ("r1" )!=null )
37+ {
38+ out .println ("<h1>Addition</h1>" +addFucn (a1 , a2 ));
39+ }
40+ if (request .getParameter ("r2" )!=null )
41+ {
42+ out .println ("<h1>Substraction</h1>" +subFucn (a1 , a2 ));
43+ }
44+ if (request .getParameter ("r3" )!=null )
45+ {
46+ out .println ("<h1>Multiplication</h1>" +mulFucn (a1 , a2 ));
47+ }
48+ RequestDispatcher rd =request .getRequestDispatcher ("/index.jsp" );
49+ rd .include (request , response );
50+ }
51+ catch (Exception e )
52+ {
53+
54+ }
55+ }
56+ }
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <web-app xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xmlns =" http://java.sun.com/xml/ns/javaee" xmlns : web =" http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi : schemaLocation =" http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id =" WebApp_ID" version =" 3.0" >
3+ <display-name >Servlet</display-name >
4+ <servlet >
5+ <servlet-name >Servlet</servlet-name >
6+ <servlet-class >mypackage.Calculator</servlet-class >
7+ </servlet >
8+ <servlet-mapping >
9+ <servlet-name >Servlet</servlet-name >
10+ <url-pattern >/firstHomePage</url-pattern >
11+ </servlet-mapping >
12+ <welcome-file-list >
13+ <welcome-file >index.jsp</welcome-file >
14+ </welcome-file-list >
15+ </web-app >
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd" >
2+ <html >
3+ <head >
4+ <meta http-equiv =" Content-Type" content =" text/html; charset=ISO-8859-1" >
5+ <title >Calculator</title >
6+ </head >
7+ <body >
8+ <h1 style =" text _align =center " >Calculator</h1 >
9+ <form action =" firstHomePage" method =" get" >
10+ <label >first number:</label >
11+ <input type =" text" name =" n1" />
12+ <br />
13+ <label >Second number : </label >
14+ <input type =" text" name =" n2" />
15+ <br />
16+ <div >
17+ <label >
18+ <input type =" radio" name =" r1" value =" add" />addition
19+ <br />
20+ </label >
21+ <label >
22+ <input type =" radio" name =" r2" value =" sub" />subtraction
23+ <br />
24+ </label >
25+ <label >
26+ <input type =" radio" name =" r3" value =" prod" />product
27+ <br />
28+ </label >
29+
30+
31+ </div >
32+ <input type =" submit" value =" submit" />
33+ </form >
34+ </body >
35+ </html >
You can’t perform that action at this time.
0 commit comments