You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by Lavandowska <fl...@yahoo.com> on 2001/07/11 19:31:19 UTC

[Proposal] Change to News section on Taglibs homepage

In the News section of http://jakarta.apache.org/taglibs/ the
blue used to name the tag in question ([jsptl] for example) always
makes me think its a hyperlink.

The following change to /src/doc/stylesheets/taglibs.xsl makes the
[libname] a link to the tag's intro.html page.

cvs -d :pserver:anoncvs@jakarta.apache.org:/home/cvspublic diff
jakarta-taglibs/src/doc/stylesheets/taglibs.xsl
Index: jakarta-taglibs/src/doc/stylesheets/taglibs.xsl
===================================================================
RCS file:
/home/cvspublic/jakarta-taglibs/src/doc/stylesheets/taglibs.xsl,v
retrieving revision 1.8
diff -r1.8 taglibs.xsl
301c301,302
<            <font size="-1" color="3333FF">[<xsl:value-of
select="@libname"/>]</font>
---
>             <xsl:variable name="lowerLibname"
select="translate(@libname, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')"/>
>             <a href="doc/{$lowerLibname}-doc/intro.html"><font
size="-1" color="3333FF">[<xsl:value-of select="@libname"/>]</font></a>

Lance


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Re: String taglib proposal

Posted by Lavandowska <fl...@yahoo.com>.
I've never seen "capitalise" before (and I'm an American).
According to dictionary.com, it isn't a word
http://www.dictionary.com/cgi-bin/dict.pl?term=capitalise

However, this doesn't eliminate the need for some form of agreement on
this issue.  I guess we could take the W3C as an indicator, seeing that
it uses "color" and not "colour" in HTML tags...

Lance

--- Shawn Bayern <ba...@essentially.net> wrote:
> Hmmm.  Perhaps we need a mechanism for internationalizing (or
> internationalising) the TLD?  :)
> 
> Shawn
> 
> On Thu, 12 Jul 2001, Mark Roth wrote:
> 
> > Bayard,
> > 
> > I'm sort of a background listener on taglibs-dev, but I couldn't
> help
> > but notice you chose the British spelling of capitalize.  Is this
> > intentional?  :)
> > 
> > --
> > Mark Roth, Java Software
> > Sun Microsystems, Inc.


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

Re: String taglib proposal

Posted by Shawn Bayern <ba...@essentially.net>.
Hmmm.  Perhaps we need a mechanism for internationalizing (or
internationalising) the TLD?  :)

Shawn

On Thu, 12 Jul 2001, Mark Roth wrote:

> Bayard,
> 
> I'm sort of a background listener on taglibs-dev, but I couldn't help
> but notice you chose the British spelling of capitalize.  Is this
> intentional?  :)
> 
> --
> Mark Roth, Java Software
> Sun Microsystems, Inc.
> 
> 
> bayard@generationjava.com wrote:
> > 
> > This seems like too basic an idea to not have been thought of and dealt
> > with already, but I'll give it a go anyway.
> > Someone recently asked me if there were anymore String functions in Java
> > (He was a PHP guy doing JSP). I told him to search the web, but after a
> > while looked myself and realised nothing seemed to leap out.
> > 
> > So I wrote a String library. However it turned out, being a PHP person in
> > JSP, he really wanted it as a taglib. So I wrote a taglib wrapper around
> > the String library.
> > 
> > There are about 30-odd 'functions' in the taglib, each one of the form:
> > 
> > <ns:string action="capitalise">word</ns:string> => Word
> > <ns:string action="replace" replace="fred" with="bob">Hello fred</ns:string>  =>   Hello bob
> > 
> > That is, I use an action attribute rather than different tag names. The
> > reason for this was to stop there being 30 different tag classes, each
> > with about one line of implementation.
> > 
> > Onto my questions:
> > 
> > 1) Does this seem to be of use? I would love to submit the code to Jakarta
> > Taglibs.
> > 
> > 2) What are the views on my use of an action attribute. Is it sick and
> > wrong?
> > 
> > 3) What's the best way to document this to show all the functionality? Due
> > to the action attribute my tld is pretty simple. However the String
> > library's JavaDoc doesn't really fit the bill. Should I create a html page
> > that follows the general documentation l&f of the jakarta pages?
> > 
> > 4) Should I stop wasting everyone's time? :)
> > 
> > Thankyou,
> > 
> > Bayard
> > 
> > http://www.generationjava.com
> 


Re: String taglib proposal

Posted by ba...@generationjava.com.
Okay,

I took the advice and created a tld input to some existing generation
code of mine so it outputs Tags from a tld. Allowed me to speed up
the development a lot so thanks for the idea.

