Re: How to avoid the line breaks when a tag file used within javascript?

2004-10-21 Thread Rick Reumann
Kris Schneider wrote the following on 10/21/2004 12:36 AM:
You're sure there's not a newline at the very end of your tag file?
I've even done a reg expression search and replace for \n and nothing 
found. It's just one line. I'm calling it from javascript like:

span style=cursor:hand; onmouseover=return overlib('tags:DelimItems 
items=${associate.additionalServices} property=code postDelim= 
,/'); onmouseout=return nd();*c:out 
value='${associate.primaryService.code}' default='N/A'//span

I end up with a break when viewing the src code right after the close of 
the tag / and before the ');

The break seems to be coming after the tag is used on the page not from 
within the tag itself. Is this the same behavior witnessed for others?

Thanks again,
--
Rick
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: How to avoid the line breaks when a tag file used within javascript?

2004-10-21 Thread Kris Schneider
Rick,

Here'a a bogus example:

dummy.jsp:
--
%@ page contentType=text/plain %
%@ taglib prefix=tags tagdir=/WEB-INF/tags %
Tag output: 'tags:dummy/'

dummy.tag:
--
%@ tag body-content=scriptless %%--
--%%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; %%--
--%c:out value=Hello, world!/

The file ends here^, not on the next line. The output is:

Tag output: 'Hello, world!'

So it should be possible to do what you want, it's just a matter of doinking
with the tag file...

Quoting Rick Reumann [EMAIL PROTECTED]:

 Kris Schneider wrote the following on 10/21/2004 12:36 AM:
  You're sure there's not a newline at the very end of your tag file?
 
 I've even done a reg expression search and replace for \n and nothing 
 found. It's just one line. I'm calling it from javascript like:
 
 span style=cursor:hand; onmouseover=return overlib('tags:DelimItems 
 items=${associate.additionalServices} property=code postDelim= 
 ,/'); onmouseout=return nd();*c:out 
 value='${associate.primaryService.code}' default='N/A'//span
 
 I end up with a break when viewing the src code right after the close of 
 the tag / and before the ');
 
 The break seems to be coming after the tag is used on the page not from 
 within the tag itself. Is this the same behavior witnessed for others?
 
 Thanks again,
 
 -- 
 Rick

-- 
Kris Schneider mailto:[EMAIL PROTECTED]
D.O.Tech   http://www.dotech.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to avoid the line breaks when a tag file used within javascript?

2004-10-21 Thread Rick Reumann
Kris Schneider wrote the following on 10/21/2004 7:33 AM:
Here'a a bogus example:
dummy.jsp:
--
%@ page contentType=text/plain %
%@ taglib prefix=tags tagdir=/WEB-INF/tags %
Tag output: 'tags:dummy/'
dummy.tag:
--
%@ tag body-content=scriptless %%--
--%%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; %%--
--%c:out value=Hello, world!/
The file ends here^, not on the next line. The output is:
Tag output: 'Hello, world!'
So it should be possible to do what you want, it's just a matter of doinking
with the tag file...

But is there a break in the resulting html source code after world!' ?
In other words if you had your example do:
Tag output: 'tags:dummy/' Hi is there a break before my Hi?
And you view the source code does it look something like:
A) 'Hello, world!' Hi is there a break before my Hi?
or
B) 'Hello, world!'
Hi is there a break before my Hi?
I'm getting results like B which is breaking the javascript because of 
the break.

--
Rick
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: How to avoid the line breaks when a tag file used within javascript?

2004-10-21 Thread Kris Schneider
Nope (I tried it - it looks like your choice A), but your example really isn't
any different than mine ;-). The ' is after the tag and it's still on the same
line as the tag's output. Care to (re)post the tag file that's giving you the
problem?

Quoting Rick Reumann [EMAIL PROTECTED]:

 Kris Schneider wrote the following on 10/21/2004 7:33 AM:
 
  Here'a a bogus example:
  
  dummy.jsp:
  --
  %@ page contentType=text/plain %
  %@ taglib prefix=tags tagdir=/WEB-INF/tags %
  Tag output: 'tags:dummy/'
  
  dummy.tag:
  --
  %@ tag body-content=scriptless %%--
  --%%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; %%--
  --%c:out value=Hello, world!/
  
  The file ends here^, not on the next line. The output is:
  
  Tag output: 'Hello, world!'
  
  So it should be possible to do what you want, it's just a matter of
 doinking
  with the tag file...
 
 
 But is there a break in the resulting html source code after world!' ?
 
 In other words if you had your example do:
 
 Tag output: 'tags:dummy/' Hi is there a break before my Hi?
 
 And you view the source code does it look something like:
 
 A) 'Hello, world!' Hi is there a break before my Hi?
 
 or
 
 B) 'Hello, world!'
 Hi is there a break before my Hi?
 
 I'm getting results like B which is breaking the javascript because of 
 the break.
 
 
 -- 
 Rick

