aspose file tools*
The moose likes JSP and the fly likes how to parse a dynamic java generated string as a jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "how to parse a dynamic java generated string as a jsp page" Watch "how to parse a dynamic java generated string as a jsp page" New topic
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: 61434
    
  67

You might want to investigate the use of tag files if you are using a JSP 2.0 engine.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
 
subject: how to parse a dynamic java generated string as a jsp page