Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

lazydog

macrumors 6502a
Sep 3, 2005
709
6
Cramlington, UK
Right. That doesn't help much!

The action parameter looks ok so long as the page is at the root level of your test site. But I still don't know how you are accessing your test site. Is it through a browser, and if so what url are you using?

I really think your best bet is to find and follow a tutorial on setting up a servlet with Netbeans.

good luck!

b e n
 

twoodcc

macrumors P6
Original poster
Feb 3, 2005
15,307
26
Right side of wrong
Right. That doesn't help much!

The action parameter looks ok so long as the page is at the root level of your test site. But I still don't know how you are accessing your test site. Is it through a browser, and if so what url are you using?

I really think your best bet is to find and follow a tutorial on setting up a servlet with Netbeans.

good luck!

b e n

ok, sorry. i do access the site through a browser. the url is http://localhost:8084/WebApplication3/PizzaPointeXML.html

that is to my html file.

i've searched for netbeans tutorials, without much luck. i'll continue to look for them though.
 

lazydog

macrumors 6502a
Sep 3, 2005
709
6
Cramlington, UK
ok, sorry. i do access the site through a browser. the url is http://localhost:8084/WebApplication3/PizzaPointeXML.html

that is to my html file.

i've searched for netbeans tutorials, without much luck. i'll continue to look for them though.

Great, I can see a problem!

The url to your html file, (from the root), is "/WebApplication3/PizzaPointeXML.html".
and the action url is "pizzaXML" which is relative to the current page. So the action url translates to "/WebApplication3/PizzaXML" which is not the url to your servlet!

So either change your action url to "/pizzaXML" or change the mapping for the servlet (in web.xml) to "/WebApplication3/PizzaXML". Hopefully one of these fixes will work.

b e n
 

twoodcc

macrumors P6
Original poster
Feb 3, 2005
15,307
26
Right side of wrong
Great, I can see a problem!

The url to your html file, (from the root), is "/WebApplication3/PizzaPointeXML.html".
and the action url is "pizzaXML" which is relative to the current page. So the action url translates to "/WebApplication3/PizzaXML" which is not the url to your servlet!

So either change your action url to "/pizzaXML" or change the mapping for the servlet (in web.xml) to "/WebApplication3/PizzaXML". Hopefully one of these fixes will work.

b e n

well i tried both, and when i changed the action url, i got a 404 saying it wasn't available. same with the other. and same when i tried both.

isn't the mapping wrong? when i say mapping, i mean url-pattern under mapping. b/c really on my computer, there's a folder called WebApplication3, and inside that you have the "build" folder. then "web", then "WEB-INF", then "classes", and in there is my pizzaXML.class, but there's also a folder called "webapplication3". should my pizzaXML.class be in that folder?
 

lazydog

macrumors 6502a
Sep 3, 2005
709
6
Cramlington, UK
I don't think you need to move it. It sounds to me like a path problem but I could be wrong. I'll have a look at Netbeans at the weekend, but until then I'm not sure I can be of much help… sorry, but I've run out of ideas! The only thing I can suggest is that you mentioned there were more servlets defined in web.xml. You could try running some of those and see if they work. Look at the mappings for their urls ( you'll need to add the /localhost:8084/WebApplication3 bit first).

b e n
 

twoodcc

macrumors P6
Original poster
Feb 3, 2005
15,307
26
Right side of wrong
I don't think you need to move it. It sounds to me like a path problem but I could be wrong. I'll have a look at Netbeans at the weekend, but until then I'm not sure I can be of much help… sorry, but I've run out of ideas! The only thing I can suggest is that you mentioned there were more servlets defined in web.xml. You could try running some of those and see if they work. Look at the mappings for their urls ( you'll need to add the /localhost:8084/WebApplication3 bit first).

b e n

thanks, i really appreciate it. i also have to implement a .xml and .xsl file in there somehow also. but first, i need to get this thing going.

i don't think it's a path problem b/c the error i get is a 500 error that says: the server encountered an internal error () that prevented it from fulfilling this request.
 

twoodcc

macrumors P6
Original poster
Feb 3, 2005
15,307
26
Right side of wrong
well i need more help!

i am making a loan servlet. i have an html form that the user inputs data (like name, address), and they also choose between 3 loan types, and input their loan amount, monthly income, and current debt.

now i have that working fine. but now i have to add a second html form, to allow the user to compare 2 loan types. now that's messing me up.

do i put the form in the same html file?
 

twoodcc

macrumors P6
Original poster
Feb 3, 2005
15,307
26
Right side of wrong
well i finally have it working. but now i have to make it save the data to a database. i tried this before, but with no luck. could someone give me an example on how to do this?
 

twoodcc

macrumors P6
Original poster
Feb 3, 2005
15,307
26
Right side of wrong
well i don't know what happened, but now tomcat is giving me errors:

SEVERE: Exception starting filter UploadFilter
java.lang.ClassNotFoundException: com.sun.webui.jsf.util.UploadFilter

with a bunch more after that in red. any idea what's going on?

i'm using netbeans ide
 

twoodcc

macrumors P6
Original poster
Feb 3, 2005
15,307
26
Right side of wrong
here is my database code:

Code:
try {
            Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
            } catch(ClassNotFoundException e){
            System.out.println(e);
            }
           try{
            Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/tim", "tim", "tim");
            Statement stmt = con.createStatement();
            
            stmt.executeUpdate("insert into tim.table " +
                 "values('f1', 'f2','f3')");
        
            }catch(SQLException f){
           System.err.println(f);                
        }

but it doesn't seem to write to the database.

can anyone see anything wrong with the code?
 

lazydog

macrumors 6502a
Sep 3, 2005
709
6
Cramlington, UK
Hi

I think you've missed out the column names in your sql.

You need something like:-

Code:
 stmt.executeUpdate("insert into tim.table ( col_name1, col_name2, col_name3 ) values('f1', 'f2','f3')");

b e n
 

twoodcc

macrumors P6
Original poster
Feb 3, 2005
15,307
26
Right side of wrong
Hi

I think you've missed out the column names in your sql.

You need something like:-

Code:
 stmt.executeUpdate("insert into tim.table ( col_name1, col_name2, col_name3 ) values('f1', 'f2','f3')");

b e n

thanks. i put in the column names, but it still doesn't seem to save the data to the database. the "tim.table" part is the database name "tim" and the table name "timtable". do i need both, or just the tablename?
 

lazydog

macrumors 6502a
Sep 3, 2005
709
6
Cramlington, UK
You haven't specified the database name etc. For mySql I use something like this:-
Code:
       connection = DriverManager.getConnection( "jdbc:mysql://" + dbServer + "/" + dbName + "?user=" + dbUser + "&password=" + dbPassword ) ;

b e n
 

twoodcc

macrumors P6
Original poster
Feb 3, 2005
15,307
26
Right side of wrong
You haven't specified the database name etc. For mySql I use something like this:-
Code:
       connection = DriverManager.getConnection( "jdbc:mysql://" + dbServer + "/" + dbName + "?user=" + dbUser + "&password=" + dbPassword ) ;

b e n

well, i have this:

Code:
Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/tim", "tim", "tim");

where "tim" is the name of the database, the username, and the password

is that correct?
 

lazydog

macrumors 6502a
Sep 3, 2005
709
6
Cramlington, UK
Looks okay to me. In a previous post you mentioned that your table is called timtable but in the sql you have "insert into tim.table". If your table is called timtable then you need "insert into timtable".

b e n
 

twoodcc

macrumors P6
Original poster
Feb 3, 2005
15,307
26
Right side of wrong
Looks okay to me. In a previous post you mentioned that your table is called timtable but in the sql you have "insert into tim.table". If your table is called timtable then you need "insert into timtable".

b e n

ok i fixed that. but do i need "tim.timtable"?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.