[問題] jsp function 問題
程式如下
<%!
public String test()
{
String rootPath = application.getRealPath("/");
return rootPath ;
}
%>
<%
String rootPath = application.getRealPath("/");
out.print(rootPath);
%>
為什麼 application.getRealPath("/") 在 test() function 裡無法work,
但在test() 外是可以work的.
試了很多功能, 似乎在 function裡都不能使用.
google也找不到答案, 我想應該是我方向錯了,
我是jsp 新手, 麻煩指教, 非常感謝~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.130.162.129
→
01/03 20:19, , 1F
01/03 20:19, 1F
推
01/03 22:31, , 2F
01/03 22:31, 2F
→
01/03 22:33, , 3F
01/03 22:33, 3F
→
01/04 09:56, , 4F
01/04 09:56, 4F
→
01/04 09:57, , 5F
01/04 09:57, 5F
推
01/04 11:06, , 6F
01/04 11:06, 6F
→
01/04 17:06, , 7F
01/04 17:06, 7F
→
01/04 17:07, , 8F
01/04 17:07, 8F
→
01/04 17:07, , 9F
01/04 17:07, 9F