| Author |
how to parse a dynamic java generated string as a jsp page
|
Irma Nezirevic
Greenhorn
Joined: Mar 17, 2006
Posts: 2
|
|
Hello I have chosen to write a class which generates a large string filled with HTML code. Included in this string are a few taglibs references which are used to find the correct gif images. The problem is that when I return this string to the jsp page the taglibs are not executed. This ofcourse fair enogh since the jsp page expects to recieve a string result that is to be shown on the html page and nothing else. BUT I also need for the taglibs and eventually something else jsp related, to be parsed as it normally would be in a jsp page. Just to mentioned I have tried with out.println() and <&= %>. Is this possible?? :-) the pseudo code for the jsp page: <%@ taglib uri="/WEB-INF/tld/engine.tld" prefix="wps" %> ...html/jsp code here... //Here the class is called that generates the dynamic html string. //How do I get the jsp engine to parse this string as a part of the jsp //pages and not only handle it as an ordinary string. <%=HtmlGenerator().generateHTML(DataBean)%> ...html/jsp code here...
|
 |
Chetan Parekh
Ranch Hand
Joined: Sep 16, 2004
Posts: 3636
|
|
Welcome to JavaRanch Irma! When you call Taglibs in JSP page, they will be executed by the container and will be treated a special entity then HTML. When you call any method of pure-java-class-object, it does not executed by the container, hence Taglibs will not be treated as a special entity and hence you are facing problem.
|
My blood is tested +ve for Java.
|
 |
Irma Nezirevic
Greenhorn
Joined: Mar 17, 2006
Posts: 2
|
|
|
that sounds fun ;-) thanks for the answer
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
|
You might want to investigate the use of tag files if you are using a JSP 2.0 engine.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: how to parse a dynamic java generated string as a jsp page
|
|
|