• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can i control where the response.getWriter().println ends up in my DOM tree ?

 
Frank Jacobsen
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a servlet with these lines of code:


response.getWriter().println("Web service up and running");
RequestDispatcher rd = request.getRequestDispatcher("ping.jsp");
rd.include(request, response);


When the jsp is loaded i get "Web service up and running" in the top of my jsp.

Can i control where on the JSP i put this tekst.

I know i can be using ajax, but can i control with some javascript, or is there a other way, to control where this tekst
ends up in my jsp ?


Frank
 
Praful Thakare
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can write it to request attribute and use it in JSP to print whereever you like.



ofcourse you should use some tag libs of your front end framework, writing java code in jsp is stone age thing.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Formatting of the page is accomplished with HTML and CSS. If the HTML page is generated via JSP, you can use the JSTL and EL to control exactly what the page contains and where data is placed within in it.

You may want to look at this article for a discussion of how to structure a web app to get data to the JSP properly.
 
Frank Jacobsen
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks , just was i was looking fore

Frank
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!