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]


forEach and hibernate

2004-10-21 Thread Lorenzo Sicilia
Hi to all,
I have an action in struts framerwork that it use hibernate.
.., snippets begin ...
List l = (List) sf.find(from UserSession  where nick_name =
?,loginForm.getUserName(), Hibernate.STRING);
us = (UserSession)l.get(0);
session.setAttibute(user,us);
... snippets end ...
in jstl I want show all properties and value of my bean.
I can use forEach?
I have tried but I get nothing.
thanks in advace
Regards Lorenzo

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


RE: forEach and hibernate

2004-10-21 Thread Bill Siggelkow
Well, ... this is just a guess ... 
If some of the properties are lazy loaded and you close the Hibernate
session before reaching the JSP page -- then you will not be able to access
those properties. If this is the case, there are a couple of Solutions.

1) Acquire the Hibernate Session from a ServletFilter that creates and
disposes of the Session.
2) In the Action, call the getters of the lazy loaded properties (or there
may be a better Hibernate) way to load the lazy loaded properties.
3) Don't use lazy loading for he object in question.

-Bill Siggelkow
 
 

 -Original Message-
 From: Lorenzo Sicilia [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, October 21, 2004 5:43 AM
 To: Tag Libraries Users List
 Subject: forEach and hibernate
 
 Hi to all,
 
 I have an action in struts framerwork that it use hibernate.
 
 .., snippets begin ...
 List l = (List) sf.find(from UserSession  where nick_name = 
 ?,loginForm.getUserName(), Hibernate.STRING); us = 
 (UserSession)l.get(0); session.setAttibute(user,us); ... 
 snippets end ...
 
 
 in jstl I want show all properties and value of my bean.
 
 I can use forEach?
 I have tried but I get nothing.
 
 thanks in advace
 
 Regards Lorenzo
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


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



RE: c:import problem

2004-10-21 Thread Christian Taylor
Hi Kris,

Thanks for the reply. I have managed to get it worked out, but only be
looking even closer at the Tomcat source. It turns out to be the way
Tomcat wraps a request when using a RequestDispatcher. If the request
given to the dispatcher is a wrapper, Tomcat will look up the chain
until it finds the real original non-wrapped request, and wrap that.
That was a bit different than the behaviour I expected (I assumed it
would wrap my own wrapper, not look for the original request). I
modified my own wrapper's getParameter() method to call
super.getParameter() and now it works.

This behavour isn't specified in the servlet spec or the Tomcat docs...
Maybe it should be (would've saved me 5 hours of debugging). But I'll
bring that up on an appropriate list and not here. Thanks again for
replying.

Christian

-Original Message-
From: Kris Schneider [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 20, 2004 4:03 PM
To: Tag Libraries Users List
Subject: Re: c:import problem

Christian,

Not sure if you're still wrestling with this, but I just wanted to post
to say that I've been meaning to slap a little test app together as a
sanity check and I'll post back when I get the chance to code  run
it...

Quoting Christian Taylor [EMAIL PROTECTED]:

 Hi,
 
 I'm new to this list, but far from a newbie when it comes to servlets,

 JSP, JSTL and Tomcat. I've spent hours trying to debug this problem, 
 searched the net and mailing lists and haven't been able to find a 
 solution. Here is my situation:
 
 My application has many pages that use c:import to include a common 
 header. The header takes a title parameter. I've seen other people 
 doing this in the archives of this list. My code looks like this:
 
 c:import url=/include/header.jsp
   c:param name=title value=Title of the page/ /c:import
 
 header.jsp uses the title for the title tag as well as to display to

 the user at the top of the page.
 
 These pages can be accessed in two different ways:
 
 1) By a normal user of the application through a web browser
 2) From a servlet that uses RequestDispatchers to capture some pages
to save as files that can be viewed offline.
 
 The problem I'm having is with #2. The title parameter does NOT get 
 passed to header.jsp, and neither do request-scoped variables.
 
 My offline servlet creates request and response wrappers to pass to 
 the RequestDispatcher's include() method. The wrapped request 
 overrides the relevent parameter methods (getParameter(), 
 getParameterMap(),
 etc.) and provides setter methods so I can pass parameters to the 
 pages to be captured. It also defines a request-scoped variable 
 called _OfflineBackup which the pages can use to detect how they are 
 being accessed (some paths, etc. need to be different if the page is 
 to work offline).
 
 My response wrapper is a typical override getOutputStream() and
 getWriter() to capture the output type of thing.
 
 I've looked through the Tomcat and taglibs-standard sources and can't 
 find anything that would help. The code for the c:import tag appears

 to build a query string from the c:param tags and pass it as part of

 the URL to the RequestDispatcher it creates, but Tomcat's 
 ApplicationDispatcher implementation doesn't seem to do anything with 
 it, from what I can see in the source (but I'm not a Tomcat developer 
 and am not that familiar with the source). The parameters in the 
 wrapped request can be accessed from header.jsp, but not the actual 
 parameters passed to header.jsp using c:param.
 
 This all leads me to my real question... why does my 'title' parameter

 work fine when I simply view the pages normally in a browser, but not 
 when I use a RequestDispatcher and my wrapped request/response? The 
 problem appears to be that Tomcat doesn't look at the parameters in 
 the path when getRequestDispatcher(path) is called, which makes me 
 wonder why the c:param tag ever works at all (but as I said, I'm not

 a Tomcat developer and have limited knowledge of the source so I could

 be wrong here, this is just what I've found from digging through the 
 sources). My wrappers seem to be working fine, and the import works 
 properly when viewing the page in a browser.
 
 I hope I explained everything well enough and I apologize for this 
 being a bit long. I'm using Tomcat 5.0.28 and taglibs-standard 1.1.1. 
 This is a servlet 2.4/jsp 2.0 application. Thanks in advance to anyone

 who might be able to help me here!
 
 Christian

--
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]




-
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]