JSP redirecting pages and DROP DOWN boxes

Posted on 2003-03-26
Medium Priority
Last Modified: 2010-04-01
How do you redirect a JSP page. My example is when you go from one page to another a simple JSP page processes your information but i don't want to stay on that page. I want to process and move on the page i want to redirect too.

Also, I'm learning JSP and want to use some drop down boxes. Does anyone have any examples of how to work with Drop Down boxes and JSP. I need to query the database and add the info from the database into the dropdown box and don't know where to start.
Question by:TSK
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 18

Accepted Solution

bobbit31 earned 80 total points
ID: 8211664
// process the information

// redirect to another page
<% response.sendRedirect("http://yourserver.com/newpage.jsp"); %>

second part:

<select name=mySelect>
Class.forName("<your database driver>").newInstance();
Connection con = DriverManager.getConnection("<connection string to your db>");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select field1 from tbl");

while (rs.next()) {
<option value="<%= rs.getString("field1") %>"><%= rs.getString("field1") %>


LVL 14

Expert Comment

ID: 8212852
bobbit show you how to redirect browser to a new page, this will be a separate request. you can also forward current request on to another jsp page:
<jsp:forward page="another.jsp" />

Author Comment

ID: 8213799
How do use a bean in this example of the JSP document?

            String us, pass, memberID;
            boolean doneheading = false;
            dbconn = DriverManager.getConnection("jdbc:mysql://localhost/nutrition","saundersk","kevin");
            username = request.getParameter("username").trim().toUpperCase();
            password = request.getParameter("password").trim().toUpperCase();
            sql = dbconn.prepareStatement("SELECT * FROM member WHERE UPPER(user_name) = ? AND UPPER(password1) = ?");
            sql.setString(1, request.getParameter("username"));
            sql.setString(2, request.getParameter("password"));
            memberID = results.getString("member_id");
            jsp:getProperty name="mybean" property="memberID scope="session"
            results = sql.executeQuery();

Expert Comment

ID: 8215003

It seems you are trying to ask another question which is different from your original one.

Generally if other people have answered your question correctly, you should reward points and clear the question before asking new questions.

LVL 14

Expert Comment

ID: 8215008
agree with victorli.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hey fellow admins! This time, I have a little fairy tale for you. As many tales do, it starts boring and then gets pretty gory. I hope you like it. TL;DR: It is about an important security matter, you should read it if you run or administer Windows …
Active Directory can easily get cluttered with unused service, user and computer accounts. In this article, I will show you the way I like to implement ADCleanup..
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month8 days, 8 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question