You can grab a copy of the String tld,jar,src from:

http://www.generationjava.com/java/StringTaglib.shtml

Testing so far has been pretty negligent. I'll make an example page next
to serve as a test. 

I'm expecting the main problems to be when tags are used without all the
attributes being specified. I've not added the code to deal with cleaning
up after that yet, or picking default values if necessary.


Thanks for the help and attention,

Bay


Re: String taglib proposal

Posted by Mark Roth <ma...@east.sun.com>.
Bay,

Don't feel obligated.  Though I think it's the norm, I don't believe
there are any specific standards that people need to spell in American
English.  It just looked weird to me :)

Mark

bayard@generationjava.com wrote:
> 
> Sorry, completely unintentional. I feel I should get points for getting
> 'center' right :)
> 
> I assume that american spelling is used by default? I'll change
> capitalise.
> 
> Bay
> 
> On Thu, 12 Jul 2001, Mark Roth wrote:
> 
> > Bayard,
> >
> > I'm sort of a background listener on taglibs-dev, but I couldn't help
> > but notice you chose the British spelling of capitalize.  Is this
> > intentional?  :)
> >
> > --
> > Mark Roth, Java Software
> > Sun Microsystems, Inc.
> >

--
Mark Roth, Java Software
Sun Microsystems, Inc.

Re: String taglib proposal

Posted by ba...@generationjava.com.
Sorry, completely unintentional. I feel I should get points for getting
'center' right :)

I assume that american spelling is used by default? I'll change
capitalise.

Bay

On Thu, 12 Jul 2001, Mark Roth wrote:

> Bayard,
> 
> I'm sort of a background listener on taglibs-dev, but I couldn't help
> but notice you chose the British spelling of capitalize.  Is this
> intentional?  :)
> 
> --
> Mark Roth, Java Software
> Sun Microsystems, Inc.
> 


RE: String taglib proposal

Posted by Nick Sharples <ni...@eejits.net>.
:)

> I'm sort of a background listener on taglibs-dev, but I couldn't help
> but notice you chose the British spelling of capitalize.  Is this
> intentional?  :)

Being British myself, I've no objections (objectionz) to this.

On a more general note though, I've been wondering for a long time whether
it is (iz) generally accepted that `American` is the global language for
software development?

Shakespeare would turn in his grave.

Cheerz,
Nick



> -----Original Message-----
> From: Mark.Roth@Sun.COM [mailto:Mark.Roth@Sun.COM]On Behalf Of Mark Roth
> Sent: 12 July 2001 19:12
> To: taglibs-dev@jakarta.apache.org
> Subject: Re: String taglib proposal
>
>
> Bayard,
>
>
> --
> Mark Roth, Java Software
> Sun Microsystems, Inc.
>
>
> bayard@generationjava.com wrote:
> >
> > This seems like too basic an idea to not have been thought of and dealt
> > with already, but I'll give it a go anyway.
> > Someone recently asked me if there were anymore String functions in Java
> > (He was a PHP guy doing JSP). I told him to search the web, but after a
> > while looked myself and realised nothing seemed to leap out.
> >
> > So I wrote a String library. However it turned out, being a PHP
> person in
> > JSP, he really wanted it as a taglib. So I wrote a taglib wrapper around
> > the String library.
> >
> > There are about 30-odd 'functions' in the taglib, each one of the form:
> >
> > <ns:string action="capitalise">word</ns:string> => Word
> > <ns:string action="replace" replace="fred" with="bob">Hello
> fred</ns:string>  =>   Hello bob
> >
> > That is, I use an action attribute rather than different tag names. The
> > reason for this was to stop there being 30 different tag classes, each
> > with about one line of implementation.
> >
> > Onto my questions:
> >
> > 1) Does this seem to be of use? I would love to submit the code
> to Jakarta
> > Taglibs.
> >
> > 2) What are the views on my use of an action attribute. Is it sick and
> > wrong?
> >
> > 3) What's the best way to document this to show all the
> functionality? Due
> > to the action attribute my tld is pretty simple. However the String
> > library's JavaDoc doesn't really fit the bill. Should I create
> a html page
> > that follows the general documentation l&f of the jakarta pages?
> >
> > 4) Should I stop wasting everyone's time? :)
> >
> > Thankyou,
> >
> > Bayard
> >
> > http://www.generationjava.com
>


Re: String taglib proposal

Posted by Mark Roth <ma...@east.sun.com>.
Bayard,

I'm sort of a background listener on taglibs-dev, but I couldn't help
but notice you chose the British spelling of capitalize.  Is this
intentional?  :)

--
Mark Roth, Java Software
Sun Microsystems, Inc.


bayard@generationjava.com wrote:
> 
> This seems like too basic an idea to not have been thought of and dealt
> with already, but I'll give it a go anyway.
> Someone recently asked me if there were anymore String functions in Java
> (He was a PHP guy doing JSP). I told him to search the web, but after a
> while looked myself and realised nothing seemed to leap out.
> 
> So I wrote a String library. However it turned out, being a PHP person in
> JSP, he really wanted it as a taglib. So I wrote a taglib wrapper around
> the String library.
> 
> There are about 30-odd 'functions' in the taglib, each one of the form:
> 
> <ns:string action="capitalise">word</ns:string> => Word
> <ns:string action="replace" replace="fred" with="bob">Hello fred</ns:string>  =>   Hello bob
> 
> That is, I use an action attribute rather than different tag names. The
> reason for this was to stop there being 30 different tag classes, each
> with about one line of implementation.
> 
> Onto my questions:
> 
> 1) Does this seem to be of use? I would love to submit the code to Jakarta
> Taglibs.
> 
> 2) What are the views on my use of an action attribute. Is it sick and
> wrong?
> 
> 3) What's the best way to document this to show all the functionality? Due
> to the action attribute my tld is pretty simple. However the String
> library's JavaDoc doesn't really fit the bill. Should I create a html page
> that follows the general documentation l&f of the jakarta pages?
> 
> 4) Should I stop wasting everyone's time? :)
> 
> Thankyou,
> 
> Bayard
> 
> http://www.generationjava.com

Re: VOTE: adding string taglib to jakarta-taglibs (Re: String taglib proposal)

Posted by Pierre Delisle <pi...@sun.com>.

> adding string taglib to jakarta-taglibs

+1


> Bay being a committer so he can maintain his work inside
> jakarta-taglibs.

+1

    -- Pierre

Re: VOTE: adding string taglib to jakarta-taglibs (Re: String taglib proposal)

Posted by Rich Catlett <ri...@more.net>.
This sounds good to me +1 to both.

Glenn Nielsen wrote:

>James Strachan wrote:
>
>>I'd like to call a vote to add Bay's excellent string taglib to
>>jakarta-taglibs CVS and add Bay as a comitter so he can maintain the taglib
>>in the jakarta-taglibs project.
>>
>>You can browes Bay's work here:-
>>
>>http://www.generationjava.com/java/StringTaglib.shtml
>>
>>To get the ball rolling, I'm
>>
>>+1 on adding string taglib to jakarta-taglibs
>>
>
>+1 
>
>>+1 on Bay being a committer so he can maintain his work inside
>>jakarta-taglibs.
>>
>
>+1
>
>Glenn
>
>----------------------------------------------------------------------
>Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
>MOREnet System Programming               |  * if iz ina coment.      |
>Missouri Research and Education Network  |  */                       |
>----------------------------------------------------------------------
>




Re: VOTE: adding string taglib to jakarta-taglibs (Re: String taglib proposal)

Posted by Glenn Nielsen <gl...@voyager.apg.more.net>.
James Strachan wrote:
> 
> I'd like to call a vote to add Bay's excellent string taglib to
> jakarta-taglibs CVS and add Bay as a comitter so he can maintain the taglib
> in the jakarta-taglibs project.
> 
> You can browes Bay's work here:-
> 
> http://www.generationjava.com/java/StringTaglib.shtml
> 
> To get the ball rolling, I'm
> 
> +1 on adding string taglib to jakarta-taglibs
> 

+1 

> +1 on Bay being a committer so he can maintain his work inside
> jakarta-taglibs.
> 

+1

Glenn

----------------------------------------------------------------------
Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------

VOTE: adding string taglib to jakarta-taglibs (Re: String taglib proposal)

Posted by James Strachan <ja...@yahoo.co.uk>.
I'd like to call a vote to add Bay's excellent string taglib to
jakarta-taglibs CVS and add Bay as a comitter so he can maintain the taglib
in the jakarta-taglibs project.

You can browes Bay's work here:-

http://www.generationjava.com/java/StringTaglib.shtml

To get the ball rolling, I'm

+1 on adding string taglib to jakarta-taglibs

+1 on Bay being a committer so he can maintain his work inside
jakarta-taglibs.

James
----- Original Message -----
From: <ba...@generationjava.com>
To: <ta...@jakarta.apache.org>
Sent: Monday, August 13, 2001 2:49 PM
Subject: Re: String taglib proposal


