Setting the Java classpath in Windows through command prompt

Q: How to set path for java in windows through command prompt. I don't want to set path permanently from my computer icon with advanced tab with environment variables . what is command to set path for java

CLASSPATH

In JDK the CLASSPATH contains directories (or JAR files), from where your java compiler/runtime will look for .class files (and some others). For example, "java Hello.class" will not work unless you set the directory (or JAR file) Hello.class is in, into your CLASSPATH.
i.e.classpath  C:\Java\jdk1.6.0_03\lib

For setting CLASSPATH using command prompt

Java class path can be set using either the -classpath option when calling an SDK tool (the preferred method) or by setting the CLASSPATH environment variable. The -classpath option is preferred because you can set it individually for each application without affecting other applications and without other applications modifying its value.

(ii)on command prompt

C:\>set classpath=%classpath;C:\Java\jdk1.6.0_03\lib%

JSP Life Cycle Explanation

http://www.myhomepageindia.com/wp-content/uploads/2009/04/jsplifecycle.jpg
JSP’s life cycle can be grouped into following phases.

1. JSP Page Translation:

A java servlet file is generated from the JSP source file. This is the first step in its tedious multiple phase life cycle. In the translation phase, the container validates the syntactic correctness of the JSP pages and tag files. The container interprets the standard directives and actions, and the custom actions referencing tag libraries used in the page.

2. JSP Page Compilation:

The generated java servlet file is compiled into a java servlet class.
Note: The translation of a JSP source page into its implementation class can happen at any time between initial deployment of the JSP page into the JSP container and the receipt and processing of a client request for the target JSP page.

3. Class Loading:

The java servlet class that was compiled from the JSP source is loaded into the container.

4. Execution phase:

In the execution phase the container manages one or more instances of this class in response to requests and other events.
The interface JspPage contains jspInit() and jspDestroy(). The JSP specification has provided a special interface HttpJspPage for JSP pages serving HTTP requests and this interface contains _jspService().

5. Initialization:

jspInit() method is called immediately after the instance was created. It is called only once during JSP life cycle.

6. _jspService() execution:

This method is called for every request of this JSP during its life cycle. This is where it serves the purpose of creation. Oops! it has to pass through all the above steps to reach this phase. It passes the request and the response objects. _jspService() cannot be overridden.

7. jspDestroy() execution:

This method is called when this JSP is destroyed. With this call the servlet serves its purpose and submits itself to heaven (garbage collection). This is the end of jsp life cycle.
jspInit(), _jspService() and jspDestroy() are called the life cycle methods of the JSP.

What is the difference in using request.getRequestDispatcher() and context.getRequestDispatcher()?

In request.getRequestDispatcher(path) in order to create it we need to give the relative path of the resource. But in   resourcecontext.getRequestDispatcher(path) in order to create it we need to give the absolute path of the resource.

Life-cycle mehtods in JSP

THe generated servlet class for a JSP page implements the HttpJspPage interface of the javax.servlet.jsp package. Hte HttpJspPage interface extends the JspPage interface which inturn extends the Servlet interface of the javax.servlet package. the generated servlet class thus implements all the methods of the these three interfaces. The JspPage interface declares only two mehtods - jspInit() and jspDestroy() that must be implemented by all JSP pages regardless of the client-server protocol. However the JSP specification has provided the HttpJspPage interfaec specifically for the JSp pages serving HTTP requests. This interface declares one method _jspService().
The jspInit()- The container calls the jspInit() to initialize te servlet instance.It is called before any other method, and is called only once for a servlet instance.
The _jspservice()- The container calls the _jspservice() for each request, passing it the request and the response objects.
The jspDestroy()- The container calls this when it decides take the instance out of service. It is the last method called n the servlet instance.

scope values for the <jsp:useBean>?

The different scope values for are
1. page
2. request
3.session
4.application

Difference between JSP and Servlets

interview questions for JSP and Servlets only. Since JSP and Servlets are almost identical technology, there is only one section for both JSP and Servlet interview questions. If you need interview questions for any other java related technologies , please check the relevant sections. 
Difference between JSP and Servlets
JSP is used mainly for presentation only. A JSP can only be HttpServlet that means the only supported protocol in JSP is HTTP. But a servlet can support any protocol like HTTP, FTP, SMTP etc.

