Starting point
This commit is contained in:
commit
d15993c248
5 changed files with 119 additions and 0 deletions
|
@ -0,0 +1,25 @@
|
|||
package org.gibiris.javaBootcampNoEclipse;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class MyHelloWorldBean {
|
||||
|
||||
String strMyMessage;
|
||||
|
||||
public MyHelloWorldBean() {
|
||||
reset();
|
||||
}
|
||||
|
||||
public void setStrMyMessage(String strSet) {
|
||||
strMyMessage = strSet;
|
||||
}
|
||||
|
||||
public String getStrMyMessage() {
|
||||
return strMyMessage;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
setStrMyMessage("Dia duit, a Dhomhan!");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package org.gibiris.javaBootcampNoEclipse;
|
||||
|
||||
import java.io.*;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.*;
|
||||
|
||||
public class MyHelloWorldServlet extends HttpServlet {
|
||||
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException, ServletException
|
||||
{
|
||||
response.setContentType("text/html");
|
||||
PrintWriter out = response.getWriter();
|
||||
out.println("<html>");
|
||||
out.println("<head>");
|
||||
out.println("<title>Éibhear's Hello World (Servlet) example</title>");
|
||||
out.println("</head>");
|
||||
out.println("<body>");
|
||||
out.println("<h1 align=\"center\">Éibhear's Hello World (Servlet) example</h1>");
|
||||
out.println("<p>Ho there!</p>");
|
||||
out.println("</body>");
|
||||
out.println("</html>");
|
||||
}
|
||||
|
||||
}
|
21
source/jsps/index.jsp
Normal file
21
source/jsps/index.jsp
Normal file
|
@ -0,0 +1,21 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Éibhear's simple java bootcamp helloworld</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1 align="center">Éibhear's simple java bootcamp helloworld</h1>
|
||||
<ul>
|
||||
<li>
|
||||
This <a href="pages/myhelloworld_bean.jsp">link</a> will bring up
|
||||
a JSP (<code>pages/myhelloworld_bean.jsp</code>) that will invoke
|
||||
a java bean.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
This <a href="servlet/MyHelloWorldServlet">link</a> will invoke a
|
||||
servlet (<code>servlet/MyHelloWorldServlet</code>).
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
22
source/jsps/pages/myhelloworld_bean.jsp
Normal file
22
source/jsps/pages/myhelloworld_bean.jsp
Normal file
|
@ -0,0 +1,22 @@
|
|||
<%@ page import="org.gibiris.javaBootcampNoEclipse.MyHelloWorldBean" language="java"%>
|
||||
|
||||
<jsp:useBean id="MyHelloWorld" class="org.gibiris.javaBootcampNoEclipse.MyHelloWorldBean" scope="session"/>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Éibhear's java bootcamp Hello World (JSP & Java Bean) example</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1 align="center">
|
||||
Éibhear's java bootcamp Hello World (JSP & Java Bean)
|
||||
example
|
||||
</h1>
|
||||
<p>
|
||||
Bean example: <b><%= MyHelloWorld.getStrMyMessage() %></b>.
|
||||
</p>
|
||||
<p>
|
||||
The text in <b>bold</b> is the output of a call
|
||||
to <code>MyHelloWorld.getStrMyMessage()</code>.
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
26
source/res/web.xml
Normal file
26
source/res/web.xml
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<!DOCTYPE web-app
|
||||
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
||||
"http://java.sun.com/dtd/web-app_2_3.dtd">
|
||||
|
||||
<web-app>
|
||||
|
||||
<display-name>MyEclipse Hello World Examples</display-name>
|
||||
<description>
|
||||
Hello World type examples using Eclipse for: JSP, Java Beans, Servlets
|
||||
</description>
|
||||
|
||||
<!-- Define servlets that are included in the example application -->
|
||||
|
||||
<servlet>
|
||||
<servlet-name>MyHelloWorldServlet</servlet-name>
|
||||
<servlet-class>org.gibiris.javaBootcampNoEclipse.MyHelloWorldServlet</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>MyHelloWorldServlet</servlet-name>
|
||||
<url-pattern>/servlet/MyHelloWorldServlet</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
</web-app>
|
Loading…
Reference in a new issue