• Post Reply Bookmark Topic Watch Topic
  • New Topic

Does JSF rewrite JSP Page?

 
Ken Flor
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am a newbie to JSF. I have been searching the net but to no avail.

I need to know if JSF rewrites the JSP Page again? If JSF can solve my problem, I will revamp my system to use JSF.

I have a JSP page with a form.
Inside my form, I use a bean. The bean is invoked to load some data from database to display on the JSP. Below the data, I have some textfields for user to input.
When the form is submitted, the data from the database is loaded again as it rewrites the entire JSP. Of cos, the bean sets and gets the value from user, therefore the information entered by the user remains.
However the data is queried again in the database.

I will like to know if JSF can solve my problem, having an eventlistener, so on click on the button, JSF can sets the values input from user without rewriting the whole content of the JSP page again.

Sorry for the long post.

Please help me.

Thanks
 
Tim Holloway
Bartender
Posts: 18417
60
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like you're asking if it's possible to rewrite part of a displayed page using JSF without resending the parts that don't need updating.

Short answer: No. No, not in JSP, not in JSF, not in .Net, cgi-Perl, PHP or even FORTRAN cgi.

The reason for such a loud and unequivocal answer is that the problem isn't Java-related, it's the HTTP protocol itself. HTTP doesn't support partial page updates. About the closest people used to be able to get was to use frames and update the individual frames.

More recently, the fad is to use AJAX. AJAX uses the client to do what the server cannot. Since JavaScript can dynamically update any part of the displayed web page it wants, AND since JavaScript can initiate background HTTP requests, an AJAX request can prompt the server to return ONLY the updated data, then modify the part of the webpage that displays that data.

AJAX by itself is pure JavaScript, which can be pretty ugly. However there has been a lot of work lately on JSF components that do all the JavaScript setup and communications work for you. I don't know if there's yet anything fit for general use out there, however.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!