package org.gibiris.javaBootcampNoEclipse; import org.gibiris.javaBootcampNoEclipse.Astro.*; 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 { double sunD = 0, sunRA = 0, moonD = 0, moonRA = 0; String oopsMsg = new String ("No exception"); AstroFun myAstroInfo = new AstroFun(); sunD = Math.toDegrees(myAstroInfo.getSunD()); sunRA = Math.toDegrees(myAstroInfo.getSunRA()); moonD = Math.toDegrees(myAstroInfo.getMoonD()); moonRA = Math.toDegrees(myAstroInfo.getMoonRA()); response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println(""); out.println(""); out.println("Éibhear's Hello World (Servlet) example"); out.println(""); out.println(""); out.println("

Éibhear's Hello World (Servlet) example

"); out.println("

Ho there!

"); if ( oopsMsg.equals("No exception") ) { out.println("

Position in the sky of the Sun and the Moon as seen from Grand " + "Island in Nebraska on Monday the 21st of August at 21:14 " + "UTC.

"); out.println(""); out.println(""); out.println(""); out.println(""); out.println("
BodyDeclination (degrees N of equator)Right Ascension (degrees E of the Vernal Equinox)
Sun" + sunD + "" + sunRA + "
Moon" + moonD + "" + moonRA + "
"); } else { out.println("

We regret to say that we can't bring you the information you're looking for at the moment. Please come back later (because, y'know, your visit is important to us, 'n' all!).

"); } out.println(""); out.println(""); } }