Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to pass prompt field values to .jsp database query

Posted on 2008-10-09
3
Medium Priority
?
750 Views
Last Modified: 2012-05-05
I have a .jsp file that runs a simple query on a database.  I have no .jsp experience :( - hence why i am asking the experts ;) - flattery is good right....
Anyhow.  I want to add a date rage function to this query.  I would like to have a page preferebly in .jsp that prompts for date start and date end.  I want a submit button to pass these values to the .jsp query page.  How will it look on the form page (daterange.jsp) and how will these values be grabbed on the query.jsp page?  what is more secure session or post if at all the case in this scenario.
0
Comment
Question by:digarati
[X]
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
3 Comments
 
LVL 9

Accepted Solution

by:
darkapple earned 1000 total points
ID: 22685222
In daterange.jsp, you'll create two textbox named say, txtStartDate and txtEndDate with a submit button. The action of the form will refer to query.jsp method for form to be used is GET.

Now in query.jsp file, you can get these values from query string embedding scriptlet to jsp page as

<%
String startDate = request.getParameter("txtStartDate");
String endDate = request.getParameter("txtEndDate");
%>


0
 
LVL 7

Assisted Solution

by:maXXXeE
maXXXeE earned 1000 total points
ID: 22685252
on the "daterange.jsp" page, create 2 textboxes and submit button within a form tag.
<form method="post" action="query.jsp"> <!--or method=get-->
<input type="text" name="startdate" />
<input type="text" name="enddate" />
<input type="submit"/>
</form>

on query.jsp use request.getParameter to get the values
request.getParameter("startdate");
0
 
LVL 11

Expert Comment

by:Manish
ID: 22687355
If you dont want to use text field,  and want to select using pop up.
http://www.mattkruse.com/javascript/calendarpopup/

0

Featured Post

Industry Leaders: 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

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

688 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