-- 
Kris Schneider mailto:[EMAIL PROTECTED]
D.O.Tech   http://www.dotech.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to avoid the line breaks when a tag file used within javascript?

2004-10-21 Thread Rick Reumann
Kris Schneider wrote the following on 10/21/2004 2:59 PM:
Nope (I tried it - it looks like your choice A), but your example really isn't
any different than mine ;-). The ' is after the tag and it's still on the same
line as the tag's output. Care to (re)post the tag file that's giving you the
problem?
The problem is when I try to do:
(All of this on one line ...sorry for crummy wrapping. I can send as 
text if you want)

span style=cursor:hand; onmouseover=return overlib('tags:DelimItems 
items=${associate.additionalServices} property=code postDelim= 
,/'); onmouseout=return nd();*c:out 
value='${associate.primaryService.code}' default='N/A'//span

The problem is in this part:
onmouseover=return overlib('tags:DelimItems 
items=${associate.additionalServices} property=code postDelim= ,/');

The source looks like:
onmouseover=return overlib('foo,bar,foo,bar  -- LINE BREAK!
');
The Line Break above is what is messing up. The output of the Tag 
file(DelimItems) is fine, but the break it ends up giving at the end is 
what is messing it up (the same break you noticed in your code). Also, I 
don't want to make the tag file javascript specific since I use this tag 
for other html output which is fine. I could of course make a modified 
tag or pass in a param to produce the javascript from the tag file. That 
might not be a bad option but still sort of annoying.

--
Rick
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: How to avoid the line breaks when a tag file used within javascript?

2004-10-21 Thread Rick Reumann
Kris Schneider wrote the following on 10/21/2004 4:16 PM:
Right, got it. The problem is in the DelimItems.tag file.
I'm still confused:) Here's the DelimItems tag file:
(had this all one line but broker out the imports as shown)
%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core;
%%@ attribute name=items required=true type=java.util.Collection
%%@ attribute name=preDelim
%%@ attribute name=postDelim
%%@ attribute name=property required=true
%%@ attribute name=includeFirst type=java.lang.Boolean
%%@ attribute name=includeLast type=java.lang.Boolean
%c:if test='${preDelim == null  postDelim == null}'c:set 
var='postDelim' value=', '//c:ifc:forEach items='${items}' 
var='item' varStatus='status'c:if test='${preDelim != null  ( 
includeFirst || !status.first 
)}'${preDelim}/c:if${item[property]}c:if test='${postDelim != null 
 ( includeLast || !status.last )}'${postDelim}/c:if/c:forEach

Here's the exact line that calls it (all one line):
span style=cursor:hand; onmouseover=return overlib('tags:DelimItems 
items=${associate.additionalServices} property=code postDelim= 
,/'); onmouseout=return nd();*c:out 
value='${associate.primaryService.code}' default='N/A'//span

What I'm confused at is when you say the prolbme is IN the 
DelimItems.tag file? I've had the file all is one complete line with no 
returns but will still get a break in the JSP where it's used. I'm sure 
I'm missing something obvious here:)

 Here's something that
might trip you up. This tag file (EOF is just the end-of-file marker so it's
explicit in the example, it's not really in the tag file):
%@ tag body-content=scriptless %%--
--%%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; %%--
--%c:forEach var=s items=0,1,2,3
${s}
/c:forEachEOF
Will produce:
Tag output: '
0
1
2
3
'
But this tag file:
%@ tag body-content=scriptless %%--
--%%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; %%--
--%c:forEach var=s items=0,1,2,3%--
--%${s} %--
--%/c:forEachEOF
Will produce:
Tag output: '0 1 2 3 '
So be careful with your handling of nested tags...
Quoting Rick Reumann [EMAIL PROTECTED]:

Kris Schneider wrote the following on 10/21/2004 2:59 PM:
Nope (I tried it - it looks like your choice A), but your example really
isn't
any different than mine ;-). The ' is after the tag and it's still on the
same
line as the tag's output. Care to (re)post the tag file that's giving you
the
problem?
The problem is when I try to do:
(All of this on one line ...sorry for crummy wrapping. I can send as 
text if you want)

span style=cursor:hand; onmouseover=return overlib('tags:DelimItems 
items=${associate.additionalServices} property=code postDelim= 
,/'); onmouseout=return nd();*c:out 
value='${associate.primaryService.code}' default='N/A'//span

The problem is in this part:
onmouseover=return overlib('tags:DelimItems 
items=${associate.additionalServices} property=code postDelim= ,/');

The source looks like:
onmouseover=return overlib('foo,bar,foo,bar  -- LINE BREAK!
');
The Line Break above is what is messing up. The output of the Tag 
file(DelimItems) is fine, but the break it ends up giving at the end is 
what is messing it up (the same break you noticed in your code). Also, I 
don't want to make the tag file javascript specific since I use this tag 
for other html output which is fine. I could of course make a modified 
tag or pass in a param to produce the javascript from the tag file. That 
might not be a bad option but still sort of annoying.

--
Rick


--
Rick
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: How to avoid the line breaks when a tag file used within javascript?

2004-10-21 Thread Kris Schneider
Hopefully the formatting's okay:

%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; %%--

--%%@ attribute name=items
  required=true
  type=java.util.Collection %%--
--%%@ attribute name=preDelim %%--
--%%@ attribute name=postDelim%%--
--%%@ attribute name=property
  required=true %%--
--%%@ attribute name=includeFirst
  type=java.lang.Boolean%%--
--%%@ attribute name=includeLast 
  type=java.lang.Boolean%%--

--%c:if test=${preDelim == null  postDelim == null}%--
--%c:set var=postDelim value=, /%--
--%/c:if%--
--%c:forEach items=${items} var=item varStatus=status%--
--%c:if test=${preDelim != null  (includeFirst || !status.first)}%--
--%${preDelim}%--
--%/c:if%--
--%${item[property]}%--
--%c:if test=${postDelim != null  ( includeLast || !status.last )}%--
--%${postDelim}%--
--%/c:if%--
--%/c:forEach

Quoting Rick Reumann [EMAIL PROTECTED]:

 Kris Schneider wrote the following on 10/21/2004 4:16 PM:
  Right, got it. The problem is in the DelimItems.tag file.
 
 I'm still confused:) Here's the DelimItems tag file:
 
 (had this all one line but broker out the imports as shown)
 %@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core;
 %%@ attribute name=items required=true type=java.util.Collection
 %%@ attribute name=preDelim
 %%@ attribute name=postDelim
 %%@ attribute name=property required=true
 %%@ attribute name=includeFirst type=java.lang.Boolean
 %%@ attribute name=includeLast type=java.lang.Boolean
 %c:if test='${preDelim == null  postDelim == null}'c:set 
 var='postDelim' value=', '//c:ifc:forEach items='${items}' 
 var='item' varStatus='status'c:if test='${preDelim != null  ( 
 includeFirst || !status.first 
 )}'${preDelim}/c:if${item[property]}c:if test='${postDelim != null 
  ( includeLast || !status.last )}'${postDelim}/c:if/c:forEach
 
 Here's the exact line that calls it (all one line):
 
 span style=cursor:hand; onmouseover=return overlib('tags:DelimItems 
 items=${associate.additionalServices} property=code postDelim= 
 ,/'); onmouseout=return nd();*c:out 
 value='${associate.primaryService.code}' default='N/A'//span
 
 What I'm confused at is when you say the prolbme is IN the 
 DelimItems.tag file? I've had the file all is one complete line with no 
 returns but will still get a break in the JSP where it's used. I'm sure 
 I'm missing something obvious here:)
 
   Here's something that
  might trip you up. This tag file (EOF is just the end-of-file marker so
 it's
  explicit in the example, it's not really in the tag file):
  
  %@ tag body-content=scriptless %%--
  --%%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; %%--
  --%c:forEach var=s items=0,1,2,3
  ${s}
  /c:forEachEOF
  
  Will produce:
  
  Tag output: '
  0
  
  1
  
  2
  
  3
  '
  
  But this tag file:
  
  %@ tag body-content=scriptless %%--
  --%%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; %%--
  --%c:forEach var=s items=0,1,2,3%--
  --%${s} %--
  --%/c:forEachEOF
  
  Will produce:
  
  Tag output: '0 1 2 3 '
  
  So be careful with your handling of nested tags...
  
  Quoting Rick Reumann [EMAIL PROTECTED]:
  
  
 Kris Schneider wrote the following on 10/21/2004 2:59 PM:
 
 Nope (I tried it - it looks like your choice A), but your example really
 
 isn't
 
 any different than mine ;-). The ' is after the tag and it's still on the
 
 same
 
 line as the tag's output. Care to (re)post the tag file that's giving you
 
 the
 
 problem?
 
 The problem is when I try to do:
 
 (All of this on one line ...sorry for crummy wrapping. I can send as 
 text if you want)
 
 span style=cursor:hand; onmouseover=return overlib('tags:DelimItems 
 items=${associate.additionalServices} property=code postDelim= 
 ,/'); onmouseout=return nd();*c:out 
 value='${associate.primaryService.code}' default='N/A'//span
 
 The problem is in this part:
 
 onmouseover=return overlib('tags:DelimItems 
 items=${associate.additionalServices} property=code postDelim=
 ,/');
 
 The source looks like:
 
 onmouseover=return overlib('foo,bar,foo,bar  -- LINE BREAK!
 ');
 
 The Line Break above is what is messing up. The output of the Tag 
 file(DelimItems) is fine, but the break it ends up giving at the end is 
 what is messing it up (the same break you noticed in your code). Also, I 
 don't want to make the tag file javascript specific since I use this tag 
 for other html output which is fine. I could of course make a modified 
 tag or pass in a param to produce the javascript from the tag file. That 
 might not be a bad option but still sort of annoying.
 
 -- 
 Rick
  
  
 
 
 -- 
 Rick

-- 
Kris Schneider mailto:[EMAIL PROTECTED]
D.O.Tech   http://www.dotech.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to avoid the line breaks when a tag file used within javascript?

2004-10-21 Thread Rick Reumann
It still causes the same problem. The problem is in the break 'after' 
the whole tag is used. The break on the JSP that calls this tag. To be 
sure, I used your exact code below and I still get the same break that 
is visible when you view source. To be specific:

When the tag is called in the following onmouseover:
In JSP:
span style=cursor:hand; onmouseover=return overlib('tags:DelimItems 
items=${associate.additionalServices} property=code postDelim= 
,/'); onmouseout=return nd();*c:out 
value='${associate.primaryService.code}' default='N/A'//span

It produces source code:
span style=cursor:hand; onmouseover=return overlib('NABSS ,NAS ,NHTI 
,NSI  **LINE BREAK IN SOURCE IS HERE (after NSI)!!!
'); onmouseout=return nd();*NTI/span

Thanks for trying to help with this.
Kris Schneider wrote the following on 10/21/2004 5:24 PM:
Hopefully the formatting's okay:
%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; %%--
--%%@ attribute name=items
  required=true
  type=java.util.Collection %%--
--%%@ attribute name=preDelim %%--
--%%@ attribute name=postDelim%%--
--%%@ attribute name=property
  required=true %%--
--%%@ attribute name=includeFirst
  type=java.lang.Boolean%%--
--%%@ attribute name=includeLast 
  type=java.lang.Boolean%%--

--%c:if test=${preDelim == null  postDelim == null}%--
--%c:set var=postDelim value=, /%--
--%/c:if%--
--%c:forEach items=${items} var=item varStatus=status%--
--%c:if test=${preDelim != null  (includeFirst || !status.first)}%--
--%${preDelim}%--
--%/c:if%--
--%${item[property]}%--
--%c:if test=${postDelim != null  ( includeLast || !status.last )}%--
--%${postDelim}%--
--%/c:if%--
--%/c:forEach
Quoting Rick Reumann [EMAIL PROTECTED]:

Kris Schneider wrote the following on 10/21/2004 4:16 PM:
Right, got it. The problem is in the DelimItems.tag file.
I'm still confused:) Here's the DelimItems tag file:
(had this all one line but broker out the imports as shown)
%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core;
%%@ attribute name=items required=true type=java.util.Collection
%%@ attribute name=preDelim
%%@ attribute name=postDelim
%%@ attribute name=property required=true
%%@ attribute name=includeFirst type=java.lang.Boolean
%%@ attribute name=includeLast type=java.lang.Boolean
%c:if test='${preDelim == null  postDelim == null}'c:set 
var='postDelim' value=', '//c:ifc:forEach items='${items}' 
var='item' varStatus='status'c:if test='${preDelim != null  ( 
includeFirst || !status.first 
)}'${preDelim}/c:if${item[property]}c:if test='${postDelim != null 
 ( includeLast || !status.last )}'${postDelim}/c:if/c:forEach

Here's the exact line that calls it (all one line):
span style=cursor:hand; onmouseover=return overlib('tags:DelimItems 
items=${associate.additionalServices} property=code postDelim= 
,/'); onmouseout=return nd();*c:out 
value='${associate.primaryService.code}' default='N/A'//span

What I'm confused at is when you say the prolbme is IN the 
DelimItems.tag file? I've had the file all is one complete line with no 
returns but will still get a break in the JSP where it's used. I'm sure 
I'm missing something obvious here:)

 Here's something that
might trip you up. This tag file (EOF is just the end-of-file marker so
it's
explicit in the example, it's not really in the tag file):
%@ tag body-content=scriptless %%--
--%%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; %%--
--%c:forEach var=s items=0,1,2,3
${s}
/c:forEachEOF
Will produce:
Tag output: '
0
1
2
3
'
But this tag file:
%@ tag body-content=scriptless %%--
--%%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; %%--
--%c:forEach var=s items=0,1,2,3%--
--%${s} %--
--%/c:forEachEOF
Will produce:
Tag output: '0 1 2 3 '
So be careful with your handling of nested tags...
Quoting Rick Reumann [EMAIL PROTECTED]:

Kris Schneider wrote the following on 10/21/2004 2:59 PM:

Nope (I tried it - it looks like your choice A), but your example really
isn't

any different than mine ;-). The ' is after the tag and it's still on the
same

line as the tag's output. Care to (re)post the tag file that's giving you
the

problem?
The problem is when I try to do:
(All of this on one line ...sorry for crummy wrapping. I can send as 
text if you want)

span style=cursor:hand; onmouseover=return overlib('tags:DelimItems 
items=${associate.additionalServices} property=code postDelim= 
,/'); onmouseout=return nd();*c:out 
value='${associate.primaryService.code}' default='N/A'//span

The problem is in this part:
onmouseover=return overlib('tags:DelimItems 
items=${associate.additionalServices} property=code postDelim=
,/');
The source looks like:
onmouseover=return overlib('foo,bar,foo,bar  -- LINE BREAK!
');
The Line Break above is what is messing up. The output of the Tag 
file(DelimItems) is fine, but the break it ends up giving at the end is 
what is messing it up (the same break you 

Re: How to avoid the line breaks when a tag file used within javascript?

2004-10-21 Thread Jason Lea
So you don't have a blank line after the /c:forEach?
eg you have
[start of file]%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core;
...
 ( includeLast || !status.last )}'${postDelim}/c:if/c:forEach[end of file]
or do you have
[start of file]%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core;
...
 ( includeLast || !status.last )}'${postDelim}/c:if/c:forEach
[end of file]
I imagine you haven't pressed enter at the end of the /c:forEach
Perhaps you could try assigning the result to a var
eg
c:set var=${output}tags:DelimItems
items=${associate.additionalServices} property=code postDelim= 
,/'); onmouseout=return nd();*c:out value='${associate.primaryService.code}' default='N/A'//c:set

Then use 

span style=cursor:hand; onmouseover=return overlib('c:out 
value='${output}'//span
Or have a look at http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jasper-howto.html if you are 
using tomcat and the *trimSpaces* option for JSP compilation
--
Jason Lea



Re: How to avoid the line breaks when a tag file used within javascript?

2004-10-21 Thread Rick Reumann
Jason Lea wrote the following on 10/21/2004 6:31 PM:
So you don't have a blank line after the /c:forEach?
positive. I triple checked that:)
Perhaps you could try assigning the result to a var
eg
c:set var=${output}tags:DelimItems
items=${associate.additionalServices} property=code postDelim= 
,/'); onmouseout=return nd();*c:out 
value='${associate.primaryService.code}' default='N/A'//c:set

Then use
span style=cursor:hand; onmouseover=return overlib('c:out 
value='${output}'//span

Or have a look at 
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jasper-howto.html if you 
are using tomcat and the *trimSpaces* option for JSP compilation
Good suggestions. I'll have to try them out. I know the JBoss instance 
3.2.5 is using Tomcat5.. I just have to figure out where the tomcat 
settings are configured for it. (New to using JBoss).

--
Rick
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: How to avoid the line breaks when a tag file used within javascript?

2004-10-21 Thread Rahul P Akolkar
This thread has gotten too long to ignore :-)

trimSpaces probably won't do it for you.

As my bit, I tried this trivial JSP:

%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; %%--
--%tag attr=foo('jsp:include page=test.jsp /')%--
--%anotherTag /

where test.jsp is another trivial JSP as follows:

%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; %%--
--%A, c:if test=${true}%--
--%B, %--
--%/c:ifC

I don't have a newline after /c:ifC, and I get this output:

tag attr=foo('A, B, C')anotherTag /

Ugly code? Yes. But I believe the output is similar to what you want from 
your example.

Now why it doesn't work for you is another issue. I'm using Tomcat and 
Emacs.

-Rahul


Re: How to avoid the line breaks when a tag file used within javascript?

2004-10-21 Thread Kris Schneider
Not sure what to say at this point 'cause it worked for me with:
%@ page contentType=text/plain %
%@ taglib prefix=curi=http://java.sun.com/jsp/jstl/core; %
%@ taglib prefix=tags tagdir=/WEB-INF/tags %
jsp:useBean id=fooService class=java.util.HashMap/
c:set target=${fooService} property=code value=foo/
jsp:useBean id=barService class=java.util.HashMap/
c:set target=${barService} property=code value=bar/
jsp:useBean id=additionalServices class=java.util.ArrayList/
%
additionalServices.add(fooService);
additionalServices.add(barService);
%
jsp:useBean id=associate class=java.util.HashMap/
c:set target=${associate} property=additionalServices 
value=${additionalServices}/

span style=cursor:hand; onmouseover=return overlib('tags:dummy 
items=${associate.additionalServices} property=code 
postDelim=,/'); onmouseout=return nd();*c:out 
value='${associate.primaryService.code}' default='N/A'//span

Output (no line breaks):
span style=cursor:hand; onmouseover=return overlib('foo,bar'); 
onmouseout=return nd();*N/A/span

Rick Reumann wrote:
It still causes the same problem. The problem is in the break 'after' 
the whole tag is used. The break on the JSP that calls this tag. To be 
sure, I used your exact code below and I still get the same break that 
is visible when you view source. To be specific:

When the tag is called in the following onmouseover:
In JSP:
span style=cursor:hand; onmouseover=return overlib('tags:DelimItems 
items=${associate.additionalServices} property=code postDelim= 
,/'); onmouseout=return nd();*c:out 
value='${associate.primaryService.code}' default='N/A'//span

It produces source code:
span style=cursor:hand; onmouseover=return overlib('NABSS ,NAS ,NHTI 
,NSI  **LINE BREAK IN SOURCE IS HERE (after NSI)!!!
'); onmouseout=return nd();*NTI/span

Thanks for trying to help with this.
Kris Schneider wrote the following on 10/21/2004 5:24 PM:
Hopefully the formatting's okay:
%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; %%--
--%%@ attribute name=items
  required=true
  type=java.util.Collection %%--
--%%@ attribute name=preDelim %%--
--%%@ attribute name=postDelim%%--
--%%@ attribute name=property
  required=true %%--
--%%@ attribute name=includeFirst
  type=java.lang.Boolean%%--
--%%@ attribute name=includeLast   
type=java.lang.Boolean%%--

--%c:if test=${preDelim == null  postDelim == null}%--
--%c:set var=postDelim value=, /%--
--%/c:if%--
--%c:forEach items=${items} var=item varStatus=status%--
--%c:if test=${preDelim != null  (includeFirst || 
!status.first)}%--
--%${preDelim}%--
--%/c:if%--
--%${item[property]}%--
--%c:if test=${postDelim != null  ( includeLast || !status.last 
)}%--
--%${postDelim}%--
--%/c:if%--
--%/c:forEach

Quoting Rick Reumann [EMAIL PROTECTED]:

Kris Schneider wrote the following on 10/21/2004 4:16 PM:
Right, got it. The problem is in the DelimItems.tag file.

I'm still confused:) Here's the DelimItems tag file:
(had this all one line but broker out the imports as shown)
%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core;
%%@ attribute name=items required=true type=java.util.Collection
%%@ attribute name=preDelim
%%@ attribute name=postDelim
%%@ attribute name=property required=true
%%@ attribute name=includeFirst type=java.lang.Boolean
%%@ attribute name=includeLast type=java.lang.Boolean
%c:if test='${preDelim == null  postDelim == null}'c:set 
var='postDelim' value=', '//c:ifc:forEach items='${items}' 
var='item' varStatus='status'c:if test='${preDelim != null  ( 
includeFirst || !status.first 
)}'${preDelim}/c:if${item[property]}c:if test='${postDelim != 
null  ( includeLast || !status.last 
)}'${postDelim}/c:if/c:forEach

Here's the exact line that calls it (all one line):
span style=cursor:hand; onmouseover=return 
overlib('tags:DelimItems items=${associate.additionalServices} 
property=code postDelim= ,/'); onmouseout=return 
nd();*c:out value='${associate.primaryService.code}' 
default='N/A'//span

What I'm confused at is when you say the prolbme is IN the 
DelimItems.tag file? I've had the file all is one complete line with 
no returns but will still get a break in the JSP where it's used. I'm 
sure I'm missing something obvious here:)

 Here's something that
might trip you up. This tag file (EOF is just the end-of-file 
marker so

it's
explicit in the example, it's not really in the tag file):
%@ tag body-content=scriptless %%--
--%%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; 
%%--
--%c:forEach var=s items=0,1,2,3
${s}
/c:forEachEOF

Will produce:
Tag output: '
0
1
2
3
'
But this tag file:
%@ tag body-content=scriptless %%--
--%%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; 
%%--
--%c:forEach var=s items=0,1,2,3%--
--%${s} %--
--%/c:forEachEOF

Will produce:
Tag output: '0 1 2 3 '
So be careful with your handling of nested tags...
Quoting Rick Reumann [EMAIL PROTECTED]:

Kris 

Re: How to avoid the line breaks when a tag file used within javascript?

2004-10-21 Thread Rick Reumann
Kris Schneider wrote the following on 10/21/2004 7:39 PM:
Output (no line breaks):
span style=cursor:hand; onmouseover=return overlib('foo,bar'); 
onmouseout=return nd();*N/A/span
Now that drives me mad:) If you get a chance, just so I can tell if ends 
up being some server or OS situation. If you could send me that JSP and 
the tag file so I can plop them 'as is' into my app- that would be 
great. I'd love to see what happens. Thanks.

--
Rick
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


[solved thanks all] Re: How to avoid the line breaks when a tag file used within javascript?

2004-10-21 Thread Rick Reumann
First off thanks everyone for being so patient. Somehow I had to have 
been an idiot somwhere along the way in creating the Tag file even 
though I swear I copied and pasted the code from Kris' initial e-mail 
exactly like he had it. Plus I thought I triple checked for any trailing 
line break. I say the problem is'solved' but I really don't know what 
the problem was with my file. My tag file looked to me to be identical 
to the one Kris ended up e-mailing me. Yet when I took what he emailed 
and pasted it over my old tag file everything was fine. Is it possible 
that somehow a hidden char was in there? I had that happen when time 
when I was on Linux and I pasted from Eclipse into jEdit, or it might 
have been the other way around. It was a real problem to track down 
because looking at the file you couldn't tell anything was wrong but the 
character that wasn't showing up was causing a problem with the JSP 
compiler trying to compile the code. (I think in this case it ended up 
going up as binary and that's how I know there was a problem.) Ok, I'm 
digressing, I'm sure it was just typical stupid error but thanks again, 
since my code looks much cleaner now.

Now it's time to go struggle with more javascript for an application 
that I'm wondering will ever get out on time:)

Rick Reumann wrote the following on 10/21/2004 7:45 PM:
Kris Schneider wrote the following on 10/21/2004 7:39 PM:
Output (no line breaks):
span style=cursor:hand; onmouseover=return overlib('foo,bar'); 
onmouseout=return nd();*N/A/span

Now that drives me mad:) If you get a chance, just so I can tell if ends 
up being some server or OS situation. If you could send me that JSP and 
the tag file so I can plop them 'as is' into my app- that would be 
great. I'd love to see what happens. Thanks.


--
Rick
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: How to avoid the line breaks when a tag file used within javascript?

2004-10-20 Thread Kris Schneider
Rick,

Are you still pursuing this? If so, I use the following comment hack:

%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; %%--
--%%@ attribute name=items required=true
type=java.util.Collection%%--
--%...

I've also seen this in use:

%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core;
%%@ attribute name=items required=true type=java.util.Collection
%...

Quoting Rick Reumann [EMAIL PROTECTED]:

 I created a simple forEach type of delimeter tag that works well for me 
 (code at end). The problem, though, is I need to use this tag within a 
 javascript method to produce a string that'll be used in a dhtml popup. 
 The problem is that, even if I make this tag file all on one line, I 
 still end up with at least one line break- that when used within the 
 javascript causes problems.
 
 For example I need to call something like..
 
 onmouseover=return doSomethingWithString('tags:MyTag .../');
 
 Is there a way to avoid the line breaks that mess up the above 
 javascript? or I guess another option is to return a String from a 
 function vs using this as a tag file? (I've looked briefly at the 
 function stuff Kris, but I'm short on time on this app and the Tag file 
 was easier to start with).
 
 As a side note if you see a better way to write this tag file I'll take 
 any suggestions (sorry the if part is hard to read but I needed no extra 
 spaces in the html output):
 
 DelimItems
 --
 %@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; %
 %@ attribute name=items required=true type=java.util.Collection%
 %@ attribute name=preDelim %
 %@ attribute name=postDelim %
 %@ attribute name=property required=true %
 %@ attribute name=includeFirst type=java.lang.Boolean%
 %@ attribute name=includeLast type=java.lang.Boolean%
 c:if test='${preDelim == null  postDelim == null}'
  c:set var='postDelim' value=', '/
 /c:if
 c:forEach items='${items}' var='item' varStatus='status'
  c:if test='${preDelim != null  ( includeFirst || !status.first 
 )}'${preDelim}/c:if${item[property]}c:if test='${postDelim != null 
  ( includeLast || !status.last )}'${postDelim}/c:if
 /c:forEach
 
 
 If you don't provide a pre or postDelim, it just uses comma separated 
 output, which is what I most commonly need.
 
 -- 
 Rick

-- 
Kris Schneider mailto:[EMAIL PROTECTED]
D.O.Tech   http://www.dotech.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to avoid the line breaks when a tag file used within javascript?

2004-10-20 Thread Rick Reumann
Kris Schneider wrote the following on 10/20/2004 3:51 PM:
Are you still pursuing this? If so, I use the following comment hack:
%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; %%--
--%%@ attribute name=items required=true
type=java.util.Collection%%--
--%...
I've also seen this in use:
%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core;
%%@ attribute name=items required=true type=java.util.Collection
%...
Thanks, yes still looking:( The problem is I'm still left with just one 
closing break at the end. I had previously tried converting the whole 
tag file to one line and still I'll get one break when it's evaluated in 
the JSP. Very frustrating. The only other hack I can think of is when 
I'm iterating over my loop in my tag file I can keep prepending a c:set 
   var to make my String and I could then use that in the JSP. Seems 
like a lot overhead though. Be nice if there was a way to do c:set 
var=foo value=tags:MyTag ...// Then I could just use ${foo} 
within the javascript.


--
Rick
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: How to avoid the line breaks when a tag file used within javascript?

2004-10-20 Thread David Schwartz
You may be able to work around it via javascript?
Try outputting the value to a hidden text field than displaying the value
property. This will not cause a javascript error  elliminates line breaks.


Quoting Rick Reumann [EMAIL PROTECTED]:

 Kris Schneider wrote the following on 10/20/2004 3:51 PM:

  Are you still pursuing this? If so, I use the following comment hack:
 
  %@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; %%--
  --%%@ attribute name=items required=true
  type=java.util.Collection%%--
  --%...
 
  I've also seen this in use:
 
  %@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core;
  %%@ attribute name=items required=true type=java.util.Collection
  %...
 

 Thanks, yes still looking:( The problem is I'm still left with just one
 closing break at the end. I had previously tried converting the whole
 tag file to one line and still I'll get one break when it's evaluated in
 the JSP. Very frustrating. The only other hack I can think of is when
 I'm iterating over my loop in my tag file I can keep prepending a c:set
 var to make my String and I could then use that in the JSP. Seems
 like a lot overhead though. Be nice if there was a way to do c:set
 var=foo value=tags:MyTag ...// Then I could just use ${foo}
 within the javascript.



 --
 Rick

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




David Schwartz

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to avoid the line breaks when a tag file used within javascript?

2004-10-20 Thread Hassan Schroeder
Rick Reumann wrote:
Thanks, yes still looking:( The problem is I'm still left with just one 
closing break at the end. I had previously tried converting the whole 
tag file to one line and still I'll get one break when it's evaluated in 
the JSP. 
Sorry, I don't recall the start of this thread, but when I want to
eliminate white space from the output of a taglib I use the string
taglib -- str:trim !-- whatever -- /str:trim
Might be worth a look :-)
--
Hassan Schroeder - [EMAIL PROTECTED]
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
  dream.  code.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: How to avoid the line breaks when a tag file used within javascript?

2004-10-20 Thread Kris Schneider
You're sure there's not a newline at the very end of your tag file?
Rick Reumann wrote:
Kris Schneider wrote the following on 10/20/2004 3:51 PM:
Are you still pursuing this? If so, I use the following comment hack:
%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core; %%--
--%%@ attribute name=items required=true
type=java.util.Collection%%--
--%...
I've also seen this in use:
%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core;
%%@ attribute name=items required=true type=java.util.Collection
%...
Thanks, yes still looking:( The problem is I'm still left with just one 
closing break at the end. I had previously tried converting the whole 
tag file to one line and still I'll get one break when it's evaluated in 
the JSP. Very frustrating. The only other hack I can think of is when 
I'm iterating over my loop in my tag file I can keep prepending a c:set 
   var to make my String and I could then use that in the JSP. Seems 
like a lot overhead though. Be nice if there was a way to do c:set 
var=foo value=tags:MyTag ...// Then I could just use ${foo} 
within the javascript.
--
Kris Schneider mailto:[EMAIL PROTECTED]
D.O.Tech   http://www.dotech.com/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]