protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
BufferedReader br = new BufferedReader(new FileReader("src/suraj.txt"));
String everything="rahul";
StringBuilder sb = new StringBuilder();
String line = br.readLine();
while (line != null)
{
sb.append(line);
sb.append("\n");
line = br.readLine();
everything = sb.toString();
}
request.setAttribute("date",everything);
RequsetDispatcher rd= Requ//here i got stuck how to forward the request to a jsp file }
}
我想將我的字符串變量的值發送到一個jsp文件,以便我可以在瀏覽器上顯示它。如何將對象值從servlet發送到jsp頁面
您正在使用哪種框架?即Struts或Spring? – 2013-03-25 20:02:43
檢查我更新的帖子。它給你一些想法,如果你想重定向到一個JSP頁面。 – 2013-03-25 20:06:55