Mainframe Interview Questions,DB2 Administration Interview Questions, DB2 UDB Admin Interview Questions,DB2 Admin Interview

If you are given with a query, how you tune it?

Does runstats do a sort?

Explain the steps of Server Installation?

Explain the steps of Disaster Recovery?

What is Increamental /Delta Back up ?

What are the db cfg parms which affect the back up strategy?

Have you worked in partitioned DB ?

How to check no of active conncetions to the DB >> db2 list active databases

The Application team contacts saying DB response is very low what would you do ?

What is a Global Declared Temporary table ? How to use it ?

What is runstats ? how it improves performance ?

What is HADR ? How to load data to a HADR Server ?

SMS table space is full, filesystem is also full , Cannot add SAN what would you do ?

Have you worked in Partitioned DB ?

What are the tables spaces that get created when a DB is initially created,?

What is the use of SYSCAT SPACE ?

What is the use of buffer pools ?

What is buffer pool hit ratio ?

How would you see the buffer pool usage?

How do you find out deadlock transaction ?

What is Reorg check?

Whats are the different Back up types ?

Do you write shell scripts ?

Other than space utilization what is the difference between DMS and SMS ?

How do you find containers that are in error with out looking into diaglog ?

What DB parameter must be set to allow to take incremental back up ?

CICS Interview Questions asked in various MNCs like TCS,Wipro,Infosys,HP Dell and IBM-Part 3

What is ASRAABEND in CICS ?

What is a Logical Unit of Work (LUW) ?

What does Pseudo Conversational mean?

What are the various types of accesses that can be allowed by the SERVREQ option of the
DFHFCT

What are the differences between Temporary Storage Queue (TSQ) and Transient Data Quene (TDQ)?

What are the attribute values of Skipper and Stopper fields?

The process of writting its own type of journal records by the application program

Reading a record from a TSQ will logically delete the record from the Queue (True or False).

Name some command used for CICS file browsing.

In which CICS table would you specify the length of the TASK WORK AREA (TWA)?

How would you resolve an ASRA abend?

How is the storage determined in the symbolic map, if you have multiple maps ?

How do you make your BMS maps case sensitive

How do you define Task Work Area?

How and where is the TWA size set?

Explain re-entrancy as applies to CICS.

Can you define multiple maps in a BMS mapset

A CICS program ABENDS with an ASRA ABEND code, What is its meaning ?

CICS Interview Questions asked in various MNCs like TCS,Wipro,Infosys,HP Dell and IBM-Part 2

Name and explain some common CICS abend codes?

In the CICS command level all the re-entrancy issues are handled by the System (True or
False).?

How would you release control of the record in a READ for UPDATE?

How is the stopper byte different from an auto byte?

How do you invoke other programs? What are the pros and cons of each method?

How do you control cursor positioning?

For multithreading an apllication program need not be re-entrant(True or False).

Explain how to handle exceptional conditions in CICS.

CICS Command level is?

Can you access QSAM (seq) files from CICS?

Why must all CICS programs have a Linkage Section?

Which is the program which determines whether a transaction should be restarted?

Which CICS system program is responsible for handling automatic task initialization?

What us the primary function of the Sign-on Table ?

What is the size of commarea ?

What is the meaning of the SYNCPOINT command?

What is the function of the CICS translator ?

What is the difference between the enter key, the PF keys and the PA keys

What is the difference between a RETURN

What is the command used for receiving a map from a terminal?

What is the CICS Command that is used for reading a record from the TDQ?

What is meant by program reentrance?

What is effect on RECEIVE MAP when PF key is pressed? PA key is pressed?

CICS Interview Questions asked in various MNCs like TCS,Wipro,Infosys,HP Dell and IBM-Part 1

Which is the option of the HANDLE AID command

Which CICS command must be issued by the application program

What table must be update when adding a new transaction and program?

What is the significance of RDO?

What is the meaning of the ENQ and DEQ commands?

What is the function of DFHMDF BMS macro?

What is the difference between START and XCTL ?

What is the difference between a physical BMS mapset and a logical BMS mapset ?

What is the command that is used to delay the processing of a task for a specified time interval
or until a specified time?

What is the CICS command that gives the length of TWA area?

What is meant by a CICS task?

What is difference between call and link ?

What is an MDT ?

What is a logical message in CICS?

What does it mean when EIBCALEN is equal to zeros?

What are the two ways of breaking a CPU bound process to allow other task to gain access to CPU.

What are the differences between DFHCOMMAREA and TSQ?



What are the 3 working storage fields used for every field on the map?

IBM CICS Frequently Asked Interview Questions,CICS Interview Questions

IBM CICS Frequently Asked Interview Questions , below are some important CICS Interview Questions that are generally asked in any CICS Interview in MNCs

Q1 - What is MDT ?
Ans - Bit in the attribute byte indicating modification of field on screen.If the user keys in any data into the field, it turns the MDT ON indicating that the data is modified. To save transmission time , 3270 terminal sends a field over the TC line only if the MDT is on. Otherwise, the field value is not transmitted.

Q2 - What is DFHCOMMAREA ?
Ans - DFHCOMMAREA in the Linkage section is used to pass the data in working storage commarea from one to program to another program. It should be defined with as at least one byte long. As the working storage section is freshly allocated for every execution.

Q3- What is Execution Interface Block (EIB) ?Ans - EIB is a CICS area that contains information related to the current task, which can be used for debugging the program. The most widely used variables are EIBDATE, EIBTIME, EIBAID, EIBCALEN, EIBCPOSN, EIBRESP, EIBRSRCE (resource), EIBFN (recent CICS command code), EIBTRMID and EIBTRNID.

Q4- What are the important tables used in the CICS-DB2 environment ?Ans - CICS manages it's communication with DB2 with special interface modules called CICS/DB2 Attachment Facility. When a CICS program issues a SQL statement, CICS requests the attachment facility to establish a connection with DB2 called a thread. The information about the CICS transaction and DB2 is entered in Resource Control Table (RCT). The plan information is referenced through the RCT Entries.

Q5- What are the various commands used to browse through a dataset ?Ans - STARTBR, READNEXT, READPREV and RESETBR. The options used are DATASET, RIDFLD, RRN/RBA, GENERIC, and KEYLENGTH for the 3 commands, and INTO, LENGTH for READNEXT and READPREV command, and EQUAL/GTEQ for STARTBR only. RESP can be used with any. ENDBR is used to end the browse operation

Q6- What is 2 phase commit ?Ans - It occurs when a programmer Issue's an Exec CICS Syncpoint command. This is called a two phase Commit because CICS will first commit changes to the resources under its control like VSAM files, before DB2 changes are committed. Usually CICS signals DB2 to complete the next phase and release all the locks.

Q7- What are ASRA,AICA,AEY9 abend ?Ans - ASRA - Any data exception problem SOC7, SOC4 etc
AICA - Runaway Task.
AEY9 - DB2/IDMS Database is not up.

Q8 What are the differences between TSQ and a TDQ ?
Ans –
(1) In Temporary Storage Queues Data is read randomly, While in Transient Data Queues data must be read sequentially.
(2) In a TSQ data can be read any number of times as it remains in the queue until the entire Queue is deleted. In TDQ data item can be read once only. To reuse the TDQ it must be closed and reopened.
(3) Data can be changed in TSQ, but not in TDQ.
(4) TSQ can be written to Auxiliary or Main Storage, while TDQ is written to Disk. Temporary storage is a holding place, while Transient data is always associated with destination. The
(5) TSQ name is defined dynamically, while a TDQ name need to be defined in the DCT. Note: An application uses TSQ 's to pass info' from task to task, while a TDQ to accumulate records before processing or send data for external use, such as a print operation or other.

Q9- What are Extra partition & Intra partition TDQs ?Ans - Extra-partition TDQ's are datasets used for communication between CICS and other CICS/Batch regions. Intra-partition TDQ's are queues for communication within CICS region. CICS stores the Intra-partition TDQ in a dataset 'DFHNTRA' on the Disk. Extra-partition TDQ doesn't have to be a disk file, it can reside on any device that's a valid QSAM/VSAM. The DCT entry contains the destination-Id, type of TDQ, Destination, Trigger level if needed

Q10 How is an Abend handled in a CICS program ?Ans - The HANDLE ABEND command is used to trap and Handle errors. It has 4 possible options and only one of them can be used with this command at a time. The options are Program(...) to transfer control to the program, Label(...) to transfer control to the specified paragraph, Cancel option keeps the earlier Handle Abends from being executed. Reset option will reactivate the Handle Abend commands, which were previously cancelled.

Q11 What is Quasi-reentrancy ?Ans - There are times when many users are concurrently using the same program, this is what we call Multi-Threading. For example, 50 users are using program A, CICS will provide 50 Working storage for that program but one Procedure Division. And this technique is known as quasi-reentrancy.

IBM mainframes COBOL qsam/vsam FILE STATUS CODES

Hi Friends
IBM mainframes COBOL qsam/vsam FILE STATUS CODES are available .Please check the Link for the latest codes and File Status

http://publib.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/igy3lr00/6.1.8.9.1?SHELF=igy3sh00&DT=20011206182158#HDRSTATKEY

Working of Java Virtual Machine (JVM)

JVM(Java virtual machine):it is the runtime environment for java programs and it contains the following :
1)class loader
2)byte code verifier
3)jit compiler and interpreter
java is a platform independent language which means it can be operated in any operating system

when you execute a program in C && C++ a .exe file is obtained which contains the source code
and operating system details where as when you execute a program in java a .class file is created which contains the byte code(source code) only.It is the JVM which links this byte code with the operating system details.
The Java Virtual Machine forms part of a large system, the Java Runtime Environment (JRE). Each operating system and CPU architecture requires a different JRE. The JRE comprises a set of base classes, which are an implementation of the base Java API, as well as a JVM. The portability of Java comes from implementations on a variety of CPUs and architectures. Without an available JRE for a given environment, it is impossible to run Java software.

Functionality of JVM(Java Virtual Machine)

Java sovles the problem of platform independence by usingbyte code.Java complier does not produce native executablecode.
Instead it produces a special format called byte code.Byte code is a highly optimized set of instructionsdesigned to executed by a java runtime system called JavaVirtual Machine(JVM).JVM is an interpreter for byte code.
This interpreter reads or understands the bytecode andexecutes the corresponding native machine instructions.Thus to port java programs to a new platform ,all thatneeded is to port the interperter and some of the libraryroutines.
Even the complier is written in java.The bytecodes are precisely defined and remain the same on allplatforms.The use of byte code  enables the java runtime system toexecute programs much faster.
The JVM is the core of the Java platform and is responsible for:

1. Loading bytecodes from the class files
2. Verifying the loaded byte codes
3. Linking the program with the necessary libraries
4. Memory Management by Garbage Collection
5. Managing calls between the program and the host environment.

Login Authentication using JSP, Servlet, MySQL in JAVA

In this example we will show you how to authenticate and login user against database username and password. This program consists of a JSP page and a Servlet to authenticate the user against database username and password.
User enters the username and password on the JSP page and clicks on the "Sign-In" button. On the form submit event, data is posted to the servlet for authenticating the user. Servlet makes JDBC connection and authenticate the user. Before submitting data to servlet, javascript is ensuring that none of the fields must be empty.
We are using tomcat server for running Servlet and JSP page. You can use any browser to test the application. We are using two files AuthenticLogin.jsp and LoginAuthentication.java and we are making the application in "webapps/JSPMultipleForms" in tomcat server.
Download Source Code 

Installing Apache Tomcat Server in Eclipse IDE

  1. If you do not have Apache Tomcat on your machine, you will first need to download and unzip Apache Tomcat (this scenario was written using Apache Tomcat version 5.0.28, but other versions can be substituted).
  2. Start the Eclipse WTP workbench.
  3. Open Window -> Preferences -> Server -> Installed Runtimes to create a Tomcat installed runtime.
  4. Click on Add... to open the New Server Runtime dialog, then select your runtime under Apache (Apache Tomcat v5.0 in this example):
  5. Click Next , and fill in your Tomcat installation directory :
  6. Ensure the selected JRE is a full JDK and is of a version that will satisfy Apache Tomcat (this scenario was written using SUN JDK 1.4.2_06). If necessary, you can click on Installed JREs... to add JDKs to Eclipse.
  7. Click Finish .