Learn, develop, play.

Hello world in PHP

So it’s time to start writing about PHP

Now we’ll write the first line of code in PHP.

[cc lang=”php”]


And now look at the code

< ? php – this is a sign for the server: the PHP code starts

echo “Hello world! This my first program!”; – echo command says display string.

? > – this is a sign for the server: the PHP code ends

Managed Beans in JSF and XHTML page

So, now we should connect bean with page.

Take this code:

public class HelloBean implements Serializable {

	//business logic and whatever methods...


Change it:

public class HelloBean implements Serializable {
	public String myMethod(){
            return "Hello!";


You can see that we change annotation Named and add one method, which return string “Hello!”  .

Now, show it on page.

<?xml version=”1.0″ encoding=”UTF-8″?>
<ui:composition template=”/WEB-INF/templates/default.xhtml”
<ui:define name=”content”>

<h1>#{mybean.myMethod()} Welcome!</h1>

You can see string “Hello! Welcome!” on our page.

To be continued!