aspose file tools
The moose likes Java in General and the fly likes is it correct Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "is it correct" Watch "is it correct" New topic
Author

is it correct

Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 760
Isn't there any other way to do the same thing i had to do this becase i'm passing from1 to some constructor which accept simple string. not String[]

String from[] = request.getParameterValues("from");
String to[] = request.getParameterValues("to");
String sub[] = request.getParameterValues("sub");
String message[] = request.getParameterValues("message");

String from1,to1,sub1,message1;

from1 = from[0];
to1 = to[0];
sub1 = sub[0];
message1 = message[0];


Jigar Naik


David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Why are you double handling?


The array shouldn't be required at all.
Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 760
String from[] = request.getParameterValues(from);

if i write this than it wont get compled.
Its giving err : A method getParameterValue(String) in the type servlet request is not applicable for the arguement String[]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Sorry, use getParameter(), and not getParameterValues(). The second one is only used when you expect the parameter to have multiple values, and obviously you do not.
 
Have you tried LearnNowOnline? http://www.learnnowonline.com/
 
subject: is it correct