search
top

Online HTML editor for JSP

Online HTML editor for JSP

A JSP CMS as any other CMS, needs a good content editor. InterAKT has unveiled their last version of KTML, 4.0, that comes now in a new flavor: JSP. This editor is very easy to integrate and offers a lot of very useful features. Quoting from InterAKT site:

KTML is an online HTML editor that helps you edit your website content directly in a browser. The editor loads fast and has an easy-to-use interface (similar to desktop editors). The latest version offers superior Word compatibility, a revolutionary Image Editor and XHTML 1.1 support. KTML has wide browser compatibility and supports most platforms (including MAC).

AJAX tools and toolkits – must have

As the AJAX is the buzz word of the day more and more developers are looking for a good tool for developing an AJAX application. But what are the tool’s features to be considered an AJAX development tool.

First let see an “AJAX ready” tools’ list, in no particular order:

  • Open AJAX group backed by BEA, IBM, Google, Oracle, Mozilla, Red Hat, Eclipse, and more. This is actually not a tool yet, is only an initiative but is worth keeping an eye on it.
  • Sun Studio Creator 2
  • MyEclipse 4.1 was released with Ajax support
  • IntelliJ IDEA
  • Microsoft Visual Studio 2005 – they are planing an add-on layer to ASP.NET but only for Atlas.
  • Eclipse WTP
  • JSEclipse from InterAKT

As we can see from the list, anyone that has a name in a WEB development related bussiness has jumped into the wagon.

From all this major players you may be wandering why I have included JSEclipse. Will see about that later.

What have come to my attention is that all this tools are AJAX ready because all have a JavaScript editor. There are too few other features to make one tool better in the AJAX development (I will not include here Visual Studio as I did not tested it yet).

Sun Studio Creator comes with AJAX JSF Components a library of AJAX components. This seems to be a nice addition.

So, with respect to JavaScript editing, JSEclipse seems to be a very good tool:

http://www.andrewwooldridge.com/blog/2006/02/jseclipse-powerful-javascript-editor.html
http://ajaxian.com/archives/jseclipse-javascript-editor-with-code-completion

Right now the AJAX tools market is new and while developers are still trying to figure out what web 2.0 is and how AJAX can help them to implement a web 2.0 application, the tool developers are also in a foggy place (just have come out of the dark) trying to understand the needs of their clients. What is certain is that AJAX means JavaScript and XML and while the XML will be generated by the server, the JavaScript must be written by somebody and that somebody will need a good JavaScript editor. That is how far the tool makers have gone. It is also sure that they will not stay here. This is only a transit station and the first one to arrive at destination will write history (aka “MAKE THE BIG BUCKS”).

Master of science in Web Services development

I have just finished my last exam for the master. Right now is the last sprint to the end, I have to make a paper and an application on Web services for a modern educational system.

I have decided to make a challenge out of this paper and write the application in C#. I’m a Java developer mostly and making it in JSP would render in me learning almost nothing out of it. So as the paper will start to progress I will try to post all my findings, all that I learn in this blog or maybe writing longer articles in the article section of this site.

Creating a beta testing group – JSEclipse"> Creating a beta testing group – JSEclipse

I’d just had the opportunity to create my first beta testing group.

For JSEclipse 1.5 release InterAKT opened on it’s site a new beta testing program to let JavaScript developers have an early preview on the next version and let the actual users become involved in shaping a great product.

JSP/Java – strip_tags() PHP like function

