Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
COMPUTING SUBJECT: JSP Basics TYPE: Assignment IDENTIFICATION: JSP COPYRIGHT: Michael Claudius LEVEL: Easy TIME CONSUMPTION: 2 hours EXTENT: 50 lines OBJECTIVE: JSP expressions, scriptlets, declaration PRECONDITIONS: Core Servlets & JSP Ch. 10&11 COMMANDS: IDENTIFICATION: JSP/MC The Mission You are to make a Web project based on some .jsp page files and a few Java classes in a related package. Useful links for this assignment http://www..coreservlets.com Site for all kind of information http://volume1.coreservlets.com/archive/index.html Code examples from the book 1. Create a Web project In your favorite editor create a new project JSPProject of the category Web. Choose the Category to Web and Web Application. Look at Web Pages directory. Notice that the index.jsp file is automatically created in the Web Pages directory. This is where all the .jsp files will be placed. In Source Package create a new package named “coreservlets”. Activate index.jsp and compile and try to run it. It will take some time as the web-server (Tomcat/GlassFish) now will be initialised. First step first… 2.Understanding the compilation. . JSP/Servlet corespondence Open windows explorer and in the project folder JSPProject. Then search for files with “index”. In the name. Notice the index_jsp.java file. Try to open it in a simple editor like TextPad Look at the code and notice the method _jspService(HttpServletRequest request, HttpServletResponse response) What is the request, response, session, out used for ? Where and what is the HTML code changed into ? 3. Downloading You are now to use some predefined .jsp and .java files (Ch11 JSP Files.zip and Ch11 Java Files.zip) which you can download from your teacher’s home page. Unzip the .jsp files to the Web Pages folder. Unzip the .java files to the coreservlets package. Note: In the next assignments you are to compile run various programs but the most important is that you try to understand the code; e.g. by answering the questions given. 4. JSP Expressions Compile and run Expressions.jsp What is the syntax for java expression? 5. JSP Scriptlets Compile and run BGColor.jsp and DayWish.jsp What is the syntax for Scriptlets? How can a choice be made ? What is scriptlets good for ? 5. JSP Declaration Compile and run AccessCounts.jsp What is the syntax for declarations ? How can a variable be declared ? What are declarations good for ? 6. Comparing JSP and Servlet Compile and run ThreeParams.jsp Try to fill out the request parameters: http://localhost:8084/JSPProject/ThreeParams.jsp?param1=Mike¶m2=is¶m3=aBastard Now compile and run a Java Servlet Class ThreeParams1.java. Compile and run. Take a good look at the differences in programming style. Discuss…..