Hi there,

> this was as i was telling you...use a JSP custom tag that can include XML
> code.
>  you can generate it dynamically from the data of your JavaBean.
> in the implementation of your tag you will process it with XML...

Well..one of the problems is that we are still using JRun 2.3.3, which is
non JSP 1.1 compliant. Thus, I can't use tag-libs for this project.

> > 1) How to read in a JSP page so that it is processed and I
> > get the output as
> > if a browser asked for the page.
>
> just for curiosity...why would you like to do something like
> that??? i guess
> that means some changes in the jspServlet (??)

Because, if JSP can output XML (by supplying the text/xml contentType), then
I can dynamically create XML tags based on data in the javabean. I can do
something like:

<%
  if( bean.getName().length() > 0 )
  {
%>
    <name><%= bean.getName() %></name>
<%
  }
  else
  {
%>
    <name>NO NAME AVAILABLE</name>
<%
  }
%>

While the output will end up being a series of XML tags, I can utilize the
ability of including conditional and loops via JSP to create the XML tags
that are sent to the output. As we will be keeping the XSL page to use in
the bean, the ControllerServlet I have written will use the beans XSL getter
method to get the path/name of the XSL to use. Therefore, depending on some
action, a bean can have a random XSL name to apply to the XML output. This
might be useful in the case of where a client might like a specific layout
of the page, or maybe to use WML output instead of HTML output. It will
allow dynamic "run-time" selection of the xsl to use against the output of
the XML the JSP page returns.

I am wondering, is it ALWAYS guaranteed that if you specify
contentType="text/xml" in a JSP page, it will return XML? Does this work
with all servlet engines? Or is this a feature that each vendor must
implement for it to work?

>
> > 2) How to read in an XSL doc from the local file system (or
> > from a URL, if
> > need be so that it can handle networking aspects).
>
>
> you use file:///

I don't mean from a web browser. I mean in code..is it something like:

URL url = new URL("http://www.xxx.com/path/page.jsp");
FileInputStream fis = new FileInputStream(url.openStream());

Or is there some other way to actually invoke a resource from a web site, in
code, so as to get the web server to do whatever it does to produce the
output (in this case, the above "should" invoke the JSP page much like a
browser would..and get the HTML output, not the actual text that comprises
the JSP page).

If it is not supported by all servlet engines, then is there some standard
way, tool, app, etc that can handle this?

Thanks again.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to