One possible solution is to first create a File object by passing in the
requisite filename as a string to the File Constructor.
Then check if the file exists with a call to the exists() method of the File
Object.
If it does then include the file or else don't.
Have a nice day.
With regards,
Sachin S. Khanna.
www.emailanorder.com

----- Original Message -----
From: arun prakash <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 06, 2000 6:11 AM
Subject: jsp include problem


> Hi All.,
>             I'm dynamically including a jsp file as
> shown in the following code :
>
> <%
> out.println("Hello there ");
> String f = "freeword1";
> String str = "/tmp/" + f + ".html";
> try {
> %>
> <jsp:include page = "<%=str%>" flush = "true"/>
> <%
> }
> catch(Exception e)
> {
> %>
>   <%=f%>
> <%
> }
>  out.println("This is the end of the session");
> %>
>
> But my problem is that if the file does'nt exist in
> the tmp folder its showing 404 File Not Found Error.,
> even though i have given the try catch block..If there
> is not file present i dont want to show any errors
> just blank...how can i do this ?? Any help is
> appreciated.
>
> regards
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Shopping - Thousands of Stores. Millions of Products.
> http://shopping.yahoo.com/
>
>
===========================================================================
> 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
>

===========================================================================
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