Summary for converting JHTML to JSP
Review Part 1 and Part
2 for details
- Create a J2EE Application
- If your new JSP pages will use components which are not part of the standard ATG
install these components will need to be loaded in order to get your
JSP pages working. This can be solved in 2 ways:
- Add the components to the j2ee application's config layer
- Keep the components in a separate Dynamo module and add that
module to the dependency list of your j2ee application's
META-INF/MANIFEST.MF file, thus (where 'Dating' is the module
we want to load) :
Manifest-Version: 1.0
ATG-Config-Path: config/
ATG-Required: Dating
- For each JHMTL page, create a new empty jsp page, then add the dspTaglib import for the
dsp jsp tag library and then add a pair of dsp:page tags with a few
lines between them, if your page is not a fragment just use the
provided JSP page template in the ACC
<%@ taglib uri="/dspTaglib" prefix="dsp"%>
<dsp:page>
<!-- content will go here -->
</dsp:page>
- Paste the original JHTML into the middle of the dsp:page tags
- Rename all the .jhtml links to point to the new .jsp files
- Comment out the declareparam tags
- Prefix all other JHTML tags with dsp:
- Replace all UPPERCASE attribute names with lowercase, since the JSP
tag attribute names are case sensitive e.g. VALUE= will not work,
whereas value= works correctly
- Ensure that dsp:input, dps:option and dsp:param tags are terminated with />
(content-less tags)
- Ensure all the attributes in the page are quoted e.g:
method=post should be method="post"
- Ensure that multiple select boxes define the multiple attribute as
follows:
multiple="<%=true%>"
- Replace all param:xxx tags with <%= request.getParameter('xxx')
%>
- Replace all droplet src= type includes with dsp:include
- Replace value="bean:xxx" sequences with bean="xxxx"
- Replace all remaining bean: tags with Java to extract the values from
scripting variables; either using the dsp:getvalueof tag or replacing
them with bean='xxx' (for Switch)
- Try to preview the page and replace all renamed attributes with the
ones specified in the error messages
Remember: User Appendix D of the page developers guide as a reference
and look into the jsp page templates that the ACC provides. In
tricky situations you'll need the dsp:getvalueof tag. This
important tag allows you to extract a param, a bean or a bean property and
store it in a java variable in the page script. See the docs in Appendix D
for more information To help speed things up I wrote these
UltraEdit macros, they DO NOT FINISH THE JOB!! They just do some of
the legwork so then I can go in an fix all the errors, not limited to:
- closing off the dsp:input, dsp:option, dsp:importbean and dsp:param
tags with />
- Doing any inline java like for param: going to request.getParameter....
- Adding any dsp:getvalueof tags that are needed
NOTE: OF COURSE YOU FOOLISHLY USE THESE MACROS AT YOUR OWN RISK!!! -
DON'T BLAME ME IF THEY DELETE ALL YOUR WORK
If something is not working don't forget to view the HTML source in the
browser, you may see unprocessed tags like param: or valueof in the HTML,
this is THE BEST WAY to find problems. Also remember to check the ATG
Dynamo error log, people often forget that!
Good luck
The JHTML Dating module is here the DatingJSP
module is here, the DatingJSP module depends
on the Dating module for repositories, targeters and other components.
You'll need to configure the database tables yourself, look up
startSQLRepository in the Dynamo docs for tips on how to do that base on
the supplied repository configuration files
|