Another PHP function that is very used is strip_tags.
This function tries to return a string with all HTML tags stripped from a given string.

   1:      public static String strip_tags(String text, String allowedTags) {
   2:          String[] tag_list = allowedTags.split(",");
   3:          Arrays.sort(tag_list);
   4:   
   5:          final Pattern p = Pattern.compile("<[/!]?([^\\\\s>]*)\\\\s*[^>]*>",
   6:                  Pattern.CASE_INSENSITIVE);
   7:          Matcher m = p.matcher(text);
   8:   
   9:          StringBuffer out = new StringBuffer();
  10:          int lastPos = 0;
  11:          while (m.find()) {
  12:              String tag = m.group(1);
  13:              // if tag not allowed: skip it
  14:              if (Arrays.binarySearch(tag_list, tag) < 0) {
  15:                  out.append(text.substring(lastPos, m.start())).append(" ");
  16:   
  17:              } else {
  18:                  out.append(text.substring(lastPos, m.end()));
  19:              }
  20:              lastPos = m.end();
  21:          }
  22:          if (lastPos > 0) {
  23:              out.append(text.substring(lastPos));
  24:              return out.toString().trim();
  25:          } else {
  26:              return text;
  27:          }
  28:      }

JSP – htmlspecialchars() htmlentities() PHP like function – version 2.0

The search has continued and no solution has been found yet.

As I was not pleased with the performance of my previous approach I worked out the following one:

  
StringBuffer sb = new StringBuffer();
for(int i=0; i<content.length(); i++) {
  char c = content.charAt(i);

  switch (c) {
    case '<' :
      sb.append("&lt;");
      break;
    case '>' :
      sb.append("&gt;");
      break;

    case '&' :
      sb.append("&amp;");
      break;
    case '"' :
      sb.append("&quot;");
      break;
    case '\'' :

      sb.append("&apos;");
      break;
    default:
      sb.append(c);
    }
}
  
content = sb.toString();

This verision is a lot faster then the previous one. On the page source from the slashdot site this version performed in under 8ms while the other one had it’s best performance in 20ms (usually in the range of 30ms).

JSP – htmlentities() PHP like function

In PHP there is a very useful function: htmlentities().

What this function does is to replace < with &lt;, > with &gt; and so forth. This is very useful when editing into a page some html code stored inside a database.

I can not find something similar for JSP. If you are using Struts, there is no need for something like this, but if you are using plain JSP you may not be so fortunate.

So I approached this through brute force:

<%
content = content.replace("&", "&amp;");
content = content.replace("<", "&lt;");

content = content.replace(">", "&gt;");
content = content.replace("\"", "&quot;");
content = content.replace("'", "&apos;");
%>

But this is no elegant solution and I will try to find a better one. Do you know a better one?

How smart a book character can be.

I was watching the other day a movie. It’s not important what movie it was, what is important is the movie pictured a smart and cool character. Well… the problem was that I did not consider him to be quite so smart. There were certain situations where I thought he could have behaved better. :D Now I’m just bragging.

OK. But now let’s be serious about it. How smart a book character can be. Well, I guess, not smarter then the author who portray him. But a good book is not required to have a smart character. There are books written to be funny, to inspect the human mind or soul or whatever. But there are books in which the action revolves around a character, a strong character, a smart character. He defines the book.

I’m a S.F. fan and one of the characters that have impressed me is was Hari Sheldon from the Foundation series written by the Isaac Asimov. But hey, he was a university professor with a PhD in chemistry and with over 500 volumes written. So, I may say, quite a smart man. No wander his characters are very well written. And the list can continue.

Master of science in Web Services development – final examination

I’m about to finish the master courses in taking right now and I’ve just choose the subject for my final examination paper: Web services for a modern educational system. It sounds quite big and basically I have only a vague idea about what am I suppose to do. Wish me luck.

AJAX image gallery"> AJAX image gallery

I wanted to place on my site some pictures that I took at SIAB 2005. I thought at first to search for a free image gallery made in php but after that initial moment I have decided to create one myself.

So, today, to be “on the stre@m”, I’ve made an AJAX image gallery. It’s a simple and rough one but it has the nice feature of not refreshing the page content. The RPCs are made to a php page that reads the necessary informations from a database and delivers them back to the JavaScript.

And that is all for now. In time I will improve this utility on my site.
http://www.stratulat.com/hobby/gallery/

« Previous Entries Next Entries »

top