> Okay, v0.4 of String taglib is up :)
>
> random, reverseDelimitedName, encodeUrl and decodeUrl tags added.
> escapeHtml tag won't be done til later, it's a big job (unicode
> to html char entity mapping). escapeXml can be used for the moment.
>
> All code is now in the org.apache domain. Javadoc is generated.
>
> So I'm happy for you to call another vote James.
>
> Webpage for it is:
>
> http://www.generationjava.com/java/StringTaglib.shtml
>
> Bay
>
>
>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: String taglib proposal

Posted by ba...@generationjava.com.
Okay, v0.4 of String taglib is up :)

random, reverseDelimitedName, encodeUrl and decodeUrl tags added.
escapeHtml tag won't be done til later, it's a big job (unicode 
to html char entity mapping). escapeXml can be used for the moment.

All code is now in the org.apache domain. Javadoc is generated. 

So I'm happy for you to call another vote James.

Webpage for it is:

http://www.generationjava.com/java/StringTaglib.shtml

Bay



Re: String taglib proposal

Posted by James Strachan <ja...@yahoo.co.uk>.
Hi Bay

From: <ba...@generationjava.com>
> I'm polishing a few things (javadoc, org.apache, couple of new
> tags) before releasing v0.4. I have an escapeXML which simply escapes < >
> and &. This would work for HTML too.

Sounds great - I'd like to use it :-)

> What else do you envision these tags doing? Escaping "s?

I think encoding < > and & would do for what I need.

> For the URL escaping, do you just see it doing a URLEncoder on it, or
> something else. Actually, I'll go with a urlEncode and urlDecode tagset
> for String until I hear further from you.

Sounds great. Encoding sounds like it would be most useful, so that you
could implement it via a call to

response.encodeURL( url )

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: String taglib proposal

Posted by ba...@generationjava.com.
Hi James,

I'm polishing a few things (javadoc, org.apache, couple of new
tags) before releasing v0.4. I have an escapeXML which simply escapes < >
and &. This would work for HTML too.

What else do you envision these tags doing? Escaping "s?

For the URL escaping, do you just see it doing a URLEncoder on it, or
something else. Actually, I'll go with a urlEncode and urlDecode tagset   
for String until I hear further from you. 

Bay

On Sat, 11 Aug 2001, James Strachan wrote:

> Hi Bay
> 
> I'd really like your string taglib to be added to jakarta-taglibs ASAP. I'm
> particularly interested in having <string:escapeHTML>, <string:escapeXML>
> and <string:escapeURL> tags too ;-).
> 
> I seem to remember mostly positive support for it the first time round -
> should we call another vote?
> 
> James
> 
> From: <ba...@generationjava.com>
> >
> > > I am sure one of the taglibs committers would be happy to review
> > > the string taglib once you have it ready.  Just post a URL where
> > > the source can be downloaded as a zip or tar.gz.
> > >
> >
> > I've tested the tags and fixed the various bugs that were displayed, and
> > would like to ask someone to review the taglib. It has a page at:
> >
> > http://www.generationjava.com/java/StringTaglib.shtml
> >
> > and a zip file of all constituent parts at:
> >
> > http://www.generationjava.com/java/string/StringTaglib.zip
> >
> > My generationjava server isn't really up to running lots of Java, so I've
> > chosen not to demonstrate the taglib live.
> >
> > Give me a yell if there are any problems,
> >
> > Bay
> >
> >
> 
> 
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
> 
> 


Re: String taglib proposal

Posted by James Strachan <ja...@yahoo.co.uk>.
Hi Bay

I'd really like your string taglib to be added to jakarta-taglibs ASAP. I'm
particularly interested in having <string:escapeHTML>, <string:escapeXML>
and <string:escapeURL> tags too ;-).

I seem to remember mostly positive support for it the first time round -
should we call another vote?

James

From: <ba...@generationjava.com>
>
> > I am sure one of the taglibs committers would be happy to review
> > the string taglib once you have it ready.  Just post a URL where
> > the source can be downloaded as a zip or tar.gz.
> >
>
> I've tested the tags and fixed the various bugs that were displayed, and
> would like to ask someone to review the taglib. It has a page at:
>
> http://www.generationjava.com/java/StringTaglib.shtml
>
> and a zip file of all constituent parts at:
>
> http://www.generationjava.com/java/string/StringTaglib.zip
>
> My generationjava server isn't really up to running lots of Java, so I've
> chosen not to demonstrate the taglib live.
>
> Give me a yell if there are any problems,
>
> Bay
>
>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: String taglib proposal

Posted by ba...@generationjava.com.
> I am sure one of the taglibs committers would be happy to review
> the string taglib once you have it ready.  Just post a URL where
> the source can be downloaded as a zip or tar.gz.
> 

