Welcome to Abdul Malik Ikhsan's Blog

mendapatkan url parameter dari servlet

Posted in Tutorial JSP, Tutorial Servlet by samsonasik on June 1, 2009

Pemanggilan url yang sering kita pakai pada framework2 php seperti CodeIgniter atau pun Zend ataupun framework php yang lain dapat kita gunakan pula di JSP, dengan servlet. misal, kita gunakan url parameter edit data :

<url-pattern>/detailbrg/kode/*</url-pattern>

Nah, cara panggil di servlet nya bisa seperti ini :

//————————————
response.setContentType(“text/html;charset=UTF-8”);
PrintWriter out = response.getWriter();
String[] spliturl = request.getRequestURL().toString().trim().split(“/”);

String kode = null;
for(int i=0;i

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: