Archive for August, 2008

Wicket 4: Make a page in Eclipse

31 August 2008

This is part 4 of a series about Wicket. For setup see part 1.

Let’s see how easy is to create a wicket page in Eclipse.

We’d like a simple page that shows the current date and time:

package nikos;

import java.util.Date;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;

public class MyDate extends WebPage {
   public MyDate() {
      add(new Label("date", new Date().toString()));
   }
}

To create the HTML right-click on the project → New → Other… → Web → HTML

In the “New HTML Page” dialog give the name MyDate.html, open the src directory and select the package name.

This is some sample markup.

<html>
   <body>
      <h2 wicket:id="date"></h2>
   </body>
</html>

That’s it! Deploy it to see the result.

Review

In Eclipse we place the .html file in the same folder with the .java file.

Then, during deployment, Eclipse automatically bundles the HTML file in it’s proper position: along with the class file.

Free Ruby course

29 August 2008

Ruby is easy to learn and a robust 100% object-oriented language.

There is an excellent introductory 8-week course of high educational quality at RubyLearning.org. Moreover it’s free.

Ruby enthusiasts from all over the world are really having fun there.

References

Kursus Ruby yang gratis

29 August 2008

Ruby adalah sebuah bahasa pemograman komputer yang menyenangkan untuk belajar dan 100% objek orientasi.

Di situs RubyLearning.org ada kursus selama 8 minggu yang qualitasnya bagus sekali. Apalagi gratis.

Di sana bisa menemukan orang2 yang senang sekali sama Ruby, yang belajar Ruby sambil santai!

Informasi

Δωρεάν μαθήματα Ruby

28 August 2008

Η Ruby είναι μια ευχάριστη, 100% αντικειμενοστραφής γλώσσα φτιαγμένη για ατέλειωτο παραγωγικό programming.

Στο RubyLearning.org υπάρχει μια εξαιρετική σειρά μαθημάτων που διαρκεί 8 εβδομάδες.

Αξίζει τον κόπο!

Σύνδεσμοι

Wicket 3: Make a page in NetBeans

26 August 2008

This is part 3 of a series about Wicket.

Wicket is an enjoyable framework so it fits well in NetBeans IDE.

It’s trivial to create your pages without even a plugin. For setup information you may recall part 1.

Without plugin

Assume the page Hello that of course IS-A WebPage.

package nikos;

import org.apache.wicket.markup.html.WebPage;

public class Hello extends WebPage {
   public Hello() {
   }
}

To create its associated HTML file right-click on the project → New → HTML…

Provide the same name Hello, select Source Packages as the location and click Browse…

Just select the folder with the package name, here nikos. As a result Hello.html and Hello.class will be deployed in the same directory!

Here’s the simple page.

<html>
   <body>
      <h1 wicket:id="label"></h1>
   </body>
</html>

Thus we don’t specify any value for the <h1> element. Instead we provide a wicket:id.

Let’s return to the class for some action.

package nikos;

import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;

public class Hello extends WebPage {
   public Hello() {
   String value = "Hello from Wicket in NetBeans!";
      add(new Label("label", value));
   }
}

The value string may be retrieved by the database, by user input on another page, by the invocation of a remote method etc. The important thing is that we have only to maintain pure Java code.

Conclusion

Wicket’s single requirement is that the .html file and the .class file are bundled in the same directory. That’s trivial to accomplish in NetBeans.

Review

Assume a page with the name Hello.

  • It consists of an html and a java file with the same name.
  • Hello.java has only java code.
  • Hello.html has only html markup.
  • As for deployment, Hello.html is placed in the same directory with Hello.class.