Thanks,
But why would a <%! %> tag make a file default to the same dir as the .jsp file.

When I do
<%! String content = new java.io.File("Hi.txt").getAbsolutePath(); %>, 

I get:

C:\dc\tomcat\bin\Hi.txt



--- On Mon, 5/18/09, Steve Yates <steven.ya...@springsource.com> wrote:

> From: Steve Yates <steven.ya...@springsource.com>
> Subject: Re: How to refer to file?
> To: "Tomcat Users List" <users@tomcat.apache.org>
> Date: Monday, May 18, 2009, 1:28 AM
> Dola Woolfe wrote:
> > Hi,
> >
> > Within a .jsp document, is there a way of referring to
> a file in same directory?
> >
> > For example, new java.io.File(ThisDir,
> "FileName.txt").
> >
> > Thanks,
> >
> > Dola
> >
> >
> >       
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> > For additional commands, e-mail: users-h...@tomcat.apache.org
> >
> >   
> Hi Dola,
> 
> Is this something you really need to do in the view layer
> like this? I
> am going to assume you have a really good reason to do this
> and say that
> it is possible using the same approach as you would declare
> a method in
> a .JSP file.
> 
> This is slightly different to the scriptlet approach <%
> %> <%= %> etc
> 
> You simply add a ! like so;
> 
> <%!
>       *File myFile = new
> java.io.File(....);*
>  
>       public String methodDeclaration(.....)
> {
>           //DoSomething
>           //... 
>           return
> StringUtils.EmptyString();
>      }
> %>
> 
> Don't forget to include the appropriate package as an
> "import" statement.
> 
> RGS SY
> 
> 
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to