I am creating a cd search engine website. I want a user to be able to type in the name of the cd they are looking for and I will have programs in the background doing the searching for them. Eventually I will search several websites but for now Ill settle just for searching CDWOW and returning their results. I have managed to create several Java classes that search http://www.cdwow.ie for an album and return the results back as XML but within the Java program. I want the user to be able to use a JSP webpage with a form to be able to search for whatever cd they want. When they type in U2 for example I want U2 to be passed into the Java program. Also I would like the results of the seach that are in XML to be in abrand new XML or HTML file. Thanks Brian Mulvany
you want to pass the searched string into your java prgram from a jsp page, right?
couldn't we integrate both your program and your jsp. i mean could this architecture becomes like.
jsp - - -- -> servlet for handling request/response(as you posted this here) - -- -> your program.
how about this. i think you should be more specified where you need help or idea.
Joined: Oct 19, 2004
Hi again Im sorry if I am annoying you. I just have a quick question. As I am quite new to this how do I integrate my Java into my a JSP servlet. If somebody could tell me where I can learn about how to do this I would greatly appreciate it. Also the programs I have created is running in JBuilder. It outputs the search results in xml format. I want to know how to get the results into a new JSP or XML page. This could be the same idea as inputting the search results. Any help is greatly appreciated. Thanks Brian firstname.lastname@example.org
Joined: Aug 15, 2004
you probably have to get rid of your main() method of your program and any UI associated with it. Now your UI would be a JSP page and a Servlet will control your program by request/response mechanism. your classes(POJO which you already have with you) would work as model, where you have your logic stuff.
Moreover I would like to refer you to J2EE Tutorial from java.sun.com. I hope it will guide you through quite quick. For some J2EE web tier fundamentals you can get a book from theserverside.com for free.
A Java program is basically a Java class, and you pass values to a Java program by calling a method on that class, passing in the arguments that are the values used in that method.
Something like myCDSearchObject.getInfoOnCd("U2") You could make a call like that from a JSP, but it is preferrable to do so from a servlet, and use JSP's only for presenting the data retrieved.
If you havent had a lot of experience in Java, I'd suggest that you start small, get one bit working before you move on to the next bit. For example, code your Java class first that is going to perform the actual search, test that it is working by printing the information retrieved to the console or to a text file, and then worry about how to call it from a Servlet.