Translating php code to jsp
$postdata = http_build_query(array('name' => $album_name,'message' => $album_description));
$opts = array('http' =&g开发者_StackOverflow社区t;array( 'method'=> 'POST',
'header'=>'Content-type: application/x-www-form-urlencoded',
'content' => $postdata));
$context = stream_context_create($opts);
Could anyone tell me similar function on jsp
http_build_query() is php function, similar function in Jsp is what?
stream_context_create() also php function
With scriptlets you can call java libraries in jsps.
For http_build_query, the analog in Java is the URLEncoder class. Here's a simple tutorial on how to use it.
For stream_context_create, I guess you want to send an http request to a server, the analog in Java is Java.net. See this post for mini a torial.
精彩评论