[英]Using 3rd Party Java Libraries on JSP
這有點惡心,但你能不能只在你的 JSP 中內聯適當的 Java ?
<%
// This should really be in a servlet
// Twitter4J code from their example
Twitter twitter = new TwitterFactory().getInstance();
List<Status> statuses = twitter.getFriendsTimeline();
System.out.println("Showing friends timeline.");
for (Status status : statuses) {
System.out.println(status.getUser().getName() + ":" +
status.getText());
}
%>
確保 Twitter4J jar 及其所有依賴項都在您的 WEB-INF/lib/ 文件夾中。 然后,如果可能的話,認真考慮不要在 JSP 中這樣做!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.