Home > しらべる > SAStrutsでURL情報を取得

SAStrutsでURL情報を取得

  • Posted by: memorycraft
  • 2009年2月 3日 08:43
  • しらべる

SAStrutsでURL情報を取るには以下のようにするといいっぽい。

@Resource
protected Map requestScope;

@Execute(validator = false)
public String test(){

	String requestUri = (String)requestScope.get("javax.servlet.forward.request_uri");
	String contextPath = (String)requestScope.get("javax.servlet.forward.context_path");
	String servletPath = (String)requestScope.get("javax.servlet.forward.servlet_path");
	String pathInfo = (String)requestScope.get("javax.servlet.forward.path_info");
	String queryString = (String)requestScope.get("javax.servlet.forward.query_string");

	System.out.println(requestUri);
	System.out.println(contextPath);
	System.out.println(servletPath);
	System.out.println(pathInfo);
	System.out.println(queryString);
		
	return "test.html";	
}

テスト:http://localhost:8080/example/test?hoge=moge#poge
結果は以下の通り

/example/test

/example/test
null
hoge=moge

Trackbacks:0

TrackBack URL for this entry
http://www.memorycraft.jp/mt-tb.cgi/97
Listed below are links to weblogs that reference
SAStrutsでURL情報を取得 from メモリークラフト

Comments:0

Comment Form

Home > しらべる > SAStrutsでURL情報を取得

ページの先頭へ戻る