File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 <artifactId >demo-junit</artifactId >
77 <version >1.0.1-20170422</version >
88
9+ <packaging >war</packaging >
10+
911 <build >
1012 <plugins >
1113 <plugin >
3335 <version >2.3.20</version >
3436 </dependency >
3537
38+ <!-- https://mvnrepository.com/artifact/javax.servlet/servlet-api -->
39+ <dependency >
40+ <groupId >javax.servlet</groupId >
41+ <artifactId >servlet-api</artifactId >
42+ <version >2.5</version >
43+ <scope >provided</scope >
44+ </dependency >
45+
3646 <dependency >
3747 <groupId >junit</groupId >
3848 <artifactId >junit</artifactId >
Original file line number Diff line number Diff line change 1+ package hello ;
2+
3+ import javax .servlet .http .HttpServlet ;
4+ import javax .servlet .http .HttpServletRequest ;
5+ import javax .servlet .http .HttpServletResponse ;
6+ import java .io .IOException ;
7+ import java .io .PrintWriter ;
8+
9+ public class Web extends HttpServlet {
10+ public void doGet (HttpServletRequest req , HttpServletResponse res )
11+ throws IOException {
12+ res .setContentType ("text/html" );//setting the content type
13+ PrintWriter pw = res .getWriter ();//get the stream to write the data
14+
15+ //writing html in the stream
16+ pw .println ("<html><body>" );
17+ pw .println ("Welcome to servlet" );
18+ pw .println ("</body></html>" );
19+
20+ pw .close ();//closing the stream
21+ }
22+ }
Original file line number Diff line number Diff line change 1+ <web-app >
2+
3+ <servlet >
4+ <servlet-name >sonoojaiswal</servlet-name >
5+ <servlet-class >hello.Web</servlet-class >
6+ </servlet >
7+
8+ <servlet-mapping >
9+ <servlet-name >sonoojaiswal</servlet-name >
10+ <url-pattern >/welcome</url-pattern >
11+ </servlet-mapping >
12+
13+ </web-app >
Original file line number Diff line number Diff line change 1+ hello learn-pipeline-java
You can’t perform that action at this time.
0 commit comments