Posts Tagged ‘Eclipse’

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.

GlassFish integration with NetBeans, Eclipse and JDeveloper

9 August 2008

This is how GlassFish integrates with NetBeans 6.1, Eclipse 3.4 (Ganymede) and JDeveloper 11g.

NetBeans

NetBeans 6.1 provides out-of-the box integration as it is bundled with GlassFish.

Just keep the default setting “GlassFish V2 UR2″ enabled during installation process.

In this way GlassFish is automatically installed, configured and ready-to-use: simply press “Run” on any web project!

However, if you would like to declare another installation of GlassFish go to Tools → Servers → Add Server…

Select the proper version, specify the name and click “Next.

Provide the installation path of GlassFish through the “Browse” button and click “Next” to configure the password or “Finish” to complete.

That’s it!

Let’s create a simple web application to test it. Go to File → New Project… → Web → Web Application → Next → Specify the Project Name → Finish

The project should appear on the Projects tab. Edit the code of index.jsp and change <h2>Hello World!</h2> to <h2>Hello World from GlassFish!</h2>

Now simply right-click on the project and select “Run”!

Eclipse

If you are behind a proxy make sure you have properly configured the network settings for HTTPs also. Window → Preferences → General → Network Connections and make sure the option “Use this proxy server for SSL” is checked → Apply → OK → restart Eclipse.

Open the Servers view: Window → Show View → Other… → Server → Servers

On the Servers tab right-click → New → Server

Click on the “Download additional server adapters” link.

Click on the GlassFish Java EE Server option and press “Next”.

Afte reading and accepting the CDDL licence press “Finish” and OK at the prompt message. After a while Eclipse will restart.

Now go the Servers tab right-click → New → Server and select “GlassFish”.

Note: The plugin for brand new GlassFish v3 Technology Preview 2 is already available!

Select the version of GlassFish you have installed and press “Next”.

Provide the installation directory of GlassFish and click “Next”.

That’s it!

JDeveloper

JDeveloper has a really handy feature: deploy-on-demand.

Let’s assume we want to deploy a web application. In the Application Navigator right-click on the project → New… → General → Deployment Profiles

Select war and click “Next”.

After specifying the name, for example “wicket”, provide the hot-deploy directory of GlassFish through the “Browse” button.

That’s it!

To deploy the application simply right-click on the project → Deploy → wicket → to WAR file.