Answer the question
In order to leave comments, you need to log in
How to extract the value of request.getparameter?
Hello everyone, although the question is lamer, but I can not find the information.
On the server, I receive a string string String p_scnt = request.getParameter("p_scnt");
:
User [userid=1, firstName=Ira, lastName=Ivanova, dob=null, [email protected]].
userid
, how to select it. Answer the question
In order to leave comments, you need to log in
Ideally, it is better to send data at least in JSON, then you can easily deserialize the message into a specific object on the server side. And from it already pull the data you need.
And so, the simplest solution in the forehead:
String request = "User [userid=1, firstName=Ira, lastName=Ivanova, dob=null, [email protected]]";
int beginOfString = request.indexOf("=") + 1;
int endOfString = request.indexOf(",");
String id = request.substring(beginOfString, endOfString);
System.out.println(id);
String request = "User [userid=1, firstName=Ira, lastName=Ivanova, dob=null, [email protected]]";
String userId = "userid=";
int beginOfString = request.indexOf(userId) + userId.length();
int endOfString = request.indexOf(",", beginOfString);
String id = request.substring(beginOfString, endOfString);
System.out.println(id);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question