Prakash Balasubramani

Greenhorn
+ Follow
since Sep 09, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Prakash Balasubramani

Hi,

Since the related coding is in more than 2 pages... i have given u the coding as like mine which is as follows

String firstnames[] = {"Ram","Ragu","Ravi"};
String lastnames[] = {"Ram","Ragu","Ravi"};
String designation[] = {"CEO","Programmer","Sys Admin"};
String ValueString;

int i = Integer.parseInt(request.getParameter("index"));

String arraynames[] = {"firstnames","lastnames","designation"};

for(int j=0;j<3;j++)
{
out.println(arraynames[i] + "[" + j + "]");
}


While calling the above page if i pass the index as 0 i get the o/p as follows

firstnames[0] firstnames[1] firstnames[2]

for 1 o/p is

lastnames[0] lastnames[1] lastnames[2]

But i want the values which has been filled with this array names.

Similarly 10-15 arrays i have in my own coding and i can get the array name as above said using index. But i could not able to convert the string such as
lastnames[0],
lastnames[1],
lastnames[2]

to array object.

Hope u got the problem rightly.

Thanks in advance for ur help.

B.Prakash
19 years ago
Hi,

I viewed those replies but mine is somewhat different from that. I am not creating any dynamic array.

I have many number of arrays, in which i have values filled in it. I am getting the name of array in a string during runtime. Now i want to convert this string value to array object from which i should able to fetch values.

Is it possible? if yes how?

Hope u would have got my probs rightly now.

Thanks for ur help and reply.

B.Prakash.
19 years ago
Hi All,

Actually i have many arrays in my file...

I will be getting the array name dynamically so the string can have a values such as a[]/b[] like that so on depends upon the conditions...

So after getting the name of array in string variable i have to fetch the value from the corresponding array..

Hope all would have got my problem rightly..

I want some clearer answers pls..

Thanks in advance for the help

B.Prakash
19 years ago
I want to print it in WebPage
19 years ago
JSP
Hi All,

How to convert a string into variable name. For example i have a variable named "myname" with value "sachin" in it i.e myname="sachin".

Then in an string i have a name of the variable. using this strings value how to print the name sachin. i.e if myString = "myname" how to print "sachin" using this string variable?

eg code:

myname = "sachin";

String myString = "myname";

i want out.println(myString) to print "sachin".

Thanks in advance for ur help.

Bye,

B.Prakash.
19 years ago
JSP
Hi,

Have a variable page.

While calling the presentation page for first page call it with value 0 for this variable. Then after fetching the resultset move record cursor page * 50 times using looping. Then display ur next set of 50 records.

Then use next butoon to call the same page with (page + 1) value for this variable.

Following is a sample code for the above said :

ResultSet rs_sample;

int toMove = Integer.ParseInt(request.getParameter("page"));

//to move record cursor to point particular page's start record

for(i=1;tomove*50;i++)
rs_sample.next();

int count = 1;

while(rs_sample.next && count <= 50)
{
// display records in your own format may be 1 record per row
}

Call samepagename.jsp with page=(toMove-1) for previous page

Call samepagename.jsp with page=(toMove+1) for next page

Hope this could be useful for u.

Bye,

B.Prakash
19 years ago
JSP
Hi,

To have an object available in new page while redirecting, u can use redirect to new page as follows

response.sendRedirect(response.encodeRedirectURL(pagename))

This will send the request to new page with the same session-id so all the objects will be available in new pages too.

Hope this could be useful.

Bye,

B.Prakash.
19 years ago
JSP
Hi,

I have an value in string variable as "arrayname[index]".

How to convert this to an corresponding array object for getting values from the array?

Thanks in advance for ur Help.

B.Prakash.
19 years ago