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: c:import and context attribute
Dylan MacDonald [EMAIL PROTECTED] wrote on 07/13/2005 05:41:46 PM: Can someone explain the context attribute in the c:import tag? snip/ It is used in cross-context imports and is the name of the context you're importing from. Most containers need to be configured to enable cross-context access. I'm working in a development environment that differs from the production environment in that the root of the server isn't /, it's /www (the production root is obviously /). snap/ I'm not sure I got this (I thought for a bit you were implying the difference between deploying, say, ROOT.war and mywebapp.war on Tomcat). In any case, relative urls like the one in the first c:import below should work if you are migrating all the contents of the context from the production to the dev environment. Portable code will prepend the context path obtained from the request at JSP invocation to any urls that need it. I don't think there is a cross-context angle to your problem, in reference to your earlier question about the context attribute. -Rahul Needless to say this makes it difficult to code anything with root-relative (e.g. /images/logo.gif) links. I can probably work around some of this but I thought I might be able to solve some of my issues with my jsp includes using the context attribute. But I cannot get it to work. I assumed I would change my c:import tag from this c:import url=includes/footer.jsp / to this: c:import url=/includes/footer.jsp context=/www / but that doesn't work. Any ideas? Thanks, Dylan MacDonald
RE: c:import problem
Hi Kris, Thanks for the reply. I have managed to get it worked out, but only be looking even closer at the Tomcat source. It turns out to be the way Tomcat wraps a request when using a RequestDispatcher. If the request given to the dispatcher is a wrapper, Tomcat will look up the chain until it finds the real original non-wrapped request, and wrap that. That was a bit different than the behaviour I expected (I assumed it would wrap my own wrapper, not look for the original request). I modified my own wrapper's getParameter() method to call super.getParameter() and now it works. This behavour isn't specified in the servlet spec or the Tomcat docs... Maybe it should be (would've saved me 5 hours of debugging). But I'll bring that up on an appropriate list and not here. Thanks again for replying. Christian -Original Message- From: Kris Schneider [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 20, 2004 4:03 PM To: Tag Libraries Users List Subject: Re: c:import problem Christian, Not sure if you're still wrestling with this, but I just wanted to post to say that I've been meaning to slap a little test app together as a sanity check and I'll post back when I get the chance to code run it... Quoting Christian Taylor [EMAIL PROTECTED]: Hi, I'm new to this list, but far from a newbie when it comes to servlets, JSP, JSTL and Tomcat. I've spent hours trying to debug this problem, searched the net and mailing lists and haven't been able to find a solution. Here is my situation: My application has many pages that use c:import to include a common header. The header takes a title parameter. I've seen other people doing this in the archives of this list. My code looks like this: c:import url=/include/header.jsp c:param name=title value=Title of the page/ /c:import header.jsp uses the title for the title tag as well as to display to the user at the top of the page. These pages can be accessed in two different ways: 1) By a normal user of the application through a web browser 2) From a servlet that uses RequestDispatchers to capture some pages to save as files that can be viewed offline. The problem I'm having is with #2. The title parameter does NOT get passed to header.jsp, and neither do request-scoped variables. My offline servlet creates request and response wrappers to pass to the RequestDispatcher's include() method. The wrapped request overrides the relevent parameter methods (getParameter(), getParameterMap(), etc.) and provides setter methods so I can pass parameters to the pages to be captured. It also defines a request-scoped variable called _OfflineBackup which the pages can use to detect how they are being accessed (some paths, etc. need to be different if the page is to work offline). My response wrapper is a typical override getOutputStream() and getWriter() to capture the output type of thing. I've looked through the Tomcat and taglibs-standard sources and can't find anything that would help. The code for the c:import tag appears to build a query string from the c:param tags and pass it as part of the URL to the RequestDispatcher it creates, but Tomcat's ApplicationDispatcher implementation doesn't seem to do anything with it, from what I can see in the source (but I'm not a Tomcat developer and am not that familiar with the source). The parameters in the wrapped request can be accessed from header.jsp, but not the actual parameters passed to header.jsp using c:param. This all leads me to my real question... why does my 'title' parameter work fine when I simply view the pages normally in a browser, but not when I use a RequestDispatcher and my wrapped request/response? The problem appears to be that Tomcat doesn't look at the parameters in the path when getRequestDispatcher(path) is called, which makes me wonder why the c:param tag ever works at all (but as I said, I'm not a Tomcat developer and have limited knowledge of the source so I could be wrong here, this is just what I've found from digging through the sources). My wrappers seem to be working fine, and the import works properly when viewing the page in a browser. I hope I explained everything well enough and I apologize for this being a bit long. I'm using Tomcat 5.0.28 and taglibs-standard 1.1.1. This is a servlet 2.4/jsp 2.0 application. Thanks in advance to anyone who might be able to help me here! Christian -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import problem
Christian, Not sure if you're still wrestling with this, but I just wanted to post to say that I've been meaning to slap a little test app together as a sanity check and I'll post back when I get the chance to code run it... Quoting Christian Taylor [EMAIL PROTECTED]: Hi, I'm new to this list, but far from a newbie when it comes to servlets, JSP, JSTL and Tomcat. I've spent hours trying to debug this problem, searched the net and mailing lists and haven't been able to find a solution. Here is my situation: My application has many pages that use c:import to include a common header. The header takes a title parameter. I've seen other people doing this in the archives of this list. My code looks like this: c:import url=/include/header.jsp c:param name=title value=Title of the page/ /c:import header.jsp uses the title for the title tag as well as to display to the user at the top of the page. These pages can be accessed in two different ways: 1) By a normal user of the application through a web browser 2) From a servlet that uses RequestDispatchers to capture some pages to save as files that can be viewed offline. The problem I'm having is with #2. The title parameter does NOT get passed to header.jsp, and neither do request-scoped variables. My offline servlet creates request and response wrappers to pass to the RequestDispatcher's include() method. The wrapped request overrides the relevent parameter methods (getParameter(), getParameterMap(), etc.) and provides setter methods so I can pass parameters to the pages to be captured. It also defines a request-scoped variable called _OfflineBackup which the pages can use to detect how they are being accessed (some paths, etc. need to be different if the page is to work offline). My response wrapper is a typical override getOutputStream() and getWriter() to capture the output type of thing. I've looked through the Tomcat and taglibs-standard sources and can't find anything that would help. The code for the c:import tag appears to build a query string from the c:param tags and pass it as part of the URL to the RequestDispatcher it creates, but Tomcat's ApplicationDispatcher implementation doesn't seem to do anything with it, from what I can see in the source (but I'm not a Tomcat developer and am not that familiar with the source). The parameters in the wrapped request can be accessed from header.jsp, but not the actual parameters passed to header.jsp using c:param. This all leads me to my real question... why does my 'title' parameter work fine when I simply view the pages normally in a browser, but not when I use a RequestDispatcher and my wrapped request/response? The problem appears to be that Tomcat doesn't look at the parameters in the path when getRequestDispatcher(path) is called, which makes me wonder why the c:param tag ever works at all (but as I said, I'm not a Tomcat developer and have limited knowledge of the source so I could be wrong here, this is just what I've found from digging through the sources). My wrappers seem to be working fine, and the import works properly when viewing the page in a browser. I hope I explained everything well enough and I apologize for this being a bit long. I'm using Tomcat 5.0.28 and taglibs-standard 1.1.1. This is a servlet 2.4/jsp 2.0 application. Thanks in advance to anyone who might be able to help me here! Christian -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import Not Throwing Error For Bad In-Context-JSP url Attribute
I think this is addressed in the 7.4 c:import section of the JSTL 1.0 Spec. There's an explanation of how errors are handled for internal vs. external resources. Give it a look and see if it helps. James Watkin wrote: There seems to be an inconsistent behavior in the way c:import throws errors for non-existent files. When the c:import url attribute is an in-context-jsp (like pageHeader.jsp) that doesn't exist, no error is thrown. However, when the url attribute is a file: that doesn't exist, an error is thrown. Can anyone confirm, or explain this behavior? I'm using the following pattern: c:catch var=importError c:import url=${param.pageURL}/ /c:catch c:if test=${not empty importError} c:out value=${importError.message}/ /c:if Thank you. - Jim __ James Watkin ACIS Software Development The Anderson School at UCLA [EMAIL PROTECTED] Voice: 1-310-825-5030 Fax: 1-310-825-4835 __ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import Not Throwing Error For Bad In-Context-JSP url Attribute
I'm not an expert in this area, but after looking at the spec: http://jcp.org/aboutJava/communityprocess/final/jsr052/index.html it seems like a JspException should be thrown, even for internal URLs. It's quite possible that I'm overlooking something though. - Jim At 05:50 PM 1/22/2004 -0500, you wrote: I think this is addressed in the 7.4 c:import section of the JSTL 1.0 Spec. There's an explanation of how errors are handled for internal vs. external resources. Give it a look and see if it helps. James Watkin wrote: There seems to be an inconsistent behavior in the way c:import throws errors for non-existent files. When the c:import url attribute is an in-context-jsp (like pageHeader.jsp) that doesn't exist, no error is thrown. However, when the url attribute is a file: that doesn't exist, an error is thrown. Can anyone confirm, or explain this behavior? I'm using the following pattern: c:catch var=importError c:import url=${param.pageURL}/ /c:catch c:if test=${not empty importError} c:out value=${importError.message}/ /c:if Thank you. - Jim __ James Watkin ACIS Software Development The Anderson School at UCLA [EMAIL PROTECTED] Voice: 1-310-825-5030 Fax: 1-310-825-4835 __ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ James Watkin ACIS Software Development The Anderson School at UCLA [EMAIL PROTECTED] Voice: 1-310-825-5030 Fax: 1-310-825-4835 __ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import Not Throwing Error For Bad In-Context-JSP url Attribute
For an internal URL, try the equivalent JSP: % String path = request.getParameter(pageURL); RequestDispatcher rd = request.getRequestDispatcher(path); rd.include(request, response); % It seems to behave the same way. With TC 4.1.29, I don't see any log info about the include, but on WLS 8.1.2 I get the following: ...Included resource or file /foo.jsp not found from requested resource /import.jsp. No exceptions are thrown, however, just an error logged. James Watkin wrote: I'm not an expert in this area, but after looking at the spec: http://jcp.org/aboutJava/communityprocess/final/jsr052/index.html it seems like a JspException should be thrown, even for internal URLs. It's quite possible that I'm overlooking something though. - Jim At 05:50 PM 1/22/2004 -0500, you wrote: I think this is addressed in the 7.4 c:import section of the JSTL 1.0 Spec. There's an explanation of how errors are handled for internal vs. external resources. Give it a look and see if it helps. James Watkin wrote: There seems to be an inconsistent behavior in the way c:import throws errors for non-existent files. When the c:import url attribute is an in-context-jsp (like pageHeader.jsp) that doesn't exist, no error is thrown. However, when the url attribute is a file: that doesn't exist, an error is thrown. Can anyone confirm, or explain this behavior? I'm using the following pattern: c:catch var=importError c:import url=${param.pageURL}/ /c:catch c:if test=${not empty importError} c:out value=${importError.message}/ /c:if Thank you. - Jim __ James Watkin ACIS Software Development The Anderson School at UCLA [EMAIL PROTECTED] Voice: 1-310-825-5030 Fax: 1-310-825-4835 __ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ James Watkin ACIS Software Development The Anderson School at UCLA [EMAIL PROTECTED] Voice: 1-310-825-5030 Fax: 1-310-825-4835 __ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import: relative links inside WEB-INF don't work
Right, James, that is why I said something LIKE struts. Micael At 12:08 PM 10/10/2003 -0400, you wrote: No you don't. That has nothing to do with Struts. You just need to understand how includes and imports work. http://java.sun.com/products/jsp/syntax/1.1/syntaxref1112.html http://java.sun.com/products/jsp/syntax/1.1/syntaxref117.html#8772 http://java.sun.com/webservices/docs/1.0/tutorial/doc/JSTL5.html#64122 -- James Mitchell Software Engineer / Struts Evangelist http://www.struts-atlanta.org 678.910.8017 770.822.3359 AIM:jmitchtx - Original Message - From: Micael [EMAIL PROTECTED] To: Tag Libraries Users List [EMAIL PROTECTED]; Tag Libraries Users List [EMAIL PROTECTED] Sent: Friday, October 10, 2003 12:01 PM Subject: Re: c:import: relative links inside WEB-INF don't work You need to use something like struts to operate inside WEB-INF. At 05:34 PM 10/7/2003 -0400, Manolo Ramirez T. wrote: Hi, I have this problem with Tomcat 4.1.24 and taglibs-standard 1.0.3. When I try lo include a jsp inside WEB-INF I must to use an absolute url, this are my files: ### # /WEB-INF/jsp/prueba.jsp # ### %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % c:import url=prueba2.jsp/ %-- doesn't work! --% # /WEB-INF/jsp/prueba1.jsp # %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % c:import url=/WEB-INF/jsp/prueba2.jsp/ %-- works fine --% # /WEB-INF/jsp/prueba2.jsp # HELLO WORLD! #/END jsp:include works well with relative url's, What I'm missing? Is there any way to use c:import to do this?. Help please. Thanks in advance. Manolo Ramirez T. PD: forgive my english! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] LEGAL NOTICE This electronic mail transmission and any accompanying documents contain information belonging to the sender which may be confidential and legally privileged. This information is intended only for the use of the individual or entity to whom this electronic mail transmission was sent as indicated above. If you are not the intended recipient, any disclosure, copying, distribution, or action taken in reliance on the contents of the information contained in this transmission is strictly prohibited. If you have received this transmission in error, please delete the message. Thank you - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] LEGAL NOTICE This electronic mail transmission and any accompanying documents contain information belonging to the sender which may be confidential and legally privileged. This information is intended only for the use of the individual or entity to whom this electronic mail transmission was sent as indicated above. If you are not the intended recipient, any disclosure, copying, distribution, or action taken in reliance on the contents of the information contained in this transmission is strictly prohibited. If you have received this transmission in error, please delete the message. Thank you - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import: relative links inside WEB-INF don't work
Jim, the question is not how you can include a jsp but go to a jsp. Those are radically different issues when inside WEB-INF. At 12:08 PM 10/10/2003 -0400, you wrote: No you don't. That has nothing to do with Struts. You just need to understand how includes and imports work. http://java.sun.com/products/jsp/syntax/1.1/syntaxref1112.html http://java.sun.com/products/jsp/syntax/1.1/syntaxref117.html#8772 http://java.sun.com/webservices/docs/1.0/tutorial/doc/JSTL5.html#64122 -- James Mitchell Software Engineer / Struts Evangelist http://www.struts-atlanta.org 678.910.8017 770.822.3359 AIM:jmitchtx - Original Message - From: Micael [EMAIL PROTECTED] To: Tag Libraries Users List [EMAIL PROTECTED]; Tag Libraries Users List [EMAIL PROTECTED] Sent: Friday, October 10, 2003 12:01 PM Subject: Re: c:import: relative links inside WEB-INF don't work You need to use something like struts to operate inside WEB-INF. At 05:34 PM 10/7/2003 -0400, Manolo Ramirez T. wrote: Hi, I have this problem with Tomcat 4.1.24 and taglibs-standard 1.0.3. When I try lo include a jsp inside WEB-INF I must to use an absolute url, this are my files: ### # /WEB-INF/jsp/prueba.jsp # ### %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % c:import url=prueba2.jsp/ %-- doesn't work! --% # /WEB-INF/jsp/prueba1.jsp # %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % c:import url=/WEB-INF/jsp/prueba2.jsp/ %-- works fine --% # /WEB-INF/jsp/prueba2.jsp # HELLO WORLD! #/END jsp:include works well with relative url's, What I'm missing? Is there any way to use c:import to do this?. Help please. Thanks in advance. Manolo Ramirez T. PD: forgive my english! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] LEGAL NOTICE This electronic mail transmission and any accompanying documents contain information belonging to the sender which may be confidential and legally privileged. This information is intended only for the use of the individual or entity to whom this electronic mail transmission was sent as indicated above. If you are not the intended recipient, any disclosure, copying, distribution, or action taken in reliance on the contents of the information contained in this transmission is strictly prohibited. If you have received this transmission in error, please delete the message. Thank you - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] LEGAL NOTICE This electronic mail transmission and any accompanying documents contain information belonging to the sender which may be confidential and legally privileged. This information is intended only for the use of the individual or entity to whom this electronic mail transmission was sent as indicated above. If you are not the intended recipient, any disclosure, copying, distribution, or action taken in reliance on the contents of the information contained in this transmission is strictly prohibited. If you have received this transmission in error, please delete the message. Thank you - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import: relative links inside WEB-INF don't work
As an aside, you certainly can, and I think should, execute JSPs within WEB-INF. I even execute my resources within WEB-INF. At 04:55 PM 10/7/2003 -0400, Serge Knystautas wrote: You shouldn't be able to execute JSPs within your WEB-INF, so all 3 of your examples should be forbidden. I think you might want to submit a bug report to whatever servlet engine you're using. -- Serge Knystautas President Lokitech software . strategy . design http://www.lokitech.com p. 301.656.5501 e. [EMAIL PROTECTED] Manolo Ramirez T. wrote: Hi, I have this problem with Tomcat 4.1.24 and taglibs-standard 1.0.3. When I try lo include a jsp inside WEB-INF I must to use an absolute url, this are my files: ### # /WEB-INF/jsp/prueba.jsp # ### %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % c:import url=prueba2.jsp/ %-- doesn't work! --% # /WEB-INF/jsp/prueba1.jsp # %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % c:import url=/WEB-INF/jsp/prueba2.jsp/ %-- works fine --% # /WEB-INF/jsp/prueba2.jsp # HELLO WORLD! #/END jsp:include works well with relative url's, What I'm missing? Is there any way to use c:import to do this?. Help please. Thanks in advance. Manolo Ramirez T. PD: forgive my english! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] LEGAL NOTICE This electronic mail transmission and any accompanying documents contain information belonging to the sender which may be confidential and legally privileged. This information is intended only for the use of the individual or entity to whom this electronic mail transmission was sent as indicated above. If you are not the intended recipient, any disclosure, copying, distribution, or action taken in reliance on the contents of the information contained in this transmission is strictly prohibited. If you have received this transmission in error, please delete the message. Thank you - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import: relative links inside WEB-INF don't work
You need to use something like struts to operate inside WEB-INF. At 05:34 PM 10/7/2003 -0400, Manolo Ramirez T. wrote: Hi, I have this problem with Tomcat 4.1.24 and taglibs-standard 1.0.3. When I try lo include a jsp inside WEB-INF I must to use an absolute url, this are my files: ### # /WEB-INF/jsp/prueba.jsp # ### %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % c:import url=prueba2.jsp/ %-- doesn't work! --% # /WEB-INF/jsp/prueba1.jsp # %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % c:import url=/WEB-INF/jsp/prueba2.jsp/ %-- works fine --% # /WEB-INF/jsp/prueba2.jsp # HELLO WORLD! #/END jsp:include works well with relative url's, What I'm missing? Is there any way to use c:import to do this?. Help please. Thanks in advance. Manolo Ramirez T. PD: forgive my english! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] LEGAL NOTICE This electronic mail transmission and any accompanying documents contain information belonging to the sender which may be confidential and legally privileged. This information is intended only for the use of the individual or entity to whom this electronic mail transmission was sent as indicated above. If you are not the intended recipient, any disclosure, copying, distribution, or action taken in reliance on the contents of the information contained in this transmission is strictly prohibited. If you have received this transmission in error, please delete the message. Thank you - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import: relative links inside WEB-INF don't work
You shouldn't be able to execute JSPs within your WEB-INF, so all 3 of your examples should be forbidden. I think you might want to submit a bug report to whatever servlet engine you're using. -- Serge Knystautas President Lokitech software . strategy . design http://www.lokitech.com p. 301.656.5501 e. [EMAIL PROTECTED] Manolo Ramirez T. wrote: Hi, I have this problem with Tomcat 4.1.24 and taglibs-standard 1.0.3. When I try lo include a jsp inside WEB-INF I must to use an absolute url, this are my files: ### # /WEB-INF/jsp/prueba.jsp # ### %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % c:import url=prueba2.jsp/ %-- doesn't work! --% # /WEB-INF/jsp/prueba1.jsp # %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % c:import url=/WEB-INF/jsp/prueba2.jsp/ %-- works fine --% # /WEB-INF/jsp/prueba2.jsp # HELLO WORLD! #/END jsp:include works well with relative url's, What I'm missing? Is there any way to use c:import to do this?. Help please. Thanks in advance. Manolo Ramirez T. PD: forgive my english! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import: relative links inside WEB-INF don't work
Hi, I'm using jsp's outside WEB-INF to include prueba and prueba1, I forget to say that. _ Manolo Ramirez T. Serge Knystautas wrote: You shouldn't be able to execute JSPs within your WEB-INF, so all 3 of your examples should be forbidden. I think you might want to submit a bug report to whatever servlet engine you're using. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import: relative links inside WEB-INF don't work
Manolo Ramirez T. wrote: Hi, I'm using jsp's outside WEB-INF to include prueba and prueba1, I forget to say that. In that case, you'd want the following: %@ taglib uri=http://java.sun.com/jstl/core; prefix=c % c:import url=WEB-INF/prueba2.jsp/ -- Pierre _ Manolo Ramirez T. Serge Knystautas wrote: You shouldn't be able to execute JSPs within your WEB-INF, so all 3 of your examples should be forbidden. I think you might want to submit a bug report to whatever servlet engine you're using. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import
Make sure that you are clear on the differences between c:import jsp:include and @include they are all different and in my case the fact that the imported page has no knowledge of my context hosed me. R Billy Bacon wrote: I've looked through the archives and the suggested alternative for a dynamic jsp:include reference is using the c:import url=${xyz}/. This is not working in my JSP. The tag is including nothing in my page. I've even tried to give it a static reference to the jsp c:import url=xyzPage.jsp/ and still nothing. Does anyone know what's wrong? - Billy - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import
Yes, I am importing the core library, I have plenty of other c: tags within my jsp and they work perfectly that's why it confuses me that's it not working. Seems like a pretty simple tag to use. Before trying to convert this to JSTL I had bean:define tag (from Struts) and a jsp:include page=%= xyz %/ tag and things worked fine. But now I get nothing... On 9/17/03 10:38 AM, Rick Ross [EMAIL PROTECTED] wrote: Make sure that you are clear on the differences between c:import jsp:include and @include they are all different and in my case the fact that the imported page has no knowledge of my context hosed me. R Billy Bacon wrote: I've looked through the archives and the suggested alternative for a dynamic jsp:include reference is using the c:import url=${xyz}/. This is not working in my JSP. The tag is including nothing in my page. I've even tried to give it a static reference to the jsp c:import url=xyzPage.jsp/ and still nothing. Does anyone know what's wrong? - Billy - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import
I tried catching any exceptions and nothing was printed to the screen :-/ On 9/17/03 10:41 AM, Rick Ross [EMAIL PROTECTED] wrote: Also, you might wanna do this to see if an error occurred: c:catch var=ex c:import url=${viewPage}/ /c:catch c:if test=${not empty ex} c:out value=${ex} / /c:if Billy Bacon wrote: I've looked through the archives and the suggested alternative for a dynamic jsp:include reference is using the c:import url=${xyz}/. This is not working in my JSP. The tag is including nothing in my page. I've even tried to give it a static reference to the jsp c:import url=xyzPage.jsp/ and still nothing. Does anyone know what's wrong? - Billy - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import
Is xyz only a scripting variable or is it also a scoped variable? Quoting Billy Bacon [EMAIL PROTECTED]: Yes, I am importing the core library, I have plenty of other c: tags within my jsp and they work perfectly that's why it confuses me that's it not working. Seems like a pretty simple tag to use. Before trying to convert this to JSTL I had bean:define tag (from Struts) and a jsp:include page=%= xyz %/ tag and things worked fine. But now I get nothing... On 9/17/03 10:38 AM, Rick Ross [EMAIL PROTECTED] wrote: Make sure that you are clear on the differences between c:import jsp:include and @include they are all different and in my case the fact that the imported page has no knowledge of my context hosed me. R Billy Bacon wrote: I've looked through the archives and the suggested alternative for a dynamic jsp:include reference is using the c:import url=${xyz}/. This is not working in my JSP. The tag is including nothing in my page. I've even tried to give it a static reference to the jsp c:import url=xyzPage.jsp/ and still nothing. Does anyone know what's wrong? - Billy - -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import
It's a scoped variable. But I think the problem is elsewhere because even this doesn't work for me and no exception is thrown... c:import url=myJspPage.jsp / Any ideas? On 9/17/03 11:34 AM, Kris Schneider [EMAIL PROTECTED] wrote: Is xyz only a scripting variable or is it also a scoped variable? Quoting Billy Bacon [EMAIL PROTECTED]: Yes, I am importing the core library, I have plenty of other c: tags within my jsp and they work perfectly that's why it confuses me that's it not working. Seems like a pretty simple tag to use. Before trying to convert this to JSTL I had bean:define tag (from Struts) and a jsp:include page=%= xyz %/ tag and things worked fine. But now I get nothing... On 9/17/03 10:38 AM, Rick Ross [EMAIL PROTECTED] wrote: Make sure that you are clear on the differences between c:import jsp:include and @include they are all different and in my case the fact that the imported page has no knowledge of my context hosed me. R Billy Bacon wrote: I've looked through the archives and the suggested alternative for a dynamic jsp:include reference is using the c:import url=${xyz}/. This is not working in my JSP. The tag is including nothing in my page. I've even tried to give it a static reference to the jsp c:import url=xyzPage.jsp/ and still nothing. Does anyone know what's wrong? - Billy - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import
Have you tried a context-relative path (starts with /) to the page? Quoting Billy Bacon [EMAIL PROTECTED]: It's a scoped variable. But I think the problem is elsewhere because even this doesn't work for me and no exception is thrown... c:import url=myJspPage.jsp / Any ideas? On 9/17/03 11:34 AM, Kris Schneider [EMAIL PROTECTED] wrote: Is xyz only a scripting variable or is it also a scoped variable? Quoting Billy Bacon [EMAIL PROTECTED]: Yes, I am importing the core library, I have plenty of other c: tags within my jsp and they work perfectly that's why it confuses me that's it not working. Seems like a pretty simple tag to use. Before trying to convert this to JSTL I had bean:define tag (from Struts) and a jsp:include page=%= xyz %/ tag and things worked fine. But now I get nothing... On 9/17/03 10:38 AM, Rick Ross [EMAIL PROTECTED] wrote: Make sure that you are clear on the differences between c:import jsp:include and @include they are all different and in my case the fact that the imported page has no knowledge of my context hosed me. R Billy Bacon wrote: I've looked through the archives and the suggested alternative for a dynamic jsp:include reference is using the c:import url=${xyz}/. This is not working in my JSP. The tag is including nothing in my page. I've even tried to give it a static reference to the jsp c:import url=xyzPage.jsp/ and still nothing. Does anyone know what's wrong? - Billy - -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import
Awesome. That worked! Thanks Kris! - Billy - On 9/17/03 12:05 PM, Kris Schneider [EMAIL PROTECTED] wrote: Have you tried a context-relative path (starts with /) to the page? Quoting Billy Bacon [EMAIL PROTECTED]: It's a scoped variable. But I think the problem is elsewhere because even this doesn't work for me and no exception is thrown... c:import url=myJspPage.jsp / Any ideas? On 9/17/03 11:34 AM, Kris Schneider [EMAIL PROTECTED] wrote: Is xyz only a scripting variable or is it also a scoped variable? Quoting Billy Bacon [EMAIL PROTECTED]: Yes, I am importing the core library, I have plenty of other c: tags within my jsp and they work perfectly that's why it confuses me that's it not working. Seems like a pretty simple tag to use. Before trying to convert this to JSTL I had bean:define tag (from Struts) and a jsp:include page=%= xyz %/ tag and things worked fine. But now I get nothing... On 9/17/03 10:38 AM, Rick Ross [EMAIL PROTECTED] wrote: Make sure that you are clear on the differences between c:import jsp:include and @include they are all different and in my case the fact that the imported page has no knowledge of my context hosed me. R Billy Bacon wrote: I've looked through the archives and the suggested alternative for a dynamic jsp:include reference is using the c:import url=${xyz}/. This is not working in my JSP. The tag is including nothing in my page. I've even tried to give it a static reference to the jsp c:import url=xyzPage.jsp/ and still nothing. Does anyone know what's wrong? - Billy - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import
Okay, that's good, but I use page-relative paths successfully with c:import all the time. Are you sure the page doing the import is in the same directory as the page being imported? Quoting Billy Bacon [EMAIL PROTECTED]: Awesome. That worked! Thanks Kris! - Billy - On 9/17/03 12:05 PM, Kris Schneider [EMAIL PROTECTED] wrote: Have you tried a context-relative path (starts with /) to the page? Quoting Billy Bacon [EMAIL PROTECTED]: It's a scoped variable. But I think the problem is elsewhere because even this doesn't work for me and no exception is thrown... c:import url=myJspPage.jsp / Any ideas? On 9/17/03 11:34 AM, Kris Schneider [EMAIL PROTECTED] wrote: Is xyz only a scripting variable or is it also a scoped variable? Quoting Billy Bacon [EMAIL PROTECTED]: Yes, I am importing the core library, I have plenty of other c: tags within my jsp and they work perfectly that's why it confuses me that's it not working. Seems like a pretty simple tag to use. Before trying to convert this to JSTL I had bean:define tag (from Struts) and a jsp:include page=%= xyz %/ tag and things worked fine. But now I get nothing... On 9/17/03 10:38 AM, Rick Ross [EMAIL PROTECTED] wrote: Make sure that you are clear on the differences between c:import jsp:include and @include they are all different and in my case the fact that the imported page has no knowledge of my context hosed me. R Billy Bacon wrote: I've looked through the archives and the suggested alternative for a dynamic jsp:include reference is using the c:import url=${xyz}/. This is not working in my JSP. The tag is including nothing in my page. I've even tried to give it a static reference to the jsp c:import url=xyzPage.jsp/ and still nothing. Does anyone know what's wrong? - Billy - -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import
Yep, all my JSPs are in the same directory. c:import url=xyz.jsp/ // didn't work c:import url=/jsp/xyz.jsp/ // did the trick. Dunno... On 9/17/03 1:14 PM, Kris Schneider [EMAIL PROTECTED] wrote: Okay, that's good, but I use page-relative paths successfully with c:import all the time. Are you sure the page doing the import is in the same directory as the page being imported? Quoting Billy Bacon [EMAIL PROTECTED]: Awesome. That worked! Thanks Kris! - Billy - On 9/17/03 12:05 PM, Kris Schneider [EMAIL PROTECTED] wrote: Have you tried a context-relative path (starts with /) to the page? Quoting Billy Bacon [EMAIL PROTECTED]: It's a scoped variable. But I think the problem is elsewhere because even this doesn't work for me and no exception is thrown... c:import url=myJspPage.jsp / Any ideas? On 9/17/03 11:34 AM, Kris Schneider [EMAIL PROTECTED] wrote: Is xyz only a scripting variable or is it also a scoped variable? Quoting Billy Bacon [EMAIL PROTECTED]: Yes, I am importing the core library, I have plenty of other c: tags within my jsp and they work perfectly that's why it confuses me that's it not working. Seems like a pretty simple tag to use. Before trying to convert this to JSTL I had bean:define tag (from Struts) and a jsp:include page=%= xyz %/ tag and things worked fine. But now I get nothing... On 9/17/03 10:38 AM, Rick Ross [EMAIL PROTECTED] wrote: Make sure that you are clear on the differences between c:import jsp:include and @include they are all different and in my case the fact that the imported page has no knowledge of my context hosed me. R Billy Bacon wrote: I've looked through the archives and the suggested alternative for a dynamic jsp:include reference is using the c:import url=${xyz}/. This is not working in my JSP. The tag is including nothing in my page. I've even tried to give it a static reference to the jsp c:import url=xyzPage.jsp/ and still nothing. Does anyone know what's wrong? - Billy - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: c:import
Craig Longman wrote: i've been trying to figure out what happens to the request object when you import a file, but had no answers from the tomcat list, so i thought i'd try here. when you include a file via c:insert that actually maps to another servlet, it appears that the request object (in tomcat 4.1.10 at least) doesn't reflect any of the actual request being delivered. i'm a little confused as to what i can do now. the specifics are that i have a servlet that i want to call with a url indicating a specific file that i want retrieved. this would be most useful if it could be called directly, or imported into another jsp file. the url would look like: /mapper/file-to-get the file-to-get would be retrieved by the servlet and then it looks up the correct file and processes it. however, when this url is invoked via a c:import url=/mapper/file, all of the information retrievable via the request object refer to the 'wrapping' request, to the jsp page contains the c:import. the parameters passed are available, but don't show up in the query string (because the query string is for the containing jsp page). is this the correct behaviour? i can't find anything definitive in the spec, so i'm not sure if this is a bug (it seems like 4.1.10 has a few) or the expected behaviour. and if it is expected, then is there _any_ of retrieving 'file-to-get' part if the servlet is invoked via an import? The JSTL c:import action behaves like a RequestDispatcher.include() when you import a resource in the same container. This means (as defined by the Servlet spec) that the URI for the request is the URI for the _including_ resource (the JSP page in this case), so the behavior you see is correct. You do have access to the URI info that was used to include the resource through request attributes. This is from the Servlet spec: SRV.8.3.1 Included Request Parameters Except for servlets obtained by using the getNamedDispatcher method, a servlet being used from within an include has access to the path by which it was invoked. The following request attributes are set: javax.servlet.include.request_uri javax.servlet.include.context_path javax.servlet.include.servlet_path javax.servlet.include.path_info javax.servlet.include.query_string These attributes are accessible from the included servlet via the getAttribute method on the request object. Hans -- Hans Bergsten [EMAIL PROTECTED] Gefion Software http://www.gefionsoftware.com JavaServer Pageshttp://TheJSPBook.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: c:import
On Tue, 2002-09-17 at 20:52, Shawn Bayern wrote: On 17 Sep 2002, Craig Longman wrote: when you include a file via c:insert that actually maps to another servlet, it appears that the request object (in tomcat 4.1.10 at least) doesn't reflect any of the actual request being delivered. i'm a little confused as to what i can do now. Unless I'm misunderstanding your question, this sounds like the right behavior. The relevant specification is actually the Servlet specification (section SRV.8.2), though see JSTL 1.0 section 7.4 for the specification of c:import. hm. i only had the jstl and jsp specs. thanks, i'll try and find the servlet spec. however, when this url is invoked via a c:import url=/mapper/file, all of the information retrievable via the request object refer to the 'wrapping' request, to the jsp page contains the c:import. the parameters passed are available, but don't show up in the query string (because the query string is for the containing jsp page). I don't see any query string in the example; did you mean to write /mapper?file-to-get? I'm not sure, from your description, what is being lost. If you need to pass parameters directly, you can use the c:param tag as a subtag of c:import. Otherwise, I think I'd need a little more information to help. the parameters i refer to are, in fact, passed via c:param. so, the relevant jsp file portion looks like: c:import url=/mapper/testfile c:param name=name1 value=${lookup1}/ /c:import in the mapper servlet, i can do a request.getParameter( name1 ) and get whatever value lookup1 contained. but if i do a request.getQueryString(), it returns blank. also, i have no way of extracting the 'testfile' information, it is simply lost; a call to request.getRequestURI(), .getRequestURL() and .getServletPath() will return references to the calling page (debug.jsp in this case). i guess i could just turn the filename into a parameter also. it just a bit disconcerting, i'm going to have to be very careful about calling existing servlets as they will quite possibly break as well as handling (possibly special handling) of cases where a servlet is called either directly or imported. this might not be the case with a cross-context servlet, and probably not the case with an absolute url, i'll have to test. but then there is extra overhead in using those types of connections also. thanks. -- CraigL-Thx(); Be Developer ID: 5852 signature.asc Description: This is a digitally signed message part
Re: c:import full windows path
On Fri, 9 Aug 2002, Amarant Merah wrote: Is it possible to import a file based on full path? e.g. E:/somepath/myfile.xml I understand it is possible to import using full http url or relative to webapp like these: c:import url=http://domain.com/somepath/myfile.xml; var=xml/ c:import url=/somepath/myfile.xml var=xml/ I need something like c:import url=E:/abc/somepath/myfile.xml var=xml/ and the above doesn't work. Yes, you'd use a 'file' URL, as with a browser. For instance: c:import url=file:///e:/abc/somepath/myfile.xml / -- Shawn Bayern JSTL in Action http://www.jstlbook.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: C:Import
On Mon, 15 Jul 2002, Tim Ringwood wrote: % String xmlReq = request.getParameter(xml); % %@taglib uri=http://java.sun.com/jstl/core; prefix=c % %@taglib uri=http://java.sun.com/jstl/xml; prefix=x % c:import url=generic.xsl var=xslt/ c:import url=%=xmlReq% var=xml/ x:transform xml=${xml} xslt=${xslt}/ You cannot use rtexprvalues in the EL versions of JSTL tags. Replace the second line with the following: c:import url=${param.xmlReq} var=xml / -- Shawn Bayern JSTL in Action http://www.jstlbook.com (coming in July 2002 from Manning Publications) -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: c:import when file doesn't exist
On Thu, 6 Jun 2002, Matt Raible wrote: I remember hearing something about JSTL offering a try/catch syntax, or maybe it was JSP 1.2. Anywhoo, I need it. It's c:catch, as in c:catch var=error c:import ... / /c:catch c:if test=${not empty error} Not there! /c:if -- Shawn Bayern JSTL in Action http://www.jstlbook.com (coming in July 2002 from Manning Publications) -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]