Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to pass prompt field values to .jsp database query

Posted on 2008-10-09
3
Medium Priority
?
752 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 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Steps to fix error: “Couldn’t mount the database that you specified. Specified database: HU-DB; Error code: An Active Manager operation fail”
In this article, the configuration steps in Zabbix to monitor devices via SNMP will be discussed with some real examples on Cisco Router/Switch, Catalyst Switch, NAS Synology device.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month10 days, 4 hours left to enroll

926 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