tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Butera <robert.but...@gmail.com>
Subject Re: import for dynamic content
Date Fri, 04 Nov 2005 05:42:22 GMT
I am actually trying to execute a JSP file (dynamically) that is located on
the file system (outside of the webapp) at runtime.

The problem with using a JSP include is you can not execute JSP files
outside of the web-app let alone on the local file system of the server.

According to Martin my problem is as follows:

> That's because, since you are using a file URL, the request is not being
> made via HTTP, and thus is not being processed by a container as a JSP
page
> request. You'll need to use an HTTP (or HTTPS) URL to get the file
processed
> as JSP.

So the <c:import> will always only ever embed static content. The reason why
it would work as HTTP or HTTPS is because the container where the imported
file is retrieved takes care of processing it. I presume using "
ftp://dira/dirb/include-file.jsp" as the URL would have exactly the same
results as the "file://dira/dirb/include-file.jsp" import. So is there any
sort of trickery that would allow me to import a JSP directly from the
servers file system at runtime and have it processed?







On 11/4/05, Karr, David <david.karr@wamu.net> wrote:
>
> The "c:import" tag is like the JSP include "action", as opposed to the
> JSP include "directive". It's important to understand the difference
> between these two. The latter includes at compile time, and the former
> includes at run time. In other words, the include action executes the
> specified resource and returns the data it generates. The include
> directive just inserts the text of the specified file before compiling
> the JSP. The resource specified by the include action is a URL, and for
> the include directive, a file.
>
> What's interesting is that apparently referencing a JSP with a "file"
> URL generates dynamic content, but it's simply the text in the file.
>
> This really gets down to determining what it is you really need. Do you
> need to insert the contents of that file into the calling JSP at compile
> time, or do you need the container to execute the JSP and return the
> dynamic content? I'm guessing you really mean the former. If that's
> the case, then just use a JSP include directive (although you might
> consider changing the extent on the included file to ".jspf", for "JSP
> fragment").
>
> > -----Original Message-----
> > From: Robert Butera [mailto:robert.butera@gmail.com]
> > Sent: Thursday, November 03, 2005 8:53 PM
> > To: taglibs-user@jakarta.apache.org
> > Subject: c:import for dynamic content
> >
> >
> > I am attempting to import a JSP file into a JSP using the
> > <c:import> tag.
> >
> > The line looks something like this:
> > ...
> > <c:import url="file://c:/dira/dirb/imported-file.jsp"/>
> > ..
> >
> > "imported-file.jsp" is being found ok, but it is not being
> > processed as a JSP, it is appearing as static text. I am
> > using some struts tags in " imported-file.jsp" that are just
> > getting sent to the browser. Is there something I'm doing
> > wrong here? Is there something I need to place around the
> > <c:import> to make the imported file get processed?
> >
> > I am running this on jboss 4.0.1 (tomcat 5.0) with JSTL 1.1.
> >
> > Any help would be greatly appreciated.
> >
> > Rob
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message