Solved

How to pass prompt field values to .jsp database query

Posted on 2008-10-09
3
744 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 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
web service Rest Client creation 4 97
bean mapper frameworks 5 64
TreeSet comparator example 7 103
How can I   ajax html table  rows? 20 79
Active Directory security has been a hot topic of late, and for good reason. With 90% of the world’s organization using this system to manage access to all parts of their IT infrastructure, knowing how to protect against threats and keep vulnerabil…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…

735 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