Ad Code

CS 506 Assignment No 2 Full free solution || Complete Solution Available On vickylab


 Solution Download

NetBeans 4.1 and JSTL 

If you are using netBeans 4.1 IDE then you have to add JSTL library to your project manually. To do so, right click on the libraries folder, you can find it under project’s name and select the Add Library option. This is also shown in the following figure:

The Add Library dialog box opens in front of you. Select JSTL 1.1 option and press Add Library button. Now you can refer to any JSTL library in your JSPs.



Note: Remember that the JSTL 1.1 library is only added to current project. You have to repeat this step for each project in which you want to incorporate JSTL. 

Example Code: AddressBook using JSTL core tags 

This is the modified version of AddressBook that was built using Expression Language in the last handout. Only  showperson.jsp is modified to incorporate JSTL core tags along with Expression Language in place of scriptlets. The remaining participants searchperson.jsp, ControllerServlet,  PersonInfo and  PersonDAO left unchanged. Let’s look on the   code of each of these components:

Phase 1: Edit Phase  1  consists  of  editing  a  file.  This  is  accomplished   with  an  editor  program.  The programmer  types  a  java  program  using  the  editor  like  notepad,  and  make  corrections  if necessary. 

When the programmer specifies that the file in the editor should be saved, the program is stored on a secondary storage device such as a disk. Java program file name ends with a .java extension.  On Windows platform, notepad is a simple and commonly used editor for the beginners. However java integrated development environments (IDEs) such as NetBeans, Borland JBuilder, JCreator and IBM’s Eclipse Java built-in editors that are smoothly integrated into the programming environment.

 Phase 2: Compile 

In Phase 2, the programmer gives the command javac to compile the program. The java compiler translates the java program into byte codes, which is the language understood by the java interpreter.  To compile a program called Welcome.java type javac Welcome.java at the command window of your system. If the program compiles correctly, a file called Welcome. Class is produced. This is the file containing the byte codes that will be interpreted during the execution phase. 

Phase 3: Loading 

In phase 3, the program must first be placed in memory before it can be executed. This is done  by  the  class  loader,  which  takes  the  .class  file  (or  files)  containing  the  byte  codes and  transfers  it  to  memory.  The  .class  file  can  be  loaded  from  a  disk  on  your  system or over a network (such as your local university or company network or even the internet). 

Applications  (Programs)  are  loaded  into  memory  and  executed  using  the  java  interpreter via the command java. When executing a Java application called Welcome, the command Java Welcome Invokes the interpreter for the Welcome application and causes the class loader to load information used in the Welcome program. 

Phase 4: Verify 

Before the byte codes in an application are executed by the java interpreter, they are verified by the byte code verifier in Phase 4. This ensures that the byte codes for class that are loaded form the internet (referred to as downloaded classes) are valid and that they do not violate Java’s security restrictions. Java enforces strong security because java programs arriving over the network should not be able to cause damage to your files and your system (as computer viruses might).  2.2.5  Phase 5: Execute 

Finally in phase 5, the computer, under the control of its CPU, interprets the program one byte code at a time. Thus performing the actions specified by the program.Programs may not work on the first try. Each of the preceding phases can fail because of various errors. This would cause the java program to print an error message. The programmer would return to the edit phase, make the necessary corrections and proceed through the remaining phases again to determine if the corrections work properly. 


Post a Comment

0 Comments

Close Menu