Java the UML Way versjon 2002-04-17 Only to be used in connection with the book "Java the UML Way", by Else Lervik and.

Slides:



Advertisements
Similar presentations
Chapter 6 Server-side Programming: Java Servlets
Advertisements

Java Script Session1 INTRODUCTION.
Java Server Pages (JSP)
JSP1 Java Server Pages (JSP) Introducing JavaServer Pages TM (JSP TM ) JSP scripting elements.
Chapter 51 Scripting With JSP Elements JavaServer Pages By Xue Bai.
Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
Servlets and a little bit of Web Services Russell Beale.
18-Jun-15 JSP Java Server Pages Reference: Tutorial/Servlet-Tutorial-JSP.html.
JSP Java Server Pages Reference:
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Chapter 4 Servlets Concept of Servlets (What, Why, and How) Servlet API Third-party tools to run servlets Examples of Using Servlets HTML tag with GET.
Servlets Compiled by Dr. Billy B. L. Lim. Servlets Servlets are Java programs which are invoked to service client requests on a Web server. Servlets extend.
Java Servlets and JSP.
Java Servlets. What Are Servlets? Basically, a java program that runs on the server Basically, a java program that runs on the server Creates dynamic.
Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
Overview of JSP Technology. The need of JSP With servlets, it is easy to – Read form data – Read HTTP request headers – Set HTTP status codes and response.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
Java the UML Way version Only to be used in connection with the book "Java the UML Way", by Else Lervik and.
1 Servlet How can a HTML page, displayed using a browser, cause a program on a server to be executed?
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
Java the UML Way versjon Only to be used in connection with the book "Java the UML Way", by Else Lervik and.
Using JavaBeans and Custom Tags in JSP Lesson 3B / Slide 1 of 37 J2EE Web Components Pre-assessment Questions 1.The _____________ attribute of a JSP page.
JSP Java Server Pages Softsmith Infotech.
Li Tak Sing COMPS311F. Static attributes in Servlets Since Servlets are also Java classes, you can also use static attributes to store values that can.
111 Java Servlets Dynamic Web Pages (Program Files) Servlets versus Java Server Pages Implementing Servlets Example: F15 Warranty Registration Tomcat Configuration.
Chapter 7 Java Server Pages. Objectives Explain how the separation of concerns principle applies to JSP Describe the operation and life-cycle of a JSP.
COMP 321 Week 7. Overview HTML and HTTP Basics Dynamic Web Content ServletsMVC Tomcat in Eclipse Demonstration Lab 7-1 Introduction.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
Chapter 8 Cookies And Security JavaScript, Third Edition.
JAVA SERVER PAGES. 2 SERVLETS The purpose of a servlet is to create a Web page in response to a client request Servlets are written in Java, with a little.
JAVA SERVER PAGES CREATING DYNAMIC WEB PAGES USING JAVA James Faeldon CS 119 Enterprise Systems Programming.
Slides © Marty Hall, book © Sun Microsystems Press 1 JSP Scripting Elements Core Servlets & JSP book:
Chapter 3 Servlet Basics. 1.Recall the Servlet Role 2.Basic Servlet Structure 3.A simple servlet that generates plain text 4.A servlet that generates.
16-Oct-15 JSP Implicit Objects. 2 JSP Implicit Objects are the Java objects that the JSP Container makes available to developers in each page and developer.
Java Servlets. Servlets When we run small Java programs within a browser these are referred to as Applets... And when we run small Java programs within.
Java the UML Way version Only to be used in connection with the book "Java the UML Way", by Else Lervik and.
Java Servlets & Java Server Pages Lecture July 2013.
SE-2840 Dr. Mark L. Hornick 1 Java Server Pages. HTML/JSPs are intended to be used as the views in an MVC- based web application Model – represents an.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Java the UML Way versjon Only to be used in connection with the book "Java the UML Way", by Else Lervik and.
Java the UML Way version Only to be used in connection with the book "Java the UML Way", by Else Lervik and.
Java server pages. A JSP file basically contains HTML, but with embedded JSP tags with snippets of Java code inside them. A JSP file basically contains.
Introduction to JavaScript CS101 Introduction to Computing.
Overview of Form and Javascript fundamentals. Brief matching exercise 1. This is the software that allows a user to access and view HTML documents 2.
JavaScript Scripting language What is Scripting ? A scripting language, script language, or extension language is a programming language.
CS-4220 Dr. Mark L. Hornick 1 Java Server Pages. HTML/JSPs are intended to be used as the views in an MVC- based web application Model – represents an.
JSP. Types of JSP Scripting Elements Expressions of the form, which are evaluated and inserted into the servlet's output. Scriptlets of the form, which.
Middleware 3/29/2001 Kang, Seungwoo Lee, Jinwon. Description of Topics 1. CGI, Servlets, JSPs 2. Sessions/Cookies 3. Database Connection(JDBC, Connection.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, Responds oriented other.
1 Introduction to Servlets. Topics Web Applications and the Java Server. HTTP protocol. Servlets 2.
Java the UML Way version Only to be used in connection with the book "Java the UML Way", by Else Lervik and.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 1COMP9321, 15s2, Week.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Vakgroep Informatietechnologie – Onderzoeksgroep (naam) Web Centric Design of Distributed Software.
©SoftMoore ConsultingSlide 1 Overview of Servlets and JavaServer Pages (JSP)
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 21 Java Servlets Wed. 11/22/00 based on material.
 Java Server Pages (JSP) By Offir Golan. What is JSP?  A technology that allows for the creation of dynamically generated web pages based on HTML, XML,
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
Java Server Pages. 2 Servlets The purpose of a servlet is to create a Web page in response to a client request Servlets are written in Java, with a little.
Bayu Priyambadha, S.Kom. Static content  Web Server delivers contents of a file (html) 1. Browser sends request to Web Server 3. Web Server sends HTML.
8-Mar-16 More About Servlets Session Tracking. Persistent information A server site typically needs to maintain two kinds of persistent (remembered) information:
Unit-6 Handling Sessions and Cookies. Concept of Session Session values are store in server side not in user’s machine. A session is available as long.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
World Wide Web has been created to share the text document across the world. In static web pages the requesting user has no ability to interact with the.
Servlets and Java Server Pages
Tutorial 10: Programming with javascript
Presentation transcript:

Java the UML Way versjon Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21 Web Programming With JavaServer Pages Programming for the Webpage 2-3 Servletspage 4-6 JavaServer Pages (JSP) basicspage 7-12 Inputting data from the userpage Client side validation with JavaScriptpage 19 Databasespage Storing state informationpage Programming cookiespage 28 Programming sessionspage The problem with reloading pagespage 31

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 2 Searching for Hotels on the Internet? You enter a city and get back a list of possible hotels. You examine the source code, and you find the hotel names hardcoded. Why doesn’t the page contain program logic that searches for the hotels in a database? The answer is that the HTML code is specially adapted. The Web server receives your query for hotels in a specific city, sends this query to a program that searches the database, and generates HTML code with the applicable hotels. This code is then sent to the client in response to the query. This chapter is about this kind of programming.

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 3 Different Ways of Programming for the Web Dynamic on the client side, in the client’s browser –An applet is a program that is downloaded to a Web client in connection with an HTML page. The download takes a little longer than normal The browser prints an alert in the status line that Java is being started. In return, the user gets a page with far greater functionality than a purely static HTML page offers. –Various scripting languages have gradually made simple dynamics possible without costing too much in download time. –The user may examine the source code of these scripts. Dynamic on the server side –We fill in forms and push the Send-button. –The data are handled by a program on the server side. –This handling may involve specially created HTML pages that are sent back to the client. –We’ll use JavaServer Pages (JSP) to program the server side. Something called servlets are the basis of JSP. Software –You’ll need a Web server that supports servlets and JSP. –You’ll need the API online documentation for these classes. –The book tells you how to install and use LiteWebServer from Gefion Software.

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 4 Servlets A servlet is a Java program that runs on a Web server.

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 5 The Servlet Object All clients work with the same servlet object. Any instance variables there might be can be updated by multiple clients. Methods that work with the instance variables should be synchronized. –For example, the synchronized java.util.Vector class should be used in stead of the unsynchronized java.util.ArrayList. When a servlet is initialized, a pool of threads is usually generated that the service() method runs in. –A client that requests the servlet (and thereby the service() method) will be assigned its own thread. –This thread is returned to the pool after use. – If a thread is requested and the pool is empty, the client has to wait, or the pool can be expanded. –By using a pool of threads, we avoid resource-intensive initialization every time a request comes from a client.

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 6 Example of Server-Side Programming An example of server side programming This page was downloaded: Mon Aug 27 10:54:14 GMT+02: public class SimpleServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.print(" "); …see program listing 21.1… out.println(" "); } source code at the server side the request from the client generates this HTML source code the browser displays the page Solve the problems, pp

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 7 JavaServer Pages (JSP) A jsp file contains HTML code with elements of Java code. The user requests the jsp file directly. –If this is a first request for this file, it will be converted to a servlet. –The servlet is compiled and starts automatically. – The result of the servlet’s service() method will be an HTML page that is sent to the client and presented in the client’s browser. A JSP page is thus an HTML page that is created by a servlet based on a jsp file. <!-- Time.jsp E.L !> An example of server side programming This page was downloaded:

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 8 Why JSP? Only to avoid writing out.print() around the HTML elements? No! HTML is presentation. A jsp file mainly contains HTML. Web designers create HTML code. Java programmers create Java classes dealing with the problem that’ll be solved. Only small snippets of Java code are needed to link the jsp file to the Java classes. However, this book is about programming, not design. In this book the jsp files are rather untypical, they’ll contain relatively little HTML. Solve the problems, page 658.

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 9 JSP Predefined Objects and JSP Expressions Predefined objects –request, type: HttpServletRequest –response, type: HttpServletResponse –out, type: PrintWriter –session, type: HttpSession JSP expressions –Surrounded by –Examples: This page was downloaded: // No semicolon! The server calculates 17 * 7 and gets The client machine is:

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 10 JSP Scriptlets Five random numbers in the interval [1, 100]: <% int sum = 0; for (int i = 0; i < 5; i++) { int number = (int) (100 * Math.random() + 1); out.println(" " + number); sum += number; } out.println(" " + "The sum is " + sum); %> Five random numbers in the interval [1, 100]: <% int sum = 0; for (int i = 0; i < 5; i++) { int number = (int) (100 * Math.random() + 1); %> <% sum += number; } %> The sum is Java code surrounded by, the same example in two ways: The client output looks like this: Five random numbers in the interval [1, 100]: The sum is 230

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 11 JSP Declarations Local variables are declared inside scriptlets. Every client gets its own. Variables declared outside become instance variables (common for all clients), and they must be surrounded by No. of visits since servlet started = Counter = The first time the servlet is accessed, we get this printout in the browser window: No. of visits since servlet started = 1 Counter = 1 The next time it looks like this: No. of visits since servlet started = 2 Counter = 1 And so on: No. of visits since servlet started = 3 Counter = 1 Every time the servlet restarts, the variable noOfVisits is set to zero.

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 12 Comments and Directives Regular Java comments in the Java code JSP comments in the JSP code HTML comments for comments that should be sent to the browser A JSP directive controls the construction of the servlet that is created from the jsp file. A directive is enclosed between. The page directive: The include directive, the contents of the file named are inserted before the servlet is generated: Solve problems 1 and 2, page 662.

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 13 Inputting Data from the User One Input Field Enter Your Home Country:

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 14 What Happens After the User Presses the Send Button? Feedback Back ReadCountry.jsp

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 15 Parameter Name and Value String theCountry = request.getParameter("country"); parameter name parameter value

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 16 Error Message on the Same Page As the Input Field <!-- ReadCountry2.jsp E.L > An Input Field with Error Check Enter Your Country: <% String country = request.getParameter("country"); /* country is null the first time the page is downloaded by a user */ if (country != null) { country = country.trim(); if (country.equals("")) out.println("You have to enter data!"); else out.println("Hallo, you are from " + country + "!"); } %>

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 17 What If We’d Used “get” Instead of “post”? In the HTML file we now write: The data the user entered is now attached to the URL so that it shows in the browser’s address field. There is a limit to the number of characters. In terms of sending data, there is usually no reason to use get instead of post. Always use post transfer if the user is entering sensitive data.

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 18 Show program listings 21.4 and 21.5, pp Solve problem 1, page 670.

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 19 Client Side Validation with JavaScript As a supplement to server side checking, data should be checked before they are sent to the server. The HTML code has to be expanded with script code. JavaScript is the de facto standard for client-side script programming. An Input Field with JavaScript data control function checkData() { if (window.document.countryInput.country.value == "") alert("You have to enter data!"); else window.document.countryInput.submit(); } Enter Your Home Country:

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 20 Databases <!-- SimplePersonTable.jsp E.L > A Simple Test of Database Connection <body bgcolor="wheat" text="black" link="darkgreen" vlink="steelblue" alink="darkblue"> A Listing Of Persons Ident.no. First Name Last Name 100 EDWARD BROWN 101 ANN MARGARET GREEN 102 JOHN JOHNSON The Server Side JSP Code, see next slide.

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 21 A Simple Test of Database Connection A Listing Of Persons Ident.no. First Name Last Name <% try{ Class.forName("oracle.jdbc.driver.OracleDriver"); Connection conn = DriverManager.getConnection ”username", ”password"); java.sql.Statement statement = conn.createStatement(); String sql = "select * from person"; ResultSet resSet = statement.executeQuery(sql); while (resSet.next()) { out.print(" " + resSet.getString("identno") + " "); out.print(" " + resSet.getString("firstname") + " "); out.println(" " + resSet.getString("lastname") + " "); } if (statement != null) statement.close(); if (conn != null) conn.close(); } catch (Exception e) { out.print("Error, database connection: " + e); } %> SimplePerson.jsp

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 22 A Web Application That Works with a Database We use the Database class from program listing 20.2.

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 23 The Order the Various Files are Requested in NameArchive.jsp HandleSelection.jsp DeletePersonData.jspPersonForm.jsp AddPersonData.jspUpdatePersonData.jsp form action include idNo= "not defined" managingFile= "AddPersonData.jsp" include idNo as for the person managingFile= "UpdatePersonData.jsp" form action delete newedit Show program listing 21.8, pp Solve problems

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 24 Programming Database Handling The handling files, DeletePersonData.jsp, AddPersonData.jsp and UpdatePersonData.jsp, are put together the same way: –establish a database connection –do a database operation –close the database connection This is not a particularly efficient way of dealing with a database. The whole thing can be very sluggish with many requests to the database. Professional systems should maintain a pool of database connections and distribute these among the clients as needed. Several books include code for a Connection class of this type (see for example section 18.7 in [Hall 2000]). Many database drivers [ also have built-in “connection pooling”. In our example, we can add uses of this service to the Database constructor and the closeTheConnection() method. The rest of the code then remains unchanged. Solve problem 1 and 2, page 680.

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 25 Storing State Information HTTP is a stateless protocol. –The same client can send request after request to the Web server, which handles each individual request completely independently of all the other requests. How to transfer data from page to page? –Using the submit button and then interpreting the request object –Using hidden fields –Saving data, either on the client side (cookies) or on the server side (session object)

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 26 Cookies Overview Client side storage Often used for personal information, such as name and address Handled by the browser Max 4kb per cookie Max 20 cookies per Web server Max 400 cookies per browser You will almost certainly find a lot of cookies on your computer (if you haven’t configured your browser not to accept cookies). Search for directories with the name cookies and files with the name cookies.*. Cookies let the server recognize you, but not identify you. Programs on Web servers, however, should not depend on cookies working. Cookies should be an option for the client and not the only solution.

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 27 Session Objects - Overview Server side storage A client will to be assigned a session ID when the session starts, i.e. when contact is established between the client and the server. The data are stored in a session object on the server, while the session ID is normally stored as a cookie on the client. But as we’ll see later, it is possible to use sessions without using cookies. An example using cookies and session objects: 1.You log onto an Internet store to order pizza and soda and are assigned a session ID, which is stored on your computer as a cookie. 2.At the same time, you are assigned a session object on the Web server. 3.Every time your computer asks for a new file from the Web server, the session ID is sent along with the URL. 4.If you place an order, it is saved in the associated session object on the server. 5.If the Web server has already saved your name, telephone number, and delivery address in cookies on your computer, you will be asked to confirm that they are correct before your order is confirmed. 6.Or you may have to enter this information and then they will be saved automatically in cookies so that you don’t have to enter them again later. 7.If you decide to forget the whole order and make do with what you have in the fridge, the session object will be deleted from the Web server after a given period of time.

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 28 Programming Cookies Show program listing 21.9, pp

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 29 Programming Sessions Show program listing 21.10, pp

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 30 A Little Bookstore Show program listing pp

Only to be used in connection with the book "Java the UML Way", by Else Lervik and Vegard B. Havdal. ISBN , John Wiley & Sons Ltd 2002 The Research Foundation TISIP, Chapter 21, page 31 The Problem With Reloading Pages You download the HTML file in program listing 21.4 to your Web browser. You fill inn the data, and then press “Send”. Then you’ll get the message “Your evaluation is saved”. Click the Reload button in your browser. What happens? The data are stored in the file once more. A single user may fill up your evaluation file with repeating data. A solution to this problem is to use a session attribute. We set the attribute for the first time after the data are saved. Before the saving section there is a check if this attribute exists. If it does, we do not save again. The same considerations apply to updating databases, as well. Solve problems 1 and 3, page 694.