• 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

Render a table dynamically, add values, and then store it back to DB

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im not sure if this is the best place to this thread but 2 out 3!

So I want to do this kind of tables:

Something like this but with n Rows
(yellow=DB data, Blue=User inputs, Greens=dynamic fields)
The price row should be feeded dynamically from the DB’s Table1.
as the user puts quantity values column, green Totals columns updates,
then pressing a button saves all row by row to DB’s Table2.


So far they where a pain to do. Im wondering if you guys know a better/efficient way to do them. (I dont know Jquery but if it delivers...)
All that using php and Mysql.

Thanks in advance!
 
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
This seems like a pretty straightforward and easy thing to accomplish as a Java web application -- is that what you're going for?

Sure, if you did this all as a blob in a PHP page, it'd be just as much as a mess as putting all the code into the equivalent JSP page -- but that's not the right way to approach it. A multi-layered web app with appropriate structured layers to separate the concerns makes this kind of thing much easier to handle (and test, and maintain, and extend, and so on...)

First, read this article to make sure you understand what JSP is all about (shouldn't be much surprise here if you are familiar with PHP concepts), then read this article to learn how to properly structure a Java web app.

That's all assuming you want to do this as a traditional Java web app.

In this scenario, you mentioned jQuery which could help out in a supporting role on the client side with event handling and the like.

But......... as you are the one who brought up JavaScript perhaps a traditional Java web app is not what you are after. In that case, read on to my next post...
 
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
Traditional Java web apps as described in my previous post are still very prevalent on the web, but are no longer considered the most modern approach. The modern state of the art is the JavaScript SPA (single-page application).

In a JavaScript SPA, the server part of the application is only concerned with providing the data (and data-related business logic) usually in the form a RESTful API. The UI, rather than being created on the server via tech such as JSP or PHP, is created by JavaScript on the client.

While this can be done with pure jQuery (or even raw JavaScript if you are particularly masochistic), it's much more common to use a JavaScript MVVC framework such as EmberJS or AngluarJS.

To be on the most modern wave, you'd be looking into Angular2 with TypeScript (an extension of JavaScript) or ReactJS.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic