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
Solved

How to pass prompt field values to .jsp database query

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SimpleDateFormat.parse examples 19 98
java cigar challenge 58 214
struts hibernate integration example 28 142
How can I   ajax html table  rows? 20 78
Giving access to ESXi shell console is always an issue for IT departments to other Teams, or Projects. We need to find a way so that teams can use ESXTOP for their POCs, or tests without giving them the access to ESXi host shell console with a root …
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.

840 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