Hello,

@InjectObject("service:tapestry.globals.ServletContext")
public abstract ServletContext getServletContext();

...
String imageDir = getServletContext().getRealPath("images");
...

Len
www.len.ro


On Thu, 2006-12-21 at 10:02 +0100, Cyrille37 wrote:

> Hello,
> Sure it is a beginner question, but I'm a beginner :o)
> 
> I would like to read a file which is located in the web root folder, and 
> put it in a String.
> I had a look around the Internet and found some tricks :
> 
> A la "Servlet" :
> ServletContext theApplicationsServletContext = (ServletContext) 
> this.getExternalContext().getContext();
> String realPath = 
> theApplicationsServletContext.getRealPath("/resources/images");
> File file = new File(realPath + File.separatorChar + justFileName);
> 
> A la "Rife" :
> import com.uwyn.rife.tools.FileUtils;
> URL resource = 
> getClass().getClassLoader().getResource("model/WordList.txt");
> final String wordlist = FileUtils.readString(resource);
> 
> Please could you tell me what are methods and usages with Tapestry ?
> 
> Thanks
> cyrille
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

Reply via email to