datearray
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
I have a dropdownlist for quaterly months where q1=jan,feb,mar
q2=apr,may,june
.....etc
<code>
<OPTION <%= getSelectionQuaterly(0)%>value="1">
Q1
</OPTION>
<OPTION <%= getSelectionQuaterly(1)%>value="2">
Q2
</OPTION>
<OPTION <%= getSelectionQuaterly(2)%>value="3">
Q3
</OPTION>
<OPTION <%= getSelectionQuaterly(3)%>value="4">
Q4
</OPTION>
</select>
<select name="month" size="1">
<option <%=getSelectionMonth(0)%> value="1">
Jan,Feb,Mar
<option <%=getSelectionMonth(1)%> value="2">
Apr,May,Jun
<option <%=getSelectionMonth(2)%> value="3">
Jul,Aug,Sep
<option <%=getSelectionMonth(3)%> value="4">
Oct,Nov,Dec
</select> </code>
If I say int quetrly = request.getParameter("quaterly");
I am not getting the values
I need a validation for q1.
get the values in month= request.getparameter("month");
I want the values to be month =1,2,3
so that I can write a query where month(1,2,3).(ie check for quaterly)
q2=apr,may,june
.....etc
<code>
<OPTION <%= getSelectionQuaterly(0)%>value="1">
Q1
</OPTION>
<OPTION <%= getSelectionQuaterly(1)%>value="2">
Q2
</OPTION>
<OPTION <%= getSelectionQuaterly(2)%>value="3">
Q3
</OPTION>
<OPTION <%= getSelectionQuaterly(3)%>value="4">
Q4
</OPTION>
</select>
<select name="month" size="1">
<option <%=getSelectionMonth(0)%> value="1">
Jan,Feb,Mar
<option <%=getSelectionMonth(1)%> value="2">
Apr,May,Jun
<option <%=getSelectionMonth(2)%> value="3">
Jul,Aug,Sep
<option <%=getSelectionMonth(3)%> value="4">
Oct,Nov,Dec
</select> </code>
If I say int quetrly = request.getParameter("quaterly");
I am not getting the values
I need a validation for q1.
get the values in month= request.getparameter("month");
I want the values to be month =1,2,3
so that I can write a query where month(1,2,3).(ie check for quaterly)
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
I don't know why you insist on deleting and reposting this same question. Please stop.
posted 17 years ago
request.getParameter returns a String, not an int.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
If I say int quetrly = request.getParameter("quaterly");
request.getParameter returns a String, not an int.
phani kon
Ranch Hand
Posts: 251
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
that was typeo. I mean
quaterly = Integer.parseInt(request.getParameter("quaterly"));
I would like to know how would I validate quaterlydates in jsp or java to return months for Q1 to check firstquater(jan,feb,mar).
Is it possible, Basically in jsp if i say <select name = month...>
month = Integer.parseInt(request.getParameter("quaterly"));
I have to get values for month as 1,2,3
[ March 10, 2008: Message edited by: lakshmi manepally ]
quaterly = Integer.parseInt(request.getParameter("quaterly"));
I would like to know how would I validate quaterlydates in jsp or java to return months for Q1 to check firstquater(jan,feb,mar).
Is it possible, Basically in jsp if i say <select name = month...>
month = Integer.parseInt(request.getParameter("quaterly"));
I have to get values for month as 1,2,3
[ March 10, 2008: Message edited by: lakshmi manepally ]
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
phani kon
Ranch Hand
Posts: 251
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Sorry, I am not aware of this. Thanks for letting me know.
phani kon
Ranch Hand
Posts: 251
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
I have tried the obove code in jsp. I got this error
Syntax error, 'for each' statements are only available if source level is 5.0
Syntax error, 'for each' statements are only available if source level is 5.0
phani kon
Ranch Hand
Posts: 251
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
I have modified the code as below and it worked. But I want to pass to my query as month=1,2,3 at the same. How is it possible? Please let me know
<code>
int[] months = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
int[] quarterMonths = new int[3];
WebDataAccess wda = new WebDataAccess();
int quarter = Integer.parseInt(request.getParameter("quarterly"));//'quarter' possible values - 1, 2, 3, 4
System.arraycopy(months, (quarter - 1) * 3, quarterMonths, 0, 3);//Now 'quarterMonths' array will hold the months for that quarter
for ( int month1=1; month1<=quarterMonths.length; month1++)
{ //System.out.print("month1:" + month1 );
System.out.println("Quat" +quarter);
System.out.println("quartermonths" +quarterMonths.length);
ht = wda.getInfoForThequater(category,month1,year);
} </code>
<code>
int[] months = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
int[] quarterMonths = new int[3];
WebDataAccess wda = new WebDataAccess();
int quarter = Integer.parseInt(request.getParameter("quarterly"));//'quarter' possible values - 1, 2, 3, 4
System.arraycopy(months, (quarter - 1) * 3, quarterMonths, 0, 3);//Now 'quarterMonths' array will hold the months for that quarter
for ( int month1=1; month1<=quarterMonths.length; month1++)
{ //System.out.print("month1:" + month1 );
System.out.println("Quat" +quarter);
System.out.println("quartermonths" +quarterMonths.length);
ht = wda.getInfoForThequater(category,month1,year);
} </code>
phani kon
Ranch Hand
Posts: 251
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
I have modified the code below, it worked. But I want to pass the month1 as 1,2, 3 at the same time to the below query.Please let me know
<code>int[] months = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
int[] quarterMonths = new int[3];
WebDataAccess wda = new WebDataAccess();
int quarter = Integer.parseInt(request.getParameter("quarterly"));//'quarter' possible values - 1, 2, 3, 4
System.arraycopy(months, (quarter - 1) * 3, quarterMonths, 0, 3);//Now 'quarterMonths' array will hold the months for that quarter
for ( int month1=1; month1<=quarterMonths.length; month1++)
{ //System.out.print("month1:" + month1 );
System.out.println("Quat" +quarter);
System.out.println("quartermonths" +quarterMonths.length);
ht = wda.getThequaterReport(category,month1,year);
}</code>
<code>int[] months = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
int[] quarterMonths = new int[3];
WebDataAccess wda = new WebDataAccess();
int quarter = Integer.parseInt(request.getParameter("quarterly"));//'quarter' possible values - 1, 2, 3, 4
System.arraycopy(months, (quarter - 1) * 3, quarterMonths, 0, 3);//Now 'quarterMonths' array will hold the months for that quarter
for ( int month1=1; month1<=quarterMonths.length; month1++)
{ //System.out.print("month1:" + month1 );
System.out.println("Quat" +quarter);
System.out.println("quartermonths" +quarterMonths.length);
ht = wda.getThequaterReport(category,month1,year);
}</code>
phani kon
Ranch Hand
Posts: 251
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
How would I pass month1 as 1,2,3 to the below method where month is integer, I can't pass as array.
ht = wda.getquat(String cat, int mon, int year)
Please let me know the solution
ht = wda.getquat(String cat, int mon, int year)
Please let me know the solution
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
You cannot pass 1,2,3 to the method having int datatype.
If this method is mutable,then you can make it String datatype
And then by joining the array values with ,(comma) separtor and passing it to your method wda.getquat()
i.e instead of using wda.getquat(String cat, int mon, int year)
use, wda.getquat(String cat, String mon, int year)
"Chasing after impossible, you lose what is possible."
Regards
Baseet Ahmed
If this method is mutable,then you can make it String datatype
And then by joining the array values with ,(comma) separtor and passing it to your method wda.getquat()
i.e instead of using wda.getquat(String cat, int mon, int year)
use, wda.getquat(String cat, String mon, int year)
"Chasing after impossible, you lose what is possible."
Regards
Baseet Ahmed
phani kon
Ranch Hand
Posts: 251
posted 17 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
can you me some example please?
| Joel Salatin has signs on his property that say "Trespassers will be Impressed!" Impressive tiny ad: Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing |













