You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by "Karen D. Wiens" <ka...@polygon.net> on 2003/08/30 00:29:30 UTC

Pass scrape taglib to a method (string)

Hello,
How can I pass the value of the scrape taglib to a method?  It seems to
me that it should be something like:

<% // snag text and stick it into 'teststring' 

String teststring = pageContext.getAttribute( "<scrp:result
scrape="pj3"/>" );

%>

But it doesn't like the syntax.  I'm new to this...  
Thanks for your help.
Karen

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.504 / Virus Database: 302 - Release Date: 7/24/2003
 


Re: Pass scrape taglib to a method (string)

Posted by "K.C. Baltz" <kc...@lollimail.com>.
<%  %>   - Denotes a "scriptlet", java code that is directly inserted 
into a generated Servlet

The tags you are trying to use are called "custom tags", and they can't 
be used inside scriptlets any more than  you could do:
<%
    <html>
%>

Whatever appears within a scriptlet must be Java code.   

If you can, try to avoid mixing custom tags and scriptlets.  Although 
it's possible to do this, it can be very confusing for new users of JSP 
and tags.

K.C.

Karen D. Wiens wrote:

>Thank you for responding.  I've tried this and I'm still getting a
>syntax error.
>
>I replaced:
>  
>
>><% // snag text and stick it into 'teststring' 
>>
>>String teststring = pageContext.getAttribute( "<scrp:result
>>scrape="pj3"/>" );
>>    
>>
>
>With:
><% // snag text and stick it into 'teststring' 
><c:set var="teststring"><scrp:result scrape="pj3"/></c:set>;
>%>
>
>And got the following error message:
>(Thanks again for any help you can give)
>Karen
>*** Syntax: Unexpected symbol ignored
>
>
>
>    88. 
>           ^-^
>
>*** Syntax: "AssignmentOperator AssignmentExpression" inserted to
>complete Assignment
>
>
>
>    88. 
>           ^-^
>
>*** Syntax: ";" inserted to complete ExpressionStatement
>
>
>
>    88. 
>                               <>
>
>*** Syntax: misplaced construct(s)
>
>
>
>    88. 
>                                     <>
>
>*** Syntax: ; expected instead of this token
>
>
>
>    88. 
>                                                          <--->
>
>*** Syntax: Unexpected symbols ignored
>
>
>-----Original Message-----
>From: Hassan Schroeder [mailto:hassan@webtuitive.com] 
>Sent: Friday, August 29, 2003 5:00 PM
>To: Tag Libraries Users List
>Subject: Re: Pass scrape taglib to a method (string)
>
>
>Karen D. Wiens wrote:
>
>  
>
>>How can I pass the value of the scrape taglib to a method?  It seems
>>    
>>
>to
>  
>
>>me that it should be something like:
>>
>><% // snag text and stick it into 'teststring' 
>>
>>String teststring = pageContext.getAttribute( "<scrp:result
>>scrape="pj3"/>" );
>>
>>%>
>>    
>>
>
>One approach:
>
>  <c:set var="teststring"><scrp:result scrape="pj3"/></c:set>
>
>HTH!
>  
>


Re: Pass scrape taglib to a method (string)

Posted by Hassan Schroeder <ha...@webtuitive.com>.
Karen D. Wiens wrote:

> Thank you for responding.  I've tried this and I'm still getting a
> syntax error.

> <% // snag text and stick it into 'teststring' 
> <c:set var="teststring"><scrp:result scrape="pj3"/></c:set>;
> %>

Yep, that'll create one :-) -- don't enclose these tags:

  <c:set var="teststring"><scrp:result scrape="pj3"/></c:set>

in a scriptlet section ( the  <% ... %> )

-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.




Re: x:transform and body content

Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
Oh, to clarify my environment: Tomcat 4.1.24, JSTL 1.0.

Mark R. Diggory wrote:

> I'm trying to dynamically set the parameters on an x:transform based on 
> the params in the http request like below:
> 
> <c:import var="default" url="/Study/DataSubsettingView.xsl"/>
> 
> <x:transform xml="${dom}" xslt="${xslt}">
>   <c:forEach var="entry" items="${param}">
>      <c:if test="${entry.key ne 'var'}">
>         <x:param name="${entry.key}" value="${entry.value}"/>
>      </c:if>
>   </c:forEach>
> </x:transform>
> 
> but I keep getting
> 
> 27: Encountered illegal body of tag "x:transform" tag, given its 
> attributes.
> 
> Is there any way to do this dynamically?
> 
> -Mark Diggory
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> 


x:transform and body content

Posted by "Mark R. Diggory" <md...@latte.harvard.edu>.
I'm trying to dynamically set the parameters on an x:transform based on 
the params in the http request like below:

<c:import var="default" url="/Study/DataSubsettingView.xsl"/>

<x:transform xml="${dom}" xslt="${xslt}">
   <c:forEach var="entry" items="${param}">
      <c:if test="${entry.key ne 'var'}">
         <x:param name="${entry.key}" value="${entry.value}"/>
      </c:if>
   </c:forEach>
</x:transform>

but I keep getting

27: Encountered illegal body of tag "x:transform" tag, given its attributes.

Is there any way to do this dynamically?

-Mark Diggory


Re: Pass scrape taglib to a method (string)

Posted by Timo Neumann <ne...@ff-muenchen.de>.
Karen D. Wiens wrote:
> Can anyone help me with this?  I'm getting a syntax error and I'm lost
> on where to go from here.
> Thanks.

Karen.

I guess you didn't get the mail from Hassan Schroeder.
<c:set...> is a custom tag and must not be included inside scriptlet 
tags (<% %>). You use it just like any other HTML tag.

hth,

Timo

> 
> -----Original Message-----
> From: Karen D. Wiens [mailto:karen@polygon.net] 
> Sent: Friday, August 29, 2003 7:10 PM
> To: 'Tag Libraries Users List'
> Subject: RE: Pass scrape taglib to a method (string)
> 
> 
> Thank you for responding.  I've tried this and I'm still getting a
> syntax error.
> 
> I replaced:
> 
>><% // snag text and stick it into 'teststring' 
>>
>>String teststring = pageContext.getAttribute( "<scrp:result
>>scrape="pj3"/>" );
> 
> 
> With:
> <% // snag text and stick it into 'teststring' 
> <c:set var="teststring"><scrp:result scrape="pj3"/></c:set>;
> %>
> 
> And got the following error message:
> (Thanks again for any help you can give)
> Karen
> *** Syntax: Unexpected symbol ignored
> 
> 
> 
>     88. 
>            ^-^
> 
> *** Syntax: "AssignmentOperator AssignmentExpression" inserted to
> complete Assignment
> 
> 
> 
>     88. 
>            ^-^
> 
> *** Syntax: ";" inserted to complete ExpressionStatement
> 
> 
> 
>     88. 
>                                <>
> 
> *** Syntax: misplaced construct(s)
> 
> 
> 
>     88. 
>                                      <>
> 
> *** Syntax: ; expected instead of this token
> 
> 
> 
>     88. 
>                                                           <--->
> 
> *** Syntax: Unexpected symbols ignored
> 
> 
> -----Original Message-----
> From: Hassan Schroeder [mailto:hassan@webtuitive.com] 
> Sent: Friday, August 29, 2003 5:00 PM
> To: Tag Libraries Users List
> Subject: Re: Pass scrape taglib to a method (string)
> 
> 
> Karen D. Wiens wrote:
> 
> 
>>How can I pass the value of the scrape taglib to a method?  It seems
> 
> to
> 
>>me that it should be something like:
>>
>><% // snag text and stick it into 'teststring' 
>>
>>String teststring = pageContext.getAttribute( "<scrp:result
>>scrape="pj3"/>" );
>>
>>%>
> 
> 
> One approach:
> 
>   <c:set var="teststring"><scrp:result scrape="pj3"/></c:set>
> 
> HTH!


-- 
F&F Computer Anwendungen        Tel: +49 89 51727-352
und Unternehmensberatung GmbH   Fax: +49 89 51727-111
Westendstr. 195                 Mail: t.neumann@ff-muenchen.de
D-80686 Muenchen                http://www.ff-muenchen.de


RE: Pass scrape taglib to a method (string)

Posted by "Karen D. Wiens" <ka...@polygon.net>.
Can anyone help me with this?  I'm getting a syntax error and I'm lost
on where to go from here.
Thanks.

-----Original Message-----
From: Karen D. Wiens [mailto:karen@polygon.net] 
Sent: Friday, August 29, 2003 7:10 PM
To: 'Tag Libraries Users List'
Subject: RE: Pass scrape taglib to a method (string)


Thank you for responding.  I've tried this and I'm still getting a
syntax error.

I replaced:
> <% // snag text and stick it into 'teststring' 
> 
> String teststring = pageContext.getAttribute( "<scrp:result
> scrape="pj3"/>" );

With:
<% // snag text and stick it into 'teststring' 
<c:set var="teststring"><scrp:result scrape="pj3"/></c:set>;
%>

And got the following error message:
(Thanks again for any help you can give)
Karen
*** Syntax: Unexpected symbol ignored



    88. 
           ^-^

*** Syntax: "AssignmentOperator AssignmentExpression" inserted to
complete Assignment



    88. 
           ^-^

*** Syntax: ";" inserted to complete ExpressionStatement



    88. 
                               <>

*** Syntax: misplaced construct(s)



    88. 
                                     <>

*** Syntax: ; expected instead of this token



    88. 
                                                          <--->

*** Syntax: Unexpected symbols ignored


-----Original Message-----
From: Hassan Schroeder [mailto:hassan@webtuitive.com] 
Sent: Friday, August 29, 2003 5:00 PM
To: Tag Libraries Users List
Subject: Re: Pass scrape taglib to a method (string)


Karen D. Wiens wrote:

> How can I pass the value of the scrape taglib to a method?  It seems
to
> me that it should be something like:
> 
> <% // snag text and stick it into 'teststring' 
> 
> String teststring = pageContext.getAttribute( "<scrp:result
> scrape="pj3"/>" );
> 
> %>

One approach:

  <c:set var="teststring"><scrp:result scrape="pj3"/></c:set>

HTH!
-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.




---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.504 / Virus Database: 302 - Release Date: 7/24/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.504 / Virus Database: 302 - Release Date: 7/24/2003
 


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.504 / Virus Database: 302 - Release Date: 7/24/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 9/1/2003
 


RE: Pass scrape taglib to a method (string)

Posted by "Karen D. Wiens" <ka...@polygon.net>.
Thank you for responding.  I've tried this and I'm still getting a
syntax error.

I replaced:
> <% // snag text and stick it into 'teststring' 
> 
> String teststring = pageContext.getAttribute( "<scrp:result
> scrape="pj3"/>" );

With:
<% // snag text and stick it into 'teststring' 
<c:set var="teststring"><scrp:result scrape="pj3"/></c:set>;
%>

And got the following error message:
(Thanks again for any help you can give)
Karen
*** Syntax: Unexpected symbol ignored



    88. 
           ^-^

*** Syntax: "AssignmentOperator AssignmentExpression" inserted to
complete Assignment



    88. 
           ^-^

*** Syntax: ";" inserted to complete ExpressionStatement



    88. 
                               <>

*** Syntax: misplaced construct(s)



    88. 
                                     <>

*** Syntax: ; expected instead of this token



    88. 
                                                          <--->

*** Syntax: Unexpected symbols ignored


-----Original Message-----
From: Hassan Schroeder [mailto:hassan@webtuitive.com] 
Sent: Friday, August 29, 2003 5:00 PM
To: Tag Libraries Users List
Subject: Re: Pass scrape taglib to a method (string)


Karen D. Wiens wrote:

> How can I pass the value of the scrape taglib to a method?  It seems
to
> me that it should be something like:
> 
> <% // snag text and stick it into 'teststring' 
> 
> String teststring = pageContext.getAttribute( "<scrp:result
> scrape="pj3"/>" );
> 
> %>

One approach:

  <c:set var="teststring"><scrp:result scrape="pj3"/></c:set>

HTH!
-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.




---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.504 / Virus Database: 302 - Release Date: 7/24/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.504 / Virus Database: 302 - Release Date: 7/24/2003
 


RE: Pass scrape taglib to a method (revisited)

Posted by "Karen D. Wiens" <ka...@polygon.net>.
That works perfectly!!  Thank you so much!!

-----Original Message-----
From: Kris Schneider [mailto:kris@dotech.com] 
Sent: Thursday, October 16, 2003 12:40 PM
To: Tag Libraries Users List
Subject: RE: Pass scrape taglib to a method (revisited)


Try:

<c:set var="teststring"><scrp:result scrape="pj4"/></c:set>
<jsp:useBean id="teststring" type="java.lang.String"/>
<%= teststring %>

Quoting "Karen D. Wiens" <ka...@polygon.net>:

> Hello all, 
> I understand this but the problem is that I need to use the output
> within a scriplet.  Is that possible?
> 
> <c:set var="teststring"><scrp:result scrape="pj4"/></c:set>
>   <c:out value="${teststring}" />
> Will output the string but I can't use it within a scriplet
> 
> If I call the variable teststring in a scriplet, like
> <%= teststring %>
>  I get: No entity named "teststring" was found in this environment
> 
> I tried changing the scope but that didn't help.  I need to pass this
> string to a method that someone else wrote....
> 
> I'm just getting started with these taglibs and appreciate any help
that
> anyone can give.
> Thank you,
> Karen
> 
> -----Original Message-----
> From: Hassan Schroeder [mailto:hassan@webtuitive.com] 
> Sent: Friday, August 29, 2003 5:00 PM
> To: Tag Libraries Users List
> Subject: Re: Pass scrape taglib to a method (string)
> 
> 
> Karen D. Wiens wrote:
> 
> > How can I pass the value of the scrape taglib to a method?  It seems
> to
> > me that it should be something like:
> > 
> > <% // snag text and stick it into 'teststring' 
> > 
> > String teststring = pageContext.getAttribute( "<scrp:result
> > scrape="pj3"/>" );
> > 
> > %>
> 
> One approach:
> 
>   <c:set var="teststring"><scrp:result scrape="pj3"/></c:set>
> 
> HTH!
> -- 
> Hassan Schroeder ----------------------------- hassan@webtuitive.com
> Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
> 
>                            dream.  code.

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.516 / Virus Database: 313 - Release Date: 9/1/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.516 / Virus Database: 313 - Release Date: 9/1/2003
 


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


RE: Pass scrape taglib to a method (revisited)

Posted by Kris Schneider <kr...@dotech.com>.
Try:

<c:set var="teststring"><scrp:result scrape="pj4"/></c:set>
<jsp:useBean id="teststring" type="java.lang.String"/>
<%= teststring %>

Quoting "Karen D. Wiens" <ka...@polygon.net>:

> Hello all, 
> I understand this but the problem is that I need to use the output
> within a scriplet.  Is that possible?
> 
> <c:set var="teststring"><scrp:result scrape="pj4"/></c:set>
>   <c:out value="${teststring}" />
> Will output the string but I can't use it within a scriplet
> 
> If I call the variable teststring in a scriplet, like
> <%= teststring %>
>  I get: No entity named "teststring" was found in this environment
> 
> I tried changing the scope but that didn't help.  I need to pass this
> string to a method that someone else wrote....
> 
> I'm just getting started with these taglibs and appreciate any help that
> anyone can give.
> Thank you,
> Karen
> 
> -----Original Message-----
> From: Hassan Schroeder [mailto:hassan@webtuitive.com] 
> Sent: Friday, August 29, 2003 5:00 PM
> To: Tag Libraries Users List
> Subject: Re: Pass scrape taglib to a method (string)
> 
> 
> Karen D. Wiens wrote:
> 
> > How can I pass the value of the scrape taglib to a method?  It seems
> to
> > me that it should be something like:
> > 
> > <% // snag text and stick it into 'teststring' 
> > 
> > String teststring = pageContext.getAttribute( "<scrp:result
> > scrape="pj3"/>" );
> > 
> > %>
> 
> One approach:
> 
>   <c:set var="teststring"><scrp:result scrape="pj3"/></c:set>
> 
> HTH!
> -- 
> Hassan Schroeder ----------------------------- hassan@webtuitive.com
> Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com
> 
>                            dream.  code.

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


RE: Pass scrape taglib to a method (revisited)

Posted by "Karen D. Wiens" <ka...@polygon.net>.
Hello all, 
I understand this but the problem is that I need to use the output
within a scriplet.  Is that possible?

<c:set var="teststring"><scrp:result scrape="pj4"/></c:set>
  <c:out value="${teststring}" />
Will output the string but I can't use it within a scriplet

If I call the variable teststring in a scriplet, like
<%= teststring %>
 I get: No entity named "teststring" was found in this environment

I tried changing the scope but that didn't help.  I need to pass this
string to a method that someone else wrote....

I'm just getting started with these taglibs and appreciate any help that
anyone can give.
Thank you,
Karen

-----Original Message-----
From: Hassan Schroeder [mailto:hassan@webtuitive.com] 
Sent: Friday, August 29, 2003 5:00 PM
To: Tag Libraries Users List
Subject: Re: Pass scrape taglib to a method (string)


Karen D. Wiens wrote:

> How can I pass the value of the scrape taglib to a method?  It seems
to
> me that it should be something like:
> 
> <% // snag text and stick it into 'teststring' 
> 
> String teststring = pageContext.getAttribute( "<scrp:result
> scrape="pj3"/>" );
> 
> %>

One approach:

  <c:set var="teststring"><scrp:result scrape="pj3"/></c:set>

HTH!
-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.




---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.504 / Virus Database: 302 - Release Date: 7/24/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.516 / Virus Database: 313 - Release Date: 9/1/2003
 


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: Pass scrape taglib to a method (string)

Posted by Hassan Schroeder <ha...@webtuitive.com>.
Karen D. Wiens wrote:

> How can I pass the value of the scrape taglib to a method?  It seems to
> me that it should be something like:
> 
> <% // snag text and stick it into 'teststring' 
> 
> String teststring = pageContext.getAttribute( "<scrp:result
> scrape="pj3"/>" );
> 
> %>

One approach:

  <c:set var="teststring"><scrp:result scrape="pj3"/></c:set>

HTH!
-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.