January 2007

You are currently browsing the monthly archive for January 2007.

In using Dojo, I tried to return an XML String from the server side, and parsed it in the javascript. This is the code portion for making the AJAX call:

retrieveUserDetail = function(id) {
// Use dojo.io.bind() for remoting
dojo.io.bind({
// URL -  destination you want to send your request
url: “validate?id=” + escape(data.Id),

// Callback function that will be invoked asynchronously
load: function(type, data, evt){ processRetrieval(data);},

// Error handler function that will be invoked in case of an error
error: function(type, error){ alert(”error”); },

// Backward and forward button handling
backButton: function() { alert(”back button pressed”); },
forwardButton: function() { alert(”forward button pressed”);},

// Type of data you want to receive
mimetype: “text/xml”
});
}

processRetrieval = function(data) {
var message = data.getElementsByTagName(”loginName”)[0].childNodes[0].nodeValue;
var userId = dojo.byId(”fUserId”);
userId.value = message;
userId.disabled = “true”;
}

As specified, I used mimetype in the dojo.io.bind() function. This works in Firefox perfectly, but in Internet Explorer, it does not work. IE will recognize the responding result as plain text. As a result, you have to explicitly declared in the server side telling that the result is in XML format. For me, I am developing Java Web Application, so I used this in the servlet:

response.setContentType(”text/xml”);

By doing this, IE will recognize the result as XML document.

Reference:
http://dojotoolkit.org/pipermail/dojo-checkins/2007-January/015183.html 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

Struts Validation

Today, I’m learning about the Validation Framework incorporated in Struts.

After setting and running the application using validation, I got a weired NullPointerExceptionn. After surfing the Q&A on the Internet, I got this.

“Wrong package name”

The package for importing the new Action Form should be

org.apache.struts.validator.DynaValidatorForm

not

org.apache.struts.action.DynaValidatorForm

so Take Care!!

Reference:

http://wiki.wsmoak.net/cgi-bin/wiki.pl?Struts/DynaValidatorFormError

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

See. Here is my certificate from the teacher, Mr. Sang Shin

CertAJAX

http://www.javapassion.com/ajax/certificates1/HarryNgCheukKeung.jpg

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

As JPA is providing the interface to connect your Java application to the database, it is supposed to be just an interface doing so. In the other words, you have freedom in managing your database, by changing the DB-specific parameters and tuning the database.

In MySQL, as most people should know, there provides a choice of storage engine on each table. By using JPA, you can let the persistence provider to generate the table for you. It is easy and let the persistence provider determine the suitable configuration for you, both on table and on each field.

The default storage engine for table is InnoDB, as it supports transaction, row-locking and foreign keys where are needed by JPA. However, if you have a table that needs performance rather than data accuracy, you can manually change the storage engine to MyISAM before or after the persistence provider’s decision.

You can stop the persistence provider from generating the table, which you build your own table first, and just simply mapped all the things to the Entity.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

I’m just starting the development of applications using Java Persistence API (JPA). In fact, the most challenging thing comes up to me at my start, the compatibility of IDE.

JPA is co-developed by the team of JavaEE 5 Specification Group, as a replacement to the heavy-weighted Entity bean. Until now, there are limited IDE that supports the development of JavaEE, especially EJB 3.0. Two of them are Sun Netbeans and Oracle JDeveloper. Both of them are free, but not open-sourced IDEs.

I personally use Eclipse as my primary development tool, thus quite familiar with the functionalities within. However, Eclipse for now just provides a plugin project named “Dali” for the development of Java Persistence. However, Dali have lots of bugs and seems suspended from Aug, 2006. That’s why it’s not a good choice to use.

Instead, in order to develop JPA easily and still use Eclipse as my major platform, I have the following methods.

  1. Develop JPA related things in Netbeans, including the Entity itself and the configuration of persistence.xml file
  2. Export those Entities and required settings to JAR file using Ant Script
  3. Import the JAR file and other required libraries into Eclipse
  4. In Eclipse, just like developing usual applications, and for the persistence part, call the methods of Entity.

This is not a very good method, since there are so many troubles in between. But at least, it helps me to do more with JPA easily

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

Quoted from Thea Burger’s Blog 

Want to change your default View Source editor from Notepad to say Notepad2?

Run REGEDIT, follow the following directions to the proper key.

HKEY_LOCAL_MACHINE
|- Software
|– Microsoft
|— Internet Explorer
|—- View Source Editor
|—– Editor Name (Default) = C:\windows\notepad.exe

If this doesnt exist (but it should) then create the Key “View Source Editor”.
Then create a Key within that named “Editor Name”. Modify the “(Default)” value to make it point towards any program on your computer using “D:\Tools\Notepad2\Notepad2.exe” (without the brackets).
[Open Tech Support]

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

Eclipse Profiler

Is there a good method to analyze a large amount of code, by providing a flatten, simple and clear diagram, telling you the relationship of classes and the call stack, also the ad-hoc status of each particular object? Eclipse Profiler may be one of the tools.

There is recently an article on TheServerSide introducing this free plugin of Eclipse. Go and take a look:

Code Analysis with the Eclipse Profiler by Peter Dawson

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

I have finished a previous online course on AJAX, my name is already shown in the Graduate List. I am one of the two persons from Hong Kong. Find me inside:

http://www.javapassion.com/ajaxcodecamp/graduates.html

Anyway, just a chance for me to explore AJAX, not yet to be in development use.

This time, I joined another online course talking about JavaEE. Actually I want to look at the EJB part, which gives me more examples in the new EJB3 era. My short period target is to manipulate EJB 3 well, at least produce some small projects using it. EJB is a fantastic technology which I believe it will be useful for me in the future.

Go to the JavaEE Programming Website and take a look

http://www.javapassion.com/j2ee/index.html

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • Technorati
  • YahooMyWeb

« Older entries

 

January 2007
S M T W T F S
« Dec   Feb »
 123456
78910111213
14151617181920
21222324252627
28293031  

Categories