I've tested the tags and fixed the various bugs that were displayed, and
would like to ask someone to review the taglib. It has a page at:

http://www.generationjava.com/java/StringTaglib.shtml

and a zip file of all constituent parts at:

http://www.generationjava.com/java/string/StringTaglib.zip

My generationjava server isn't really up to running lots of Java, so I've
chosen not to demonstrate the taglib live.

Give me a yell if there are any problems,

Bay


Re: String taglib proposal

Posted by Glenn Nielsen <gl...@voyager.apg.more.net>.
Hi Bayard,

I will echo James recommendation that the string actions be broken out
into individual tags.  From a java code view, reuse is good.  But from
the view of the JSP page author it would be better if the actions were
separate tags for two reasons:

1.  If you edit JSP files using an editor, there is less typing to use
    individual tags vs one tag with the action attribute.

2.  If you use a tool like NetBeans to develop jsp pages it will be
    easier for the page author to use the individual tags in
    NetBeans rather than one tag with 30 different action attribute
    values.  NetBeans will know about the 30 tags, but won't know
    anything about the 30 action attribute values.

Thanks for offering to contribute this to jakarta-taglibs.
I can see uses for a string taglib.

I am sure one of the taglibs committers would be happy to review
the string taglib once you have it ready.  Just post a URL where
the source can be downloaded as a zip or tar.gz.

Thanks,

Glenn

James Strachan wrote:
> 
> Hi Bayard
> 
> From: <ba...@generationjava.com>
> >
> > 1) Does this seem to be of use? I would love to submit the code to Jakarta
> > Taglibs.
> 
> Yes I think so.
> 
> Though already we've a regexp taglib and a scrape taglib for doing search
> and replace kind of things so its worth looking at those to see if there's
> some similarity or cross over.
> 
> > 2) What are the views on my use of an action attribute. Is it sick and
> > wrong?
> 
> It sure makes it easier to write a taglib if you reuse the same tag class,
> though for an end user I prefer 1 tag per action.
> 
> e.g.
> 
> <string:capitalise>word</string:capitalise> => Word
> 
> Also then the TLD can describe that <string:capitalise> takes no attributes
> for validation, whereas
> 
> <string:replace replace="fred" with="bob">Hello fred</string:replace> =>
> Hello bob
> 
> requires at least one attribute "replace" with an optional "with" attribute.
> 
> > 3) What's the best way to document this to show all the functionality? Due
> > to the action attribute my tld is pretty simple. However the String
> > library's JavaDoc doesn't really fit the bill. Should I create a html page
> > that follows the general documentation l&f of the jakarta pages?
> 
> You could try mention a few tags in an email, like you did with 'replace'
> and 'capitalise' and we can take it from there. Even just the capitalise /
> decapitalise / toUpperCase / toLowerCase tags would be useful. What else
> have you got?
> 
> > 4) Should I stop wasting everyone's time? :)
> 
> Not at all. I'm sure there is a need for more text / string manipulation
> tags.
> 
> JAmes
> 
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com

-- 
----------------------------------------------------------------------
Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------

Re: String taglib proposal

Posted by James Strachan <ja...@yahoo.co.uk>.
Hi Bay

Those look great so far. This library looks a good place for other text
based escape tags too - like escaping HTML, XML, URLs and so on.

James

----- Original Message -----
From: <ba...@generationjava.com>
To: <ta...@jakarta.apache.org>
Sent: Thursday, July 12, 2001 5:14 PM
Subject: Re: String taglib proposal


>
> Great to get a positive response :)
>
> I agree that the <string:capitalise..> syntax is nicer. I will make a move
> towards that.
> After a quick peek at scrape and regexp, I don't think I impinge too
> heavily on them. Maybe one or two functions that would be better served
> in their libraries.
>
> Following James' advice I will list the tags I currently have implemented.
> The only difference being that I will get rid of the action attribute and
> create a more explicit tld.
>
> Here goes:
>
>   <string action="upperCase">xx</string>
>   - Turns body into uppercase
>
>   <string action="lowerCase">XX</string>
>   - Lowercases all letters in the body
>
>   <string action="trim">  XX  </string>
>   - Removes whitespace from the start and end of the body
>
>   <string action="substring" start="1" end="4">XX</string>
>   - Get a substring from the body.
>
>   <string action="capitalise">XX</string>
>   - Titlecase the first character of the body.
>
>   <string action="overlay" with="newtext" start="2" end="4">XX</string>
>   - Replace a part of the body with another string.
>
>   <string action="repeat" count="5">XX</string>
>   - Repeat the body - 5 times.
>
>   <string action="center" width="20" delimiter=" ">XX</string>
>   - Center the body in a string of width 20, using spaces as a delimiter
>
>   <string action="chomp" delimiter="\n">XX</string>
>   - Remove the last newline, and everything after it from the body
>
>   <string action="getChomp" delimiter="\n">XX</string>
>   - Get everything after the last newline in the body
>
>   <string action="prechomp" delimiter="\n">XX</string>
>   - Remove the first newline, and everything before it in the body
>
>   <string action="getPrechomp" delimiter="\n">XX</string>
>   - Get everything before the first newline in the body
>
>   <string action="chop">XX</string>
>   - Remove the last character from the body. Will remove a \r if it's
>     before a \n. Not sure if this is needed in Java however.
>
>   <string action="chopNewline">XX</string>
>   - Remove last character if it's a newline.
>
>   <string action="count" set="abc">XX</string>
>   - Count the occurences of any letters in the set.
>     So Abracadabra would return 7. Case sensitive.
>
>   <string action="delete" set="abc">XX</string>
>   - Delete any occurences of letters passed in the set.
>     So Abracadabra => Ardr.  Case sensitive.
>
>   <string action="squeeze" set="abc">XX</string>
>   - Remove any multiple instances of characters in the passed in set.
>     So Abracadabra is unchanged. However, abbr would become abr.
>     Case sensitive.
>
>   <string action="escape">XX</string>
>   - Java escape the string. So tabs goto \t etc.
>
>   <string action="rightPad" width="20" delimiter=" ">XX</string>
>   - Right pad to a width of 20 with spaces.
>
>   <string action="leftPad" width="20" delimiter=" ">XX</string>
>   - Left pad to a width of 20 with spaces.
>
>   <string action="reverse">XX</string>
>   - Reverse the body.
>
>   <string action="strip" delimiter=" ">XX</string>
>   - Strip the body of spaces on both sides. Equivalent to trim,
>     but delimiter is settable.
>
>   <string action="swapCase">XX</string>
>   - Swap the case of all characters in the body.
>
>   <string action="translate" replace="aieou" with="AIEOU">XX</string>
>   - Translate any instances of characters in 'replace' with the
>     corresponding character in 'with'.
>
>   <string action="stripEnd" delimiter=" ">XX</string>
>   - Strip spaces from the end of the body.
>
>   <string action="stripStart" delimiter=" ">XX</string>
>   - Strip spaces from the start of the body.
>
>   <string action="soundex">XX</string>
>   - Return the soundex.
>
>   <string action="metaphone">XX</string>
>   - Return the metaphone.
>
>   <string action="quoteRegexp">XX</string>
>   - Quote any regexp characters. So:  ? -> \?
>
>   <string action="capitaliseAllWords">XX</string>
>   - Titlecase any characters in the body that are preceded by
>     a whitespace or the start of the body.
>
>   <string action="wordWrap" width="80" delimiter="\n"
split="-">XX</string>
>   - Word-wrap the body to a width of 80. Using a delimiter of \n and
>     using a - to split words if need be.
>
>   <string action="nestedString" open="pre" close="post">XX</string>
>   - Get the string that is nested in between 'pre' and 'post'.
>     ie) In a body of:  Someprethingpost.   The above tag would
>     evaluate to 'thing'.
>
>   <string action="countMatches" substring="he">XX</string>
>   - How many times is the substring 'he' mentioned in the body.
>
>   <string action="default" value="null" default="n/a">XX</string>
>   - If the body is the string null, then print n/a.
>
>   <string action="removeXml">XX</string>
>   - Remove any <..> tags from the body.
>
>   <string action="replace" count="5" replace="hen" with="hou">XX</string>
>   - Replace the first 5 instances of hen with hou.
>
> //  <string action="escapeXml">XX</string>
>   - todo. just not around to coding.
> //  <string action="implode" property="name-of-list" delimiter=",
">XX</string>
>   - todo. unsure how to pass in an iterator, list, etc. Not sure if it
>     really fits in a taglib.
>
>
> As for uploading the code, I can stick a jar on my website whenever people
> think is best. Currently I think I should probably move from using action
> before putting anything up.
>
> Thanks,
>
> Bay
>
>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: String taglib proposal

Posted by ba...@generationjava.com.
Great to get a positive response :)

I agree that the <string:capitalise..> syntax is nicer. I will make a move
towards that.
After a quick peek at scrape and regexp, I don't think I impinge too
heavily on them. Maybe one or two functions that would be better served
in their libraries.

Following James' advice I will list the tags I currently have implemented. 
The only difference being that I will get rid of the action attribute and
create a more explicit tld.

Here goes:

  <string action="upperCase">xx</string>
  - Turns body into uppercase

  <string action="lowerCase">XX</string>
  - Lowercases all letters in the body

  <string action="trim">  XX  </string>
  - Removes whitespace from the start and end of the body

  <string action="substring" start="1" end="4">XX</string>
  - Get a substring from the body. 

  <string action="capitalise">XX</string>
  - Titlecase the first character of the body.

  <string action="overlay" with="newtext" start="2" end="4">XX</string>
  - Replace a part of the body with another string.

  <string action="repeat" count="5">XX</string>
  - Repeat the body - 5 times.

  <string action="center" width="20" delimiter=" ">XX</string>
  - Center the body in a string of width 20, using spaces as a delimiter

  <string action="chomp" delimiter="\n">XX</string>
  - Remove the last newline, and everything after it from the body

  <string action="getChomp" delimiter="\n">XX</string>
  - Get everything after the last newline in the body

  <string action="prechomp" delimiter="\n">XX</string>
  - Remove the first newline, and everything before it in the body

  <string action="getPrechomp" delimiter="\n">XX</string>
  - Get everything before the first newline in the body

  <string action="chop">XX</string>
  - Remove the last character from the body. Will remove a \r if it's 
    before a \n. Not sure if this is needed in Java however.

  <string action="chopNewline">XX</string>
  - Remove last character if it's a newline.

  <string action="count" set="abc">XX</string>
  - Count the occurences of any letters in the set.
    So Abracadabra would return 7. Case sensitive.

  <string action="delete" set="abc">XX</string>
  - Delete any occurences of letters passed in the set.
    So Abracadabra => Ardr.  Case sensitive.

  <string action="squeeze" set="abc">XX</string>
  - Remove any multiple instances of characters in the passed in set.
    So Abracadabra is unchanged. However, abbr would become abr.
    Case sensitive.

  <string action="escape">XX</string>
  - Java escape the string. So tabs goto \t etc.

  <string action="rightPad" width="20" delimiter=" ">XX</string>
  - Right pad to a width of 20 with spaces.

  <string action="leftPad" width="20" delimiter=" ">XX</string>
  - Left pad to a width of 20 with spaces.

  <string action="reverse">XX</string>
  - Reverse the body.

  <string action="strip" delimiter=" ">XX</string>
  - Strip the body of spaces on both sides. Equivalent to trim, 
    but delimiter is settable.

  <string action="swapCase">XX</string>
  - Swap the case of all characters in the body.

  <string action="translate" replace="aieou" with="AIEOU">XX</string>
  - Translate any instances of characters in 'replace' with the 
    corresponding character in 'with'.

  <string action="stripEnd" delimiter=" ">XX</string>
  - Strip spaces from the end of the body.

  <string action="stripStart" delimiter=" ">XX</string>
  - Strip spaces from the start of the body.

  <string action="soundex">XX</string>
  - Return the soundex.

  <string action="metaphone">XX</string>
  - Return the metaphone.

  <string action="quoteRegexp">XX</string>
  - Quote any regexp characters. So:  ? -> \?

  <string action="capitaliseAllWords">XX</string>
  - Titlecase any characters in the body that are preceded by 
    a whitespace or the start of the body.

  <string action="wordWrap" width="80" delimiter="\n" split="-">XX</string>
  - Word-wrap the body to a width of 80. Using a delimiter of \n and 
    using a - to split words if need be.

  <string action="nestedString" open="pre" close="post">XX</string>
  - Get the string that is nested in between 'pre' and 'post'.
    ie) In a body of:  Someprethingpost.   The above tag would 
    evaluate to 'thing'.

  <string action="countMatches" substring="he">XX</string>
  - How many times is the substring 'he' mentioned in the body.

  <string action="default" value="null" default="n/a">XX</string>
  - If the body is the string null, then print n/a.

  <string action="removeXml">XX</string>
  - Remove any <..> tags from the body.

  <string action="replace" count="5" replace="hen" with="hou">XX</string>
  - Replace the first 5 instances of hen with hou.

//  <string action="escapeXml">XX</string>
  - todo. just not around to coding.
//  <string action="implode" property="name-of-list" delimiter=", ">XX</string>
  - todo. unsure how to pass in an iterator, list, etc. Not sure if it 
    really fits in a taglib.


As for uploading the code, I can stick a jar on my website whenever people
think is best. Currently I think I should probably move from using action
before putting anything up.

Thanks,

Bay


Re: String taglib proposal

Posted by James Strachan <ja...@yahoo.co.uk>.
Hi Bayard

From: <ba...@generationjava.com>
>
> 1) Does this seem to be of use? I would love to submit the code to Jakarta
> Taglibs.

Yes I think so.

Though already we've a regexp taglib and a scrape taglib for doing search
and replace kind of things so its worth looking at those to see if there's
some similarity or cross over.


> 2) What are the views on my use of an action attribute. Is it sick and
> wrong?

It sure makes it easier to write a taglib if you reuse the same tag class,
though for an end user I prefer 1 tag per action.

e.g.

<string:capitalise>word</string:capitalise> => Word

Also then the TLD can describe that <string:capitalise> takes no attributes
for validation, whereas

<string:replace replace="fred" with="bob">Hello fred</string:replace> =>
Hello bob

requires at least one attribute "replace" with an optional "with" attribute.


> 3) What's the best way to document this to show all the functionality? Due
> to the action attribute my tld is pretty simple. However the String
> library's JavaDoc doesn't really fit the bill. Should I create a html page
> that follows the general documentation l&f of the jakarta pages?

You could try mention a few tags in an email, like you did with 'replace'
and 'capitalise' and we can take it from there. Even just the capitalise /
decapitalise / toUpperCase / toLowerCase tags would be useful. What else
have you got?


> 4) Should I stop wasting everyone's time? :)

Not at all. I'm sure there is a need for more text / string manipulation
tags.

JAmes


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: String taglib proposal

Posted by Shawn Bayern <ba...@essentially.net>.
Bayard,

Such a tag library would definitely be welcome.  As for an "action"
attribute, it's mostly a matter of taste and style.  I'd personally go for
ease of the interface (with the page author) over cleanliness of
implementation; you could perhaps even automate the creation of the
actual, thirty different Tag classes.

But it definitely seems useful, either way.

Shawn

On Thu, 12 Jul 2001 bayard@generationjava.com wrote:

> This seems like too basic an idea to not have been thought of and dealt
> with already, but I'll give it a go anyway.
> Someone recently asked me if there were anymore String functions in Java
> (He was a PHP guy doing JSP). I told him to search the web, but after a
> while looked myself and realised nothing seemed to leap out.
> 
> So I wrote a String library. However it turned out, being a PHP person in
> JSP, he really wanted it as a taglib. So I wrote a taglib wrapper around
> the String library.
> 
> There are about 30-odd 'functions' in the taglib, each one of the form:
> 
> <ns:string action="capitalise">word</ns:string> => Word
> <ns:string action="replace" replace="fred" with="bob">Hello fred</ns:string>  =>   Hello bob
> 
> That is, I use an action attribute rather than different tag names. The
> reason for this was to stop there being 30 different tag classes, each
> with about one line of implementation.
> 
> Onto my questions:
> 
> 1) Does this seem to be of use? I would love to submit the code to Jakarta
> Taglibs.
> 
> 2) What are the views on my use of an action attribute. Is it sick and
> wrong?
> 
> 3) What's the best way to document this to show all the functionality? Due
> to the action attribute my tld is pretty simple. However the String
> library's JavaDoc doesn't really fit the bill. Should I create a html page
> that follows the general documentation l&f of the jakarta pages?
> 
> 4) Should I stop wasting everyone's time? :)
> 
> Thankyou,
> 
> Bayard
> 
> http://www.generationjava.com


String taglib proposal

Posted by ba...@generationjava.com.
This seems like too basic an idea to not have been thought of and dealt
with already, but I'll give it a go anyway.
Someone recently asked me if there were anymore String functions in Java
(He was a PHP guy doing JSP). I told him to search the web, but after a
while looked myself and realised nothing seemed to leap out.

So I wrote a String library. However it turned out, being a PHP person in
JSP, he really wanted it as a taglib. So I wrote a taglib wrapper around
the String library.

There are about 30-odd 'functions' in the taglib, each one of the form:

<ns:string action="capitalise">word</ns:string> => Word
<ns:string action="replace" replace="fred" with="bob">Hello fred</ns:string>  =>   Hello bob

That is, I use an action attribute rather than different tag names. The
reason for this was to stop there being 30 different tag classes, each
with about one line of implementation.

Onto my questions:

1) Does this seem to be of use? I would love to submit the code to Jakarta
Taglibs.

2) What are the views on my use of an action attribute. Is it sick and
wrong?

3) What's the best way to document this to show all the functionality? Due
to the action attribute my tld is pretty simple. However the String
library's JavaDoc doesn't really fit the bill. Should I create a html page
that follows the general documentation l&f of the jakarta pages?

4) Should I stop wasting everyone's time? :)

Thankyou,

Bayard

http://www.generationjava.com