File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

datearray

 
phani kon
Ranch Hand
Posts: 251
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know why you insist on deleting and reposting this same question. Please stop.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I say int quetrly = request.getParameter("quaterly");

request.getParameter returns a String, not an int.
 
phani kon
Ranch Hand
Posts: 251
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by lakshmi manepally:
that was typeo.

Please read this.
 
phani kon
Ranch Hand
Posts: 251
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I am not aware of this. Thanks for letting me know.
 
Marimuthu Madasamy
Ranch Hand
Posts: 72
Java Monad Scala
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
phani kon
Ranch Hand
Posts: 251
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
phani kon
Ranch Hand
Posts: 251
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
phani kon
Ranch Hand
Posts: 251
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
phani kon
Ranch Hand
Posts: 251
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Baseet Ahmed
Ranch Hand
Posts: 225
Java Notepad Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
phani kon
Ranch Hand
Posts: 251
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you me some example please?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic