bob von ilten

Greenhorn
+ Follow
since Apr 29, 2013
bob likes ...
Mac OS X MySQL Database Linux
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by bob von ilten

Thank you Jeanne,

So far I created answers to the exercises that seem to work, I was really just looking for something to compare my solutions to. I will check out the link you provided and I appreciate the assist. I know I can count on JavaRanch.

Take care

Bob
4 years ago
Hello All,

I am working my way through the latest Core Java for the impatient by Cay Horstmann. Does anyone know if there exists possible solutions to the purposed exercises? and if so where I could fine them? (added because I know someone will reply.... but of course they exist.)

Thanks

Bob
4 years ago
Thank you, I will start a new project from scratch and see if I still get the error.
7 years ago
I got a resource not found error. So when you tried it yourself you only used the context.xml, and the jdbctest.jsp files?
7 years ago
Ok, so what exactly is extraneous then? web.xml seems to be, but if I comment out the call to DbConnectionClass from the listener the testjdbc.jsp will fail on the query line. There must be something linking the datasource in testjdbc to the DbConnectionClass?
7 years ago
Well basically because I don't know what I am doing. :-) The reading I have done to this point suggests to me that context.xml, web.xml, listener, connection, and view pages are all necessary to make a functioning web app with a database object. I knew that I had something wrong but I am still not sure what. At this point I am guessing that the web.xml is wrong and that my jdbctest page needs to be written somehow use the datasource object if indeed one is even being created.
7 years ago
Hello All, thanks for taking a look at my question.

I have a working jsp/servlet app running on apache and tomcat 7. but I am not sure about the program flow.
I have the following setup (actual questions at bottom of post).

context.xml -

web.xml - listener setup, but no resource-ref


connServletListener.java


DbConnectionClass.java



testjdbc.jsp


I apologize for the long preliminary. As I understand it this is how the app should work

at startup context.xml and web.xml are read, then the listener is called which in turn calls the dbconnectionclass that creates a datasource object and some testjdbc.jsp uses this datasource.

This app actually works, and the servletListener examples I have seen say that a resource should be in web.xml. Why does this app work with out it?
What is it that is calling the Connection getConnection() method of DbConnectionClass?
In jdbcTest.jsp is <sql:query..... dataSource="jdbc/printShop"> somehow going around or ignoring the datasource object created by DbConnectionClass?
7 years ago
I did find the web.xml file and there did not seem to be anything pointing to the actual location

<servlet>
<servlet-name>HelloWorldExample</servlet-name>
<servlet-class>HelloWorldExample</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>HelloWorldExample</servlet-name>
<url-pattern>/servlets/servlet/HelloWorldExample</url-pattern>
</servlet-mapping>
7 years ago
I installed tomcat 7 on apache on os x 10.8 so far so good, checked out the examples the all worked. so whats the problem?
I don't understand why they work.

the path on the tomcat server is /Library/Tomcat/webapps/examples/WEB-INF/classes/HelloWorldExample.class

the link on the servlet example page is http://localhost:8080/examples/servlets/servlet/HelloWorldExample

There is no path for examples/servlets/servlet there is a path for examples/servlets but the only thing in that directory is helloworld.html and
nothing seems to point to it.

I have tried numerous times to create my own HelloWorldExample but I'm just not getting it. Can someone tell me how
http://localhost:8080/examples/servlets/servlet/HelloWorldExample gets to /Library/Tomcat/webapps/examples/WEB-INF/classes/HelloWorldExample.class


7 years ago
Thanks guy I appreciate patient assistance.
7 years ago
Well I'm wading along with you :-) I haven't gotten that far in the book yet, but I have gotten far enough to realize
that the water is going to a lot deeper before it starts to go down. I will come back to this thread should I have any
epiphanies when I get to page 618.
7 years ago
Ok I get it I think. So if we do not have a variable tied to the reference of the created object would that be a case for "this"

BeatBox().buildGUI();


JFileChooser fc = new JFileChooser();
fc.showOpenDialog(theFrame.this);

or

JFileChooser fc = new JFileChooser();
fc.showOpenDialog(BeatBox.this);

depending on the enclosing object?
7 years ago
Yes, thank you I understand that new is what creates the object and that BeatBoxFc is then the reference variable.
If you use this code though, "new BeatBox().buildGUI();" what then is the reference value?
7 years ago
Well that is part of what I am trying to understand.

if new BeatBox().buildGUI(); creates an instance how is it addressed what is it reference?

with

BeatBox BeatBoxFc = new BeatBox();
BeatBoxFc.buildGUI();

I know that there is an object created of type BeatBox with a reference value of BeatBoxFc
7 years ago
In one of the HFJ projects (BeatBox) the following line is the only thing in main() "new BeatBox().buildGUI();". Am I correct in that there really is no instance or object of type BeatBox being created?

Further on in the lesson we are asked to implement JFileChooser. If main is left as is and JFileChooser is implemented via an internal listener class then this code will fail



if you edit main as follows then the above code will work.

7 years ago