• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Dynamic table with jsp-servlet-javascript

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good morning.
I want to do an application that, when I start to put my text in the text box, my table automatically refreshes.
I saw this before, I think with jquery, but I want to know how to do this with javascript and/or jsp and servlets.

I searched on google without success..
Someone can help me?

obs.: I don't want to use frameworks like jsf or jquery (if possible).

thank's.
 
Sheriff
Posts: 67746
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
Why would you not want to use jQuery? It makes JavaScript a lot simpler. It's like saying you don;t want to use Java libraries and do everything yourself. Rather short-sighted.

In fact, with jQuery your problem is almost trivial.

In any case, this has been moved to the HTML/JavaScript forum.
 
Breno Ribeiro
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, if will be most simply with jQuery have no problem..
We have one way through where we can do that without javascript?
Are you sure that this topic need to be moved to javascript forum? Because we will use parameters from servlet..
 
Bear Bibeault
Sheriff
Posts: 67746
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
If all you want to refresh is that table, then there is no way to do this without JavaScript unless you embed the table in a fixe iframe (which is a lousy solution, in my opinion).
 
Bear Bibeault
Sheriff
Posts: 67746
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
In fact, using jQuery it's one line of code:
 
Breno Ribeiro
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:In fact, using jQuery it's one line of code:




What the servlet have to return ??
 
Bear Bibeault
Sheriff
Posts: 67746
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
The HTML of the updated table.

I've done this many times. The servlet gets the data for the table, and forwards to a JSP that uses JSTL and EL to create the table HTML.

the jQuery load() method replaces the old table with the new one.

Easy as pie.
 
Breno Ribeiro
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:The HTML of the updated table.

I've done this many times. The servlet gets the data for the table, and forwards to a JSP that uses JSTL and EL to create the table HTML.

the jQuery load() method replaces the old table with the new one.

Easy as pie.



How would look like?

in servlet:


and jsp page:




 
Bear Bibeault
Sheriff
Posts: 67746
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
No need for any script on the table response.

In the table markup, you'd use the JSTL forEach tags to create the rows (<tr>) and columns (<td>) elements in order to create the table structure.
 
Breno Ribeiro
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:No need for any script on the table response.

In the table markup, you'd use the JSTL forEach tags to create the rows (<tr>) and columns (<td>) elements in order to create the table structure.



but in this case can I do a dynamic table where when the user is typing the text, the table will filtering the results??

 
Bear Bibeault
Sheriff
Posts: 67746
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
I'm not sure exactly what you are asking, but yeah, this is the most flexible approach.
 
eat bricks! HA! And here's another one! And a tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic