File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Passing values from JSP page to Java program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Passing values from JSP page to Java program" Watch "Passing values from JSP page to Java program" New topic

Passing values from JSP page to Java program

Brian Mulvany

Joined: Oct 19, 2004
Posts: 28
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 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.
Brian Mulvany
Joel McNary

Joined: Aug 20, 2001
Posts: 1824

This sounds more like it belongs in the Servlets forum (or the JSP forum), but what you need to do is have the form on the JSP POST to a Servlet. Then the Servlet reads the parameters from the form and calls your search engine with those parameters. The Servlet can then either do something with the results or redirect to another JSP page.

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
subject: Passing values from JSP page to Java program
jQuery in Action, 3rd edition