gamelan
Search EarthWeb
CodeGuru | Gamelan | Jars | Wireless | Discussions
Navigate developer.com
Architecture & Design  
Database  
Java
Languages & Tools
Microsoft & .NET
Open Source  
Project Management  
Security  
Techniques  
Voice  
Web Services  
Wireless/Mobile
XML  
New
 
Technology Jobs  

   Developer.com Webcasts:
  The Impact of Coding Standards and Code Reviews

  Project Management for the Developer

  Defining Your Own Software Development Methodology

  more Webcasts...




See The Winners!




Developer Jobs

Be a Commerce Partner














 


Developer News -
Adobe Flash Player 10 Gets Ready to Mobilize    June 23, 2009
Ruby Use Grows Among U.S. Developers    June 23, 2009
Zimory Adds to Open Source-Powered Cloud Tools    June 18, 2009
Amazon Gives Away More Kindle Source    June 17, 2009
Free Tech Newsletter -

Extend Your Java Studio Creator Options with JSTL
By Dick Wall

Go to page: Prev  1  2  3  

Deploying a JSTL Enabled Web App

Deploy to Sun App Server PE 8

There are no special steps to deploy this project to the Sun App Server 8 PE. All JSTL libraries necessary to support this project are already provided.

Deploy to Another App Server (Tomcat)

Depending on the App Server you are deploying to, JSTL may not be available in the standard libraries included for that App Server, or it may include an earlier version of the JSTL libraries that is incompatible. For example, Tomcat needs the JSTL libraries to be added to the project that is deployed before it will work.

To include JSTL in the built project WAR file, proceed as follows:

  • Right-click on the Library References section in the project navigator, and select Create New Library Reference.
  • Set the library name to JSTL.
  • Click the add button on the class libraries tab.
  • Navigate to your Creator installation directory, and find the modules/autoload/ext directory.
  • Select both jstl.jar and standard.jar (CTRL-click to select multiple), then click open.
  • Back in the dialog, uncheck the design boxes for both jars, but ensure that the deploy boxes are still checked.
  • Click OK.

This has already been done in the accompanying demo project for this article. Note how, when you select the jars, Creator automatically fills in the {tools.home} path variable, which allows the project to work on other machines with different install locations.

Gotchas

JSTL Nesting Problems

Creator does nesting rule checking, and this is normally a help, but when using JSTL it prevents some common usages of JSTL conditionals nesting.

For example, when I was writing this code for my real project, I actually wanted to highlight the row by changing the background color, doing something like this:

<c:choose>
   <c:when test="${status == -1}">
      <tr bgcolor="red">
   </c:when>
   <c:otherwise>
      <tr bgcolor="green">
   </c:otherwise>
</c:choose>

... rest of table row code here ...
</tr>

Okay, so the default red and green colors for the background might be a bit garish, but the intent is clear, and this is a pattern I have used many times before with the struts tags. However, in practice this fails to compile in Creator because it sees that the nesting of the <tr> and <c:...> tags are messed up (it wants the </tr> paired to the <tr bgcolor>, instead it gets a </c:when> tag first).

This limits what you can do with JSTL inside of Creator at present; hopefully, this will be changed soon to allow more flexibility, but in the meantime you can probably find ways to code around these limitations. If you do find an easy way to color the rows in the manner I was trying above, please let me know and I will incorporate it into a future article (giving you full credit, of course).

Conclusion

Whereas the use of JSTL inside of Creator certainly has its warts, it can be a very useful tool to provide more capability than the Creator controls do on their own. In the past, I have included JavaScript-based tool-tips for rows and cells. Also, the capability of having a scrolling table body is pretty nice. (Note to the Creator guys: Can we have this in a future version of the grid control, please?)

If you have any questions or comments about this or the other articles I have written, please feel free to contact me; Developer.com provides a mechanism to do so.

About the Author

Dick Wall is a Lead Systems Engineer at NewEnergy Associates, a Siemens Company based in Atlanta, GA that provides energy IT and consulting solutions for decision support and energy operations.

Go to page: Prev  1  2  3  


Tools:
Add www.developer.com to your favorites
Add www.developer.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed


Enterprise Java Archives






internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs