Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

generating client-side code  RSS feed

 
Madam deman Leonardo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I want to generate client-side code for compiling server-side script before display the page on the browser?
For example, If I have the following java snipt in the webpage.jsp
<%

String ss = (new JSONArray(whatever)).toString();

%>

I really want to get the value of ss that will be generated for client-side and I want to get this value before the page will be dispalyed to the user to use it somewhere . Is there any way such as library, function or any technology

thanks in advance

M-D
 
Paul Clapham
Sheriff
Posts: 22508
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That code already does it before it's displayed at the client. That's exactly what a JSP does: it runs on the server and generates HTML (and so on) and then sends it to be displayed at the client. You don't need anything else.

Except if what you are doing doesn't contribute to producing the client view, it's better to do it in a servlet and then forward to the JSP once you have done that.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read this article to understand what JSP is all about.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!