Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Update HTML-Table through struts 2- Ajax

 
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm Having a form Contains User-Info like name, age, address, country, zip, gender in JSP(Using struts-2 and ajax tags). In same JSP page, I've HTML-Table contains these User-Info as headers. When the user clicks on submit button, All the data, what he entered in the form should populate on the Html table in the first row(always) and when he clicks on particular row in the table, the information re-populate on the form. The HTML-table contains maximum of 5 rows. If he entered sixth row, then pagination required. I want to do this in struts 2 - ajax. I'm new to Ajax. Can any one tell me how to do this. Please post the code if possible.

Thanks:
Ramakrishna
 
Ramakrishna Udupa
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Finally I completed half of my requirement. Here is My code (**This code contains some of the useless code, please ignore it. Also Just copy paste all the codes to eclipse with all necessary .jar files to see the problem**)

struts.xml




action class





index.jsp




servertime.jsp


Now, I've small workflow doubt. When I click on submit button, jQuery-Ajax request will send to the action, without page refreshing I can add the fields what the user entered in text boxes(No DB used, just sample). So now, In my index.jsp page, in the *result*(having id="result") field I want to display the current date and time, I redirect that to servertime.jsp in my struts.xml. But It is not coming. I mean, I want both the json reply as well as JSP reply at a time. Can anyone tell me how to do this with proper explanation?

Thanks
Ramakrishna K.C
 
You will always be treated with dignity. Now, strip naked, get on the probulator and hold this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic