开发者

Desktop.getDesktop().browse(uri); will open web page on server or client side?

I have a JSF application and when user click on button I want to open a web page. Desktop.getDesktop().browse(uri); probably opens a web page on server side, how to do it on client side?

when i try Desktop.getDesktop().browse(uri); it works, but maybe its because I open 开发者_StackOverflowthe JSF application on localhost so I dont know if the opened uri is on server side or client side.

In the specification for getDesktop() its written:

getDesktop() 
Returns the Desktop instance of the current browser context.

Thanks!


You can do this by a simple link (and perhaps style it as a button):

<h:outputLink href="otherpage.jsf" target="_blank" />

If you insist on a button, there is a way to do this with javascript, but I'd recommend against it.

When developing web applications, forget about java.awt.* and javax.swing.* - they are not to be used in web application development (unless you create applets)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