Solved

How to pass prompt field values to .jsp database query

Posted on 2008-10-09
3
739 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
3 Comments
 
LVL 9

Accepted Solution

by:
darkapple earned 250 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 250 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Are you unable to connect or configure Hotmail email account in Microsoft Outlook 2010, 2007? Or Outlook.com emails are not downloading to Outlook? Lets’ see the problem and resolve Outlook Connector error syncing folder hierarchy (0x8004102A).
What is Backup? Backup software creates one or more copies of the data on your digital devices in case your original data is lost or damaged. Different backup solutions protect different kinds of data and different combinations of devices. For e…
This video discusses moving either the default database or any database to a new volume.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now