2007年 1月 31日 水曜日
We just released a new version of
Pet Store 2.0.
Although the UI looks pretty much same, the codes were refactored
and we fixed a lot of bugs. Also this version of Pet Store includes
a new news.jsp which can be found when you click the left side
of the RSS bar.
and the news.jsp looks like:--
In the previous version of Pet Store 2.0, when you click this link it pops up another window to show the content of RSS feed, but now it guides you to the news.jsp which is one of the jsp page included in the package. There were a few problems in popping up the window, such as not working well with IE.
We also changed the logic to cache the RSS feed information in the server. Now it's caches data in an application scope so that all requests within the Pet Store context can share the same RSS feed information and both RSS bar and news.jsp use the same cached data.
The code in news.jsp(and the associated JavaScript) is very simple. Since the data is already constructed by ROME library on the server, it just consumes and rearrange the contents within the page.
Handling the strings in the RSS feed is a little tricky.
Because usually those strings in the feed contain characters which
are not usable in JSON, such as double quote, we need to 'escape' them
somehow. We use URL encoding for this purpose. We encode all strings
on the server side and decode them on the client's JavaScript.
However, as there's a slight difference between Java URL encoding
and JavaScript's URLencode() and URLdecode(), we needed to write
our own URLdecode() function for matching Java URL encoding mechanism.
Please
check this version of Pet Store 2.0
and let us know what you
think on the
forum.
Today's Page Hits: 35