JSP - Java Server Pages support

Let us know what you would like to see in the next version of this software

Moderator: kfury77

Forum rules
Please follow these guidelines when posting feature requests. This will help to increase the value of your contribution.
  • Do not create new topics for already requested features. Add your comments to the existing feature request topics instead;
  • Create separate topic for each feature suggestion. Do NOT post a number of non-related feature suggestions in a single topic;
  • Give your topic a meaningful title. Do NOT create topics with meaningless titles, such as "My Suggestion" or "My Problem".
Please note that we DO READ all suggestions, even if a reply is not posted. Thanks!
Post Reply
Damianosky

JSP - Java Server Pages support

Post by Damianosky »

:? I use this good product for the development of Java Server Pages, but they are not supported as native, and to get around this problem, i develop pages with the *.asp extension (i have also tricked the Tomcat 5 extension manager) and then save the final as *.jsp.

It is possible, i think, to avoid this more work in future release of the program?

Thanks in advance

Damiano Martorelli
User avatar
Karlis
Site Admin
Posts: 3605
Joined: Mon Jul 15, 2002 5:24 pm
Location: Riga, Latvia, Europe
Contact:

Post by Karlis »

This feature is planned for HTMLPad 2005. The problem is, that we have almost no good experience with JSP language thus it is hard to get started. Can you help with some samples?
Karlis Blumentals
Blumentals Software
www.blumentals.net
Damianosky

JSP...

Post by Damianosky »

:shock: Sorry for my late response, but I was very busy.

Well, JSP is not so different from Active Server Pages of Microsoft.
Only it is based on Java language, and not on Visual Basic.

I think that a first good entry level for JSP support is starting from the 2 main aspects of the JSP pages: scriptlets and custom tags.

Scriptlets are blocks of Java language into the HTML page (like ASP ones...), which can refer to Java built-in objects, or custom ones. For example:

<%
String id = request.getParameter("id");

if (id != null) session.setAttribute("MAINMENU_ID", mid);
%>

Both request and session are built in objects of the JSP: here I retrieve the id parameter from a POST or GET submission, and check if is or not null. If not, I set a session parameter called MAINMENU_ID.

As you can see, a block is included into the <%...%> delimiters.

Custom tags are a more powerfull (and complex) aspect, because we can define custom tags with can set or get data from the page or session or application (three levels of visibility: a more one is the current request) and manipulate data or retrieve data from a database, and so on...

Every tag is defined in a Java class, which on a web server (like Tomcat, which i use) is in a special directory of the web server itself, the WEB-INF, as a class in the /classes subdirectory or as a library (which includes all classes) in the /lib subdirectory. In the /tlds subdirectory are stored the xml files (with .tld extension) which defines the tags, their properties and the java classes wich implements the behaviour. In a special file, called WEB.XML in the WEB-INF directory, are stored the references to all *.tld files which defines the custom tags.

Just as example, in the following you see a part of the log.tld file of the LOG tags library of the Jakarta project:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>log</shortname>
<uri>http://jakarta.apache.org/taglibs/log-1.0</uri>
<info>[bla...bla...bla]</info>
<tag>
<name>info</name>
<tagclass>org.apache.taglibs.log.InfoTag</tagclass>
<attribute>
<name>category</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>message</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>

This defines the tag <info> with his parameters (because the field required is set to false, this are not mandatory). I don't enter too much in explanations now, because it is only as example: in the WEB.XML file this tld file can be defined like:

<webapps>
[...]
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/log-1.0</taglib-uri>
<taglib-location>/WEB-INF/tlds/jakarta/log.tld</taglib-location>
</taglib>
</webapps>

and then, in the JSP page where i want to use the custom tag <info> I can write like this at the top of page (I must respect the definition in the WEB.XML file):

<%@ taglib uri="http://jakarta.apache.org/taglibs/log-1.0" prefix="log" %>

and then into the page:

<!--
<log:info>Loading...</log:info>
-->

When the web server read the jsp pages, it reads the tld files specified at the top of page, assigning the uinque name log as tag identifier (to avoid name conflicts between more libraries): when it compiles on runtime, it checks that the tag respects the parameters condition, and then executes the tag behaviour as specified in the org.apache.taglibs.log.InfoTag class.

In this case, in the log of the web server the 'Loading...' message is written.

I understand that probably it seems so hard, and it is really so if you takes this few words... But I think also that it is not necessary to have at start so much features... The checking of the correct tag opening and closing, and of the scriptles well formatting can be a very good point of start for your software.

At the moment, only Macromedia Dreamweaver probably gives some support of custom tags, but I've stopped to use it at version 4, so I don't know about MX versions...

If you think it can be usefull, I can give you some support for JSP aspect: I'm not a guru. Let me know.
See you soon

Damiano Martorelli
multifarious
Posts: 32
Joined: Tue Feb 05, 2008 4:40 pm
Location: Amsterdam
Contact:

Re: JSP - Java Server Pages support

Post by multifarious »

sooo, what's the status on thisone?
Patrick Kanne - webmaniac
- as we fail to imagine, we are punished with reality
Post Reply