Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 19th, 2002, 06:51 PM
diggity diggity is offline
Just Diggity
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2001
Location: Sherman Oaks, CA
Posts: 126 diggity User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
evaluating jsp code within a jsp string

So heres the deal, I've got content in a sql table containing a custom tag (taglib), I return this data to a jsp, but I cannot get the jsp to parse the tag...

Any help would be appreciated!

Thanks

Here's a better example:

<%
String tag = "<first:helloparam name=\"Diggz\"/>";
out.println(tag);
%>

How do u get that to work?
__________________
Dave Pedowitz

Reply With Quote
  #2  
Old March 19th, 2002, 10:05 PM
Marky_Mark Marky_Mark is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: On a screen near you
Posts: 498 Marky_Mark User rank is Private First Class (20 - 50 Reputation Level)Marky_Mark User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Using beans would be a better solution


Mark
__________________
100 trillion calculations per nanosecond

Reply With Quote
  #3  
Old March 21st, 2002, 05:58 PM
diggity diggity is offline
Just Diggity
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2001
Location: Sherman Oaks, CA
Posts: 126 diggity User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Could u please elaborate?

Reply With Quote
  #4  
Old March 29th, 2002, 03:15 AM
aabha aabha is offline
Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Location: India
Posts: 7 aabha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to aabha
Jsp is a server side scripting language...only webservers can interpret these tags...and out.println is used to print values into webbrowser and webbrowsers cannot interpret these tags...

Reply With Quote
  #5  
Old March 29th, 2002, 02:30 PM
diggity diggity is offline
Just Diggity
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2001
Location: Sherman Oaks, CA
Posts: 126 diggity User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
I understand all that, but is there a way to evaluate that code... Please see my original post, on what the real question is, the other is just an example...

Reply With Quote
  #6  
Old April 29th, 2003, 04:14 PM
karanvb karanvb is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 0 karanvb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
did anyone find a solution to this ? I have a similar problem ...

Reply With Quote
  #7  
Old April 29th, 2003, 05:10 PM
diggity diggity is offline
Just Diggity
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2001
Location: Sherman Oaks, CA
Posts: 126 diggity User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
I never did

Reply With Quote
  #8  
Old May 1st, 2003, 08:30 PM
Nemi Nemi is offline
Clueless llama
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Feb 2001
Location: Lincoln, NE. USA
Posts: 2,353 Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Days 12 h 35 m 19 sec
Reputation Power: 111
As far as I know you cannot output jsp taglib tags in a scriptlet. However, you can use runtime expressions for your taglib tags.

So, even though this won't work
Code:
<%
String someVar = "Diggz";
String tag = "<first:helloparam name=\"" + someVar + "\"/>";
out.println(tag);
%>

This will
Code:
<%
String someVar = "Diggz";
%>
<first:helloparam name='<%= someVar %>'/>


With the example you gave, what you are doing does not make sense for reasons I just pointed out. If you post your real code I may be able to give you more specific help.

Reply With Quote
  #9  
Old May 1st, 2003, 10:33 PM
diggity diggity is offline
Just Diggity
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2001
Location: Sherman Oaks, CA
Posts: 126 diggity User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Ya, it'd be really difficult to write something that would compile a JSP and then try to compile a tag... but it might be possible using say XSL...

My original idea was it'd be cool if you could store data such as:

"
this is stored in a table
<taglib do="stuff">
"

and the taglib would also do something dynamic

Reply With Quote
  #10  
Old June 26th, 2003, 11:36 AM
Mylacc Mylacc is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 0 Mylacc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Same problem here

I am using a custom lag library in which when the tag that I am using is decoded becomes a URL depending on the parameters. Has no one still found a way to do:

Sting temp = <test:URL render="Test" />

I have tried to put this through URLencoder and URLdecoder but it comes out the same, it is not decoded. Any help would be very appreciated.

Reply With Quote
  #11  
Old June 26th, 2003, 02:56 PM
Nemi Nemi is offline
Clueless llama
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Feb 2001
Location: Lincoln, NE. USA
Posts: 2,353 Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Days 12 h 35 m 19 sec
Reputation Power: 111
I have already pointed out that what you are doing is unnecessary. Why do you have to have a string variable evaluated to a jsp tag when a jsp tag will take variables?

Reply With Quote
  #12  
Old June 26th, 2003, 04:06 PM
Mylacc Mylacc is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 0 Mylacc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
The tag I need decoded in the JSP creates a URL which I need to use to in my JSP to create a PDF of what the HTML page is showing. It is someone else's tag and I haven't dealt with them so I do not know how or where to modify it. I assume custom tags are server side as well as the JSP but are they run before or after the JSP is compiled?

Reply With Quote
  #13  
Old June 26th, 2003, 09:53 PM
Nemi Nemi is offline
Clueless llama
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Feb 2001
Location: Lincoln, NE. USA
Posts: 2,353 Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Days 12 h 35 m 19 sec
Reputation Power: 111
I believe tags are converted over to java code at compile time. You cannot dynamically output jsp tags using code because of this, but you can do something like this:
Code:
<%
String temp = "www.ThisIsSomeUrlFromSomewhere.com";
%>
 <test:URL render="<%= temp %>" />

The tag will be replaced by the compiler at compile time with the appropriate java code and the variable "temp" will be used for the render attribute. This is assuming the tag is set up to accept runtime values. If you are not sure what those are, I suggest a taglib tutorial.
http://java.sun.com/products/jsp/tu...brariesTOC.html

Reply With Quote
  #14  
Old June 27th, 2003, 09:07 AM
Mylacc Mylacc is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 0 Mylacc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I will take a look at the tutorial, thank you for the link. But first I just wanted to clarify my situation better because what you are suggesting really wouldn't work. I am using someone elses custom tag, I don't want to edit it, I am sure if I could edit it I could set a variable somewhere but I can't (yet, maybe the tutorial will help). And this custom tag creates a URL to the output stream which I want to use in my JSP code on the same page. The way you would use the tag is <img src='<imgURL blah />'> but I need the URL inside my code. Let me take a look at that tutorial now, but if you understand better and know a solution please feel free to let me know, thank you.

Reply With Quote
  #15  
Old June 27th, 2003, 10:30 AM
Mylacc Mylacc is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 0 Mylacc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks so much Nemi, that tutorial did the trick, I just needed to know how the Tag Handler was Invoked and I was able to manipulate that to get what I wanted, thanks!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > evaluating jsp code within a jsp string


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump