Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

dynamic help

 
rich werth
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok i have a drop down populated by oracle when the page loads using jsp. now i want to be able to select items in both lists and dynamicly build a query that will populate a table built on the results. I have the dynamic table. i don't have the dynamic query or how it will be submitted once the submit button is pressed. i'm thinking a javaBean to access session variables but i'm not sure. can anyone help me or shoot me?
 
Sandra Sharpe
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the user has selected an option from your drop down box and submits the web page, their selection is available via the javax.servlet.ServletRequest or similarly the javax.servlet.http.HttpServletRequest object.
If you are using .jsp or servlet you can access this via the command.... request.getParameter("parameter_name_here") or if a user can select multiple options from the drop down you could use request.getParameterValues("parameter_name_here");
Once you have the values, you can pass these values into a supporting java class that can query the database based upon the results. For Example : select * from employee where emp_name = value_user_selected. My company uses Oracle Stored procedures and parameters into stored procedures.
I hope this helps....

 
rich werth
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is my code to fill a drop down
<select name="loc">
<%<br /> int i=0;<br /> while (rs.next()) {<br /> i++;<br /> String location = rs.getString(1);<br /> %>
<option value=<%= i %>><%= location %>
<% } %>
</select>
this is the default query i run on the page so it doesn't load blank
<%<br /> String queryStr3 = "Select * from NON_IT where REQUESTOR_NAME = 'jane user'";<br /> ResultSet eresults = dept.executeQuery(queryStr3);<br /> %>
i would like to know how to build a dynamic query from what the user selects in the drop list and have that populate the same page with the new results when the user presses the submit button. can someone help me?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic