※ 引述《longlyheart (longlyheart)》之銘言:
: 小弟我寫了一個搜尋網頁,想要請問:
: 如何將寫在網頁裡面的資料庫移出來變成一個Bean??
: 以下是我的程式碼:
: </body>
: 大約就是以上try裡面的東西,希望可以改成由Bean匯入
: 但是Bean不支援System.out.println這種東西....
: 所以寫了幾個Bean都沒辦法達到同樣的效果,請各位大大指導>"<
你弄錯了,System.out.println是consolo,
你看到的out 是屬於 JspWriter 類別。
你所需要的是在 JavaBean裡面把你要print的字串接起來,
在JSP裡調用JavaBean時透過 <%= %> 或 out.println()
去接你的JavaBean回傳的字串,而不是直接在JavaBean裡面print字串。
--
String temp="relax"; | Life just like programing
while(buringlife) String.forgot(temp); | to be right or wrong
while(sleeping) brain.setMemoryOut(); | need not to say
stack.push(life.running); | the compiler will
stack.push(scouting.buck()); | answer your life
stack.push(bowling.practice()); | Bone everything
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.134.27.68