• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

How to update the screen without reloading jsp/sertvlet ?

 
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
- I must have a JTREE in my JSP or Servlet. I used MyFaces. Is it good ? Or is there other projects ? We don't want to use applets because we find that it's very slow.
- When i click in a node in the tree i don't want to reload the page to get some properties in the database for this node. I want to get properties
in background and display these properties in a textfield for example.
Is there a way ? a tool for this ?and it must be fast of course for retrieving and displaying my datas.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can make calls to a server from Javascript and then update HTML elements without repainting the whole page. Google on "AJAX" which is all the rage for this kind of thing right now.
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved to the JSF forum.
 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It sounds like you mean AJAX If you speak about updating the part of the page without reloading it.

This is a list of the steps have to be done to add AJAX behaviour to the JSF application:

1 Create a Javascript function that returns a XMLHttpRequest/XMLHTTP object appropriate for the browser in use.
2 Create a Javascript function for processing the response XML from the server.
3 Associate your XMLHttpRequest instance�s onreadystatechange delegate with your javascript function.
4 Use the open method on the XMLHttpRequest object to connect to the server.
5 Use the send method on the XMLHttpRequest object to do a transaction.
6 Receive the request on the server side and process it
7 Get access to the application data and change it according to the request
8 Update the Component Tree
9 Extract the difference from the previous interaction and form the responce
10 Receive the response for the server and update the portion of the DOM tree with Javascript function
11 When you need to repeat, reinitialize the XMLHttpRequest and reset its onreadystatechange delegate.

--
Sergey : http://jsfTutorials.net
 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you please elaborate on Steps 8, 9 and 10.

I have a JSP page with simple MyFaces components like two inputTexts and a button. What I want is whatever the user types in the first textbox should get into second textbox on click of the button. I am trying to use Ajax for this. My approach is to have a separate Ajax Servlet and return the response to the JSP.
When I test, I see that the response is captured by JSP page and the textbox gets the data into it.... but just for a second or so. After that the page appears to reload and the textbox loses its data and is blank.

I guess I am not implementing the steps correctly.

Can someone please suggest a simple Hello World for this.

Thanks in advance.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic