Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling a JSP using Swing

 
Sudharshan Reddy Ch
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

How can i call a JSP page using Swing.

Thanks,
Sudha C Reddi
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "calling" a JSP? Do you want to write some kind of browser or something?
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you need to just process a JSP that exists on a server for the purpose of getting some info back or processing some server side logic, you can use an HttpURLConnection.

If you want to process a JSP inside an embedded browser in your app, you'll need to look at the JEditorPane. Or you can google for other libraries that allow you to embed a native browser in your Swing application and such.
 
Sudharshan Reddy Ch
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i click a button it should open a browser, and it should open a URL that calls a JSP page in that particular browser.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric Alberts BrowserLauncher class is a cross-platform way to launch a URL in a browser.
 
Sudharshan Reddy Ch
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it. Thanks to all. I used Ostermiller.util utility.

http://ostermiller.org/utils/Browser.html

Cheers
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Notice that this is not at all a Swing question...
 
johny sill
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
otherwise u can use

import java.net.*;

void NewWindow()
{
try{
URL url=new URL("http://google.co.in");
AppletContext context=getAppletContext();
context.showDocument(url,"_blank" );
}
catch(Exception e)
{
e.printStackTrace();

}

}
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that Johny Sills suggestion only works in applets.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic