File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes JSP 2 Tag Files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP 2 Tag Files" Watch "JSP 2 Tag Files" New topic
Author

JSP 2 Tag Files

Chris Snapp
Greenhorn

Joined: Nov 14, 2003
Posts: 16
So I'm attempting to use purely XML based JSP 2 tag files and I've bumped into a couple of problems. I'll toss a snippet of code to help with the explanation.

  • I'd like to dynamically generate an XHTML checkbox via a JSP tag that takes in parameters and determines whether to build the element with the "checked" or "disabled" attributes. I thought I could get away with throwing some <c:if> tags around the <jsp:attribute> tag but it fails with a nullPointerException. Anyone know how to choose what attributes are added to a <jsp:element> tag?


  • I'd like to pass a bunch of parameters in the body of a tag, this was easy when I was making the JSP tags using class files but I'm not sure how to pull it off with JSP tag files. Any pointers to info on this would be swell.


  • Any ideas on how I could place dynamic info inside of a CDATA tag on my JSP tag file would be greatly appreciated. Since the tag files are themselves XML documents, the dynamic pieces do not get rendered.



  • Any help on these problems would be greatly appreciated, hopefully I'm not pushing to much in one post.

    - Thanks all
    [ September 26, 2005: Message edited by: Chris Snapp ]
    Chris Snapp
    Greenhorn

    Joined: Nov 14, 2003
    Posts: 16
    Huh, I'm an idiot.....a simple fix for the javascript problem would be to escape the CDATA tags.....a'lika so:


    [ September 26, 2005: Message edited by: Chris Snapp ]
    [ September 26, 2005: Message edited by: Chris Snapp ]
    Bear Bibeault
    Author and ninkuma
    Marshal

    Joined: Jan 10, 2002
    Posts: 61426
        
      67

    XML based JSP


    May I ask why? This has come up a few times before. The XML syntax for JSP is meant to be used by the JSP containers as an intermediate format, or for machine-generated JSPs where it is useful to build up a DOM and serialize it, but it's certainly not meant as something humans should want to generate.


    [Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: JSP 2 Tag Files