<jsp:useBean File Read Write, File Locations and GoDaddy.com
I'm trying to hone my Java and Java EE skills. I'm helping someone on
their website, using a GoDaddy Linux shared hosting. I've been able
to accomplish a lot including a feedback --> email application. What
I'm trying to do now is keep a running tally on feedback in a simple
Comma Seperated Variable (CSV) text file on the web site.
All .jsp code is done thru <jsp:useBean ... and setters and getters.
I'm building the web site applications using NetBeans IDE. I verify
things are working on my local drive before I go to GoDaddy. GoDaddy
is very cost effective but it has some minor drawbacks.
1) You are on a shared server. You get no control on the server. You
can not look at the server logs.
2) Servlets, once executed, stay that way for 24 hours. If you
upgrade your java app, upload it, it won't become functional until
after 1AM Mountain time. Obviously the easiest way around that is to
constantly increment your class package name (or do it right the first
time on your local server, ha!)
3) Web/File organization is not intuitive. (hence my current
problem.) The only guidance from GoDaddy is that in order to read/
write files, you must be in a /tmp directory.
What I'm struggling with is the naming convention for file
GoDaddy Tree Structure:
First trick was where to place my compiled class files. In this case,
I added javapackage to the source package within my NetBeans project.
That package contains my custom.java class. When mapped to the
GoDaddy interface, the compiled custom.class ends up going to:
(solution took a long time to figure out.. offered here for others who
might have same problem in future.)
Here is my current dilemma. I want to append a text (CSV) file. My
program works okay on my local drive with NetBeans, kinda sorta.
Java Code snippet:
PrintWriter userout = new PrintWriter(new FileWriter(new File("/
VisitLog.csv"),true)); // mode true = append
userout.println(getCSVText()); // Simple String data
This works okay, but /VisitLog.csv maps to c:/VisitLog.csv on my local
drive. I can see that the file is getting appended correctly, but
that location scheme won't work on GoDaddy.com
Problem #1: How can I add a "tmp" directory within NetBeans project
so VisitLog.csv is contained directly within the project? (I've tried
adding a subdirectory "tmp" and I can see it, but I don't know how to
access the file from java. I've tried numerous variants...) How do I
define my PrintWriter userout (see above) with this location?
Problem #2: Where do I place the file within GoDaddy to get my
PrintWriter to access it?
(I understand that I have to change permissions, etc..) Obviously it
be cool if I could have common java code between NetBeans local and
Anybody been here before? Anybody have really good understanding of
naming conventions and directory trees within a web server?
Many thanks in advance,
|All times are GMT. The time now is 04:13 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.