Starting with comments

08:47 Unknown 0 Comments


·         Starting with details of our java programming structure.
·         First is comments.
·         Comments are used in programming for textual description of code.
·         Comments are always ignored by compiler.
·         Writing comments in programming is optional but for our better understanding of we are writing.
·         Comments are of three types and they are

ü  Single line comments
Syntax:    //-----------------------------------

ü  Multiple line comments
Syntax:             /*-------------------
-----------------*/

ü  Documentation comments
Syntax:      /**----------------
          -------------------
          -------------------*/


Program:
 

0 comments:

Declaration of Java file

08:44 Unknown 0 Comments


·         Starting with our source file of java in which we are writing our java code.
·         Java source file saved with .java extension.
·         Some rules while declaring the source file as follows,

ü  A source file can have only one public class.
ü  Source file can have any number of non-public classes
ü  If the source file contains public class then file name must match with public class name.
ü  If the source file does not contain public class then there is no naming restrictions to file name.
Example
1)      X.java

public Class X
{
===========              
}
3)      Y.java

public Class Y
{
============          
}
2)        Z.java

Class A
{
========                 
}

Class B
{
========
}

4)      R.java

 Class Z
{
============
}

 Class Y
{
=============
}

NOTE: For every source file of java .class file will be generated.

0 comments:

Introducing programming structure of JAVA

08:42 Unknown 0 Comments

·         Basically we are learning java through programming but for understanding we are defining some terms in Java.
·         So starting small history Java was developed in 1995 by James Gosling and three more at Sun Micro systems but now it is owned by Oracle Corporation.
·         Now starting with our programming manner structure of Java Program…

Structure of JAVA Program

//Program for test
Import java.lang.*;
Class Test
{
                /**
                @author Student
                **/
                public static void main(String argd[])
                {
                                System.out.println(“---------Test----------”);
                }
}

Starting with every programming language we have seen ‘Hello World’ program but behind every program what actually is we will be looking for that.

Now in above program,
·         “//” Comments
·         “import”  is keyword.
·         “java”   is package.
·         lang” is sub package
·         “*” represents all classes and interfaces in that package
·         “Class” is also keyword.
·         “Test”  is identifier(Name of class).
·         “ public“ is access modifier.
·         “static “ is modifier.
·         “void“ is return type of main method.
·         “String” is predefined class.
·         “args[]“ is array of object reference.
·         “System” is library class.
·         “out” is object reference.
·         “println” is predefined method.
·         “-------Test---------” is string literal.


So this is only we have introduced in program what is but what is actual functionality of each we will be learning in next sessions…

0 comments:

IBM Cloud Social and Mail

05:15 Unknown 0 Comments

0 comments:

Cloud Computing: What is Cloud Computing?

05:08 Unknown 0 Comments

0 comments:

JSF Life Cycle

23:14 Unknown 0 Comments

      JSF life cycle consist of following phases,

Ø  Restore view phase
Ø  Apply request values phase
Ø  Process validations phase
Ø   Update model values phase
Ø  Invoke application phase
Ø  Render response phase




1. Restore view phase

JSF begins the restore view phase as soon as a link or a button is clicked and JSF receives a request. During this phase, the JSF builds the view, wires event handlers and validators to UI components and saves the view in the FacesContext instance. The FacesContext instance will now contains all the information required to process a request.

2. Apply request values phase
After the component tree is created/restored, each component in component tree uses decode method to extract its new value from the request parameters. Component stores this value. If the conversion fails, an error message is generated and queued on FacesContext. This message will be displayed during the render response phase, along with any validation errors.
3. Process validations phase
During this phase, the JSF processes all validators registered on component tree. It examines the component attribute rules for the validation and compares these rules to the local value stored for the component.
4. Update model values phase
After the JSF checks that the data is valid, it walks over the component tree and set the corresponding server-side object properties to the components' local values. The JSF will update the bean properties corresponding to input component's value attribute.
5. Invoke Application Phase
During this phase, the JSF handles any application-level events, such as submitting a form / linking to another page.
6. Render response phase
During this phase, the JSF asks container/application server to render the page if the application is using JSP pages. For initial request, the components represented on the page will be added to the component tree as the JSP container executes the page. If this is not an initial request, the component tree is already built so components need not to be added again. In either case, the components will render themselves as the JSP container/Application server traverses the tags in the page. After the content of the view is rendered, the response state is saved so that subsequent requests can access it and it is available to the restore view phase.

Reference:Book@tutorialspoint.com



0 comments:

How to write simple code in jsf with XHTML

04:17 Unknown 0 Comments

While writing code in jsf we are using

1.Xhtml front end design code.
2.Bean class in java.

1.Simply we are writing code as
Example :
<html>
<head>
< title>Test Jsf page<title>
</head>
<body>
Hello #{test.name}
<body>
</html>
Save with .xhtml extension


2.Java Bean Class
This class is nothing but reusable component class.It uses annotation(@) to provide additional information about class.
For above example :

@Name("test")
public class Test
{

  private String name="Robot";

  public void setName(String Name)
  {
       this.name=Name;
  }

  public String getName()
  {
       return name;
  }

}


Here  #{test.name} represents expression in JSF which maps front end value with java bean class.





0 comments:

What is JSF?

01:57 Unknown 0 Comments

JSF(Java Server Faces)

It is server side reusable user interface component framework  for developing java based web applications.We can also say like JSF is J2EE(Java Enterprise Edition) web user interface framework that is it is used while developing any web application using J2EE.Web application means it follows client server computing such that client runs an application on web using browser.Simply JSF can be use for designing GUI(graphical user interface) on server side.

But what is Client and Server?

  • Client is one which sends request to server for getting service.
  • Server is one which receive that request,process that request and response back to client about that request.

0 comments: