October 2007

Monthly Archive

How to control HTML element when it got focused

Posted by tonny.xu on 31 Oct 2007 | Tagged as: Java Tech

Today, a little bit difficult problem was resolved. The original question is like this:

  • Give a page which mainly contains 2 DIV areas and both have a table element inside it. Each of the DIV tag are set to hidden scroll bar, and these 2 tables are exactly have the same setting(cellspacing, cellpadding, etc. ), so that’s making these 2 tables looks like an excel file which have a freezeed  bar.
  • There are many select boxes and check boxes in these 2 tables, and each element has a tab index value assigned, so that, tab key will navigate element between 2 tables.
  • There is another div element to control the scrolling status and make them scroll at the same time and scroll to same place.(by capture onScroll event.)
  • The problems is when you navigate tab from element to element , the synchronize scroll will be failed.

I tried a lot of ways, and finally find out, the problem lies on the default focus properties deal by Browser itself, and the browser takes control of how to show the element no matter how you set its position properties. And as most of the web programmer will do, we choose to use onfocus event, and can not get the right thing done.

The way to resolve this problem is using another different event : onbeforeactivate

Here is the demo file, you can download it and try it yourself. May be you have a better way to resolve this problem, please let me know: tonny.xu[a]gmail.com

[Download the demo page which works well]

[Download the demo page which doesn't work as we thought]

How to import Maven Project to Eclipse with "pom.xml"

Posted by tonny.xu on 25 Oct 2007 | Tagged as: Java Tech

Struts 2.0.9 bundle shipped with a sample named show-case, if you want to use it in your Eclipse Europa, you need to add a Maven plugin for Eclipse Europa. Please visit this page:

After installed this plugin, you can read a project which shipped with pom.xml, but not normally build.xml. Please follow the steps:

  • Menu<File> ⇒ <Import…> ⇒ General[Maven 2 Project] ⇒ [Select the pom.xml File]

It will really cost you some time, maybe you can drink 2 cups+ coffee before you get your maven project work in your Eclipse. Have Fun.

Besides, because I installed some server adapters before I install Maven 2 Plugin, I had to reinstall Europa before I can use Maven plugin. So, I got a basic rule for eclipse user: Only install the plugin when you need it!

And moreover, the project you imported from Maven to Europa, you need to tweak a lot of configurations, and I suggest you just configure it manual than use Maven plugin.

The most simplest way to use Ant build file. ^_^

Why I can not find the Glassfish server adapter in my company’s computer?(First post after I came to Japan)

Posted by tonny.xu on 24 Oct 2007 | Tagged as: Java Tech

Today, I was preparing the development environment for the new coming project, after installed Eclipse Europa and Glassfish, I need to combine these 2 things together so that I can continue my job.

As usual, I clicked the link below, but this time, I can not find the Glassfish server adapter.

(Click the "Download additional server adapters")008

(Though you can see that I have added GlassFish server adapter, but I will show you where is wrong.)

After I clicked the link, it automatically searching and installing available server adapters for me. My company has a proxy server which is opened on port 8080 and can both serve HTTP and HTTPS, so I setup the proxy server for Eclipse, and I found Geronimo very fast, but, BUT, I can not find this god damn GlassFish server adapter!!

WHY? I have checked the GlassFish project home page, and they said, Europa will search GlassFish’s web site for the latest available plugin automatically, but why it don’t show itself to my Europa??? and at the same time, BEA’s server adapter is also missing from the available list.

Then I want to take a deep look into the Eclipse to find out whether those GlassFish guys really put their Web site URL to Europa, but to tell the truth, it’s not a easy work. I can not find out where they configure the necessary URL to search for. Then after I wasted few time to redo it again, Finally, Suddenly, I found out why!

BECAUSE Some sites used a SSL connection for their god damn update URL, and I didn’t configured to use proxy for SSL connection! While others are all using simply HTTP connection!

009

DAMN IT!

So, next time, don’t forget to set up your SSL connection proxy!