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
Re: c:import for dynamic content
On 11/3/05, Robert Butera [EMAIL PROTECTED] wrote: 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. 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. -- Martin Cooper 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
RE: import for dynamic content
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:[EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: import for dynamic content
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 [EMAIL PROTECTED] 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:[EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]