This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Executing JSP programmatically  RSS feed

 
James Gordon
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm just wondering whether it is possible to load/execute a JSP programmatically through our Java program?
Meaning, when I run the program, it should process the JSP and somehow return the result file in HTML format back to me. The JSP is not displayed on the screen at anytime.
Any comments?
Thanks in advance.
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi James,
u can probably use URLConnection to connect to the JSP page and then recieve output of the JSP using URLConnection.getOutputStream() method.
though, this would give u the HTTP based output and u will have to interpret the way you want...
hope this is helpful.
regards
maulin
 
James Gordon
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thanks Maulin.
It works.
I use getInputStream instead.
 
hanumanth reddy
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using sockets overloads your server memory insted why dont you use servlets
 
James Gordon
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
U mean use servlet instead of the JSP?
Actually I'm thinking of using JSP as the source of my mail contents. By doing that, I can change the content easily and at the same time it can interact with database.

Thanks.
 
gautham kasinath
Ranch Hand
Posts: 583
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought JSP always gets translated as a Servlet.. umm well thats what the Weblogic, Pramati, Orion and Web Sphere said about the JSP.
I wonder how you bring in Sockets here.. well if you are talking about the URL Connection that is done.. Please clear me.
Lupo
 
James Gordon
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
..... Actually I am not pretty cleared with Hanumanth idea as well.
Regards.
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey James..
sorry i did typo...of course u gotta b using getInputStream..
replying while working makes me little more dumb ...
regards
maulin
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!