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


Reply via email to