Solved

loading folders name in a combo box.

Posted on 2003-11-10
3
232 Views
Last Modified: 2010-04-01
hi,
In a jsp page i am storing a value in a varaible name month ie,
String month = request.getParameter("MONTH");
here i'm getting the value like jan,feb...dec.
In some path eg: e:/reports ... I'm having a bunch of reports with folder strutures  like
e:/reports/20030705/121212/index.html
e:/reports/20030705/151212/index.html
e:/reports/20030715/101215/index.html
e:/reports/20030723/211213/index.html
e:/reports/20030805/121212/index.html
e:/reports/20030805/121212/index.html
 here 20030705 is year month date .. 2003 is year 07  is month and last one 05 is date..
 like that 121212 is hour min sec...
What i have to do is...
After i get jul(for july) in a month variable , i have to get all the folders name which is created on july (only 4 in the above 6) and load it in a combo box so that after submit for a particulat date ...say 20030705 .. i have to load the time (here we have two time folder for that date ) in a combo box and ask the user to select the particular time folder .

Can any one help me ...
Thanks in advance..
regards Arunkumar


0
Comment
Question by:rarunk
  • 2
3 Comments
 
LVL 19

Accepted Solution

by:
Kuldeepchaturvedi earned 100 total points
ID: 9720989
Once you get the the month here is what you will have to do..
String[] arr={"JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"};
String month=request.getParameter("MONTH");
int i=0;
for(i=0;i<arr.length;i++)
{
if(month.equals(arr[i]))
{
i++;
break;
}
}

File f = new File("e:\\reports");
String fnames[]=f.list();
%>
<SELECT NAME='MySelect">
<%
for(int j=0; j<fnames.length; j++)
{
File temp=new File("e:\\reports\\"+fnames[j]);
if(temp.isDirectory())
{
int mon = Integer.parseInt(fname[j].substring(4,6));
if(mon==i)
{%>
<OPTION><%=fname[i]%></OPTION>
<%}
}%>
</SELECT>

I don't vouch for the correctness of the code written above but it should give you a very clear idea as what is to be done..
Above code may have some syntax error but in essence the logic is there..
do let me know if I can be of more help.
Regards
0
 

Author Comment

by:rarunk
ID: 9721427
hi Kuldeepchaturvedi
 It's more than enough for me..
 It's exact what i want...Thanks a lot..
0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 9721649
Glad to be any of help to you....:-)
enjoy
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Owning a franchise can be the dream of a lifetime. It provides a chance for economic growth. You can be as successful as you want.  To make your franchise successful, you need to market it successfully. Here are six of the best marketing strategies …
For cloud, the “train has left the station” and in the Microsoft ERP & CRM world, that means the next generation of enterprise software from Microsoft is here: Dynamics 365 is Microsoft’s new integrated business solution that unifies CRM and ERP fun…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now