JSP page to immediately display whenever a new row is added in table? - ajax

I have oracle dbTable letssay testDbTable having column columnA and columnB.Whenever a new row is added in database table,it should display content of that row on JSP page in following manner.
columnA(value):----- and then columnB(value):........
lestsay after some time a new row is added in testDbTable.
then output should be in two line. Added new row in testDbTable should be aove on previous row that was displayed earlier on JSP page.
columnA(value):----- and then columnB(value):........
columnA(value):----- and then columnB(value):........
But such action should be at same time whenever a new row is added.
The simplest way i could think of that check on database again and again for some predefined lenth of time,but this solution seems to be wasteful and suboptimal to me, so i was wondering is there a better way.
i think there should be a trigger on table,when a new row is added in db then trigger should be fired and display row content on JSP page. I know "how to create trigger on table" but after that i am blank,how will i display just added row on JSP. After trigger on db table how will i approach? Can Ajax solve my problem like auto refresh or watch on db table or sothing else?
is there anyway i can listen to a trigger on my database from a .jsp script and force my client page to be refreshed ? Can you provide me any example link related to ajax,oracle dbtriggers and JSP?

In this case you should try reverse ajax technology like Comet.

Related

Oracle Apex 19.1 (how to add, edit, delete data through a form)

I'm new to oracle apex so this might be simple.
I have an application that i'm currently building. I have an 'employee' table in the SQL workshop. When i attempt to create a form linked to the table there is no option to edit, delete, or add entries into the table ,once the form is completed?
This is essentially what i need help with. I need to be able to manipulate the 'employee' table through the form created rather than through anything within the sql workshop. Just for context i am not the workspace admin, however i am a contributor.
I would appreciate if anyone could provide me with a quick step by step guide into creating this desired form accurately.
I'd suggest you to create (using the Wizard, of course) Report with Form on Table. It will create
interactive report you'd use to view data stored in that table
form which will be used to insert/update/delete data
the same form will be called when you push
the "Create" button in order to create new rows, or
icon at the beginning of every line in the report in order to update/delete rows
This combination (report + form) works nicely for ages, so ... try it. I hope you'll find it useful.

How can I create a insert/update form for multiple table in Oracle Apex 5.1.4

I have craeted two tables. I have also created a page and shown all data as classic report by inner joining between two tables. Now I want to know how can I create a form to update both table at a time?
For single table it can be done easily by creating form and report page. But In case of multiple table what will be way?
Thanks
Create new page by the new page creation wizard using the Form > Single Page Master Detail template.
It will guide you.
Here's one option: create a view, then create instead-of trigger(s) upon that view. Use the same view as a data source on the Apex page.
I know for sure that it works in Oracle Forms; never tried it in Apex, though, but I believe that it should be just fine.

joomla dynamic drop down on registration form

I have two drop down list on my registration page of sql type. they both fetch data from database. but my problem is that in second drop down list , i want specific data as per the option selected in dropdown list 1. how to do it?
thank you very much
There are two possibilities(well theoretically endless)..
1) You send the whole data on pageload and then filter it using javascript based on the first selection.
2) Use the ajax technique, where you send the ajax handler the selected value and then the handler queries the database and sends the relative data which you append on the second select in the runtime.
Note:- for larger tables the firstone is NOT Recommended.

Grails update html table ajax insert with message

I'm come from a .net background to grails. I got a form for user to insert, and a html table with the list of records. Once user insert a new record, how do I update the html table with the record and display a message - e.g. company inserted?
Create a domain class for inserting your records, with whatever properties you need. Read Creating domain class and Grails GORM
Once the user submits your form insert the necessary values as a record into this. For getting the entire list of records you can call the list() method on your domain-class. Send the entire list of records to the client side as the response of the action / render as a model. See render. Update your html table using these new records.
For the status part, you may want to do the insert operations in a try-catch block and render a status a message accordingly.

How can I get the content from a session variable?

My situation:
On my jsp site I show a table. When somebody click a row, this row must be marked with an other backround color for example. Also more then one row can be marked. Two things are important.
First: I bear in mind which rows are marked.
Secend: In which order.
My idea is:
I have a ArrayList and put all row IDs in this. So I solve both problems. Now I put this ArrayList in the session for the next click and the row ID ( req.getSession().setAttribute(req.getParameter("rowID") , ""+arrayList.size()); ) for the jsp file.
My problem in jsp file:
I don't now what's called session variable name.
if this rowId alrady clicked?
..
I have got only the bean name. How can I get the content from the session, if exact this line must be marked?
Normally I set a session variable so: req.getSession.setAttribut("printView", Boolean.TRUE) and get a session variable so:
I work with struts, formbeans and jsp.
Sorry, I haven't good English and this problem is so difficult for me. So I can't declare it better at this time.
What about storing the ids of the rows clicked on a JavaScript Map, there you can change its backgound color.
Then, to submit this data to the action, just use struts + ajax (see Struts2InAction book chapter 8).
Also, if your are already uploading the data on the session context, implement SessionAware in your acction in order to be able to access session values.
Hope this help.

Resources