Now in my jsp page I have number of records come from oracle database.But I want to display limited number of records per time.How do I use pagination for this using jquery and jsp? I want to display 1-10 records at one time in my jsp. After click the next button I want to display my next record set.(11-20). In here values come from database are not fixed. My data table does not contain any headers.So it's not easy to use jquery data tables.How can I do this?
Your question is not very specific, anyway here's an example of what I did when paging the results of a search engine. I've used JSP and jQuery, maybe it can help you understand how to proceed: http://pastebin.com/XG40Vm2D
Related
I am new to programming and I am working on a web application using JAVA EE, struts, jsp, HTML,
I have a table which shows some statistics and my client wants me to add a feature to pick a back date to see that dates statistics, but I am totally confused.
I had pre built queries which were getting data from oracle database and displaying data on my table on a JSP page. But now I change my query to a prepared statement and I have added a "?" to get a date from user and then replace that and make a query and display data.
First problem is that which struts when you have values to be displayed and they have some sort of problem the table won't even show up and secondly when I try to pick a date and hit submit button it should go make the query and display the table but it is not happening, I am totally lost. I will be grateful if someone can tell me how to solve this problem.
Thanks.
I would like to display a table from a site onto my site with an automatic updater. Would this be possible with PHP or Javascript? I've tried parsing the data into a google sheet, and later displaying the google sheet on my site but I feel like there is an easier way. The table I'm trying to display is here https://ahlhaxball.000webhostapp.com/table/table/ labeled "League Table"
You can do it with PHP. If you want to do update it live without refreshing page (like updating every min or every sec) then you need to use PHP with Ajax. Ajax will help you to make calls without refreshing the page.
I have a php page that shows track listings of classical CD's. The table draws data from two very similar but different mysql tables which sometimes leads to (partial) duplication of table rows.
These are the two possibilities (with the number being the track number on the CD):
1 Work title
1 Subwork title
Work title (possibly altered)
2 Work title
In the first case I want to remove the track number. In the second case I want to retain the work title in the first line, add the track number of the second line and do nothing with the work title of the second line. So the result should look like:
Work title
1 Subwork title
2 Work title (possibly altered)
Can this be accomplished in php or should I look in the direction of javascript or jQuery for a solution? I tried using
$("div").empty();
but couldn't make it work.
All suggestions are welcome.
The most efficient way would be to process the data on the server (PHP) as it is retrieved from the database. This way you aren't transferring large data sizes to the client only to have the front-end (javascript) to discard anything of the data this isn't needed. This will create a not so desirable user experience.
If your PHP script is generating your entire table at once, then you can do it in PHP. If your PHP script only creates part of the table, sends it to the user, and it is later modified by something like an AJAX call, then you have to do it in Javascript.
I came across this page at walmart.com and on the left side of the page is a checkbox filtering system that is done on the client side. When you check the price checkbox selection it filters out the brands and disables enables/disables them etc.
When i had a look at the source code the checkboxes have no values and when i tried to find the REFINEMENT.clicked event I couldn't find it when I downloaded the page. It's a very big page with lots of code and would prob take a long time to go through it.
I was wondering how could I implement this filtering system in jquery for the client side. You could use a array that stores values but how would i know which properties the filters have as each page would show different filters (other than price range) based upon the product type.
If someone could point me in the right direction or give an example as to what to do that would help.
It is a simple ajax call.
Here is a very similar question Filter divs/table rows based on checkbox criteria -Javascript/JQuery
Here is the url when the top checkbox is checked and it results in a JSON reply.
{"dvals":[{"id":"500580", "count":"16"},...
So they contact the server each time
clicked:function(K){var J=F(K);if(!J.disabled||J.checked){J.checked=!J.checked;ASN.RefinementBox.check(J);}},
check:function(K){try{if(!K.checked){ASN.RefinementBox.uncheck(K.id);ASN.BubbleMsg.bubbleMsg(K.id);}else{if(!REFINEMENT.maximumCheck(K)){A.putDval(K.id);ASN.RefinementBox.sendSelection();ASN.BubbleMsg.bubbleMsg(K.id);}}}catch(J){}},uncheck:function(J){A.removeDval(J);ASN.RefinementBox.sendSelection();}
In the page itself it has stuff like
WALMART.quicklook.items.push({"itemId":16472509,"price":'<!--Start qlPrevNextPricing Tag--><span class="prevNextDefaultText"><span class="PriceL"></span><span class="bigPriceText2">$398.</span><span class="smallPriceText2">00</span><span></span></span><!--End qlPrevNextPricing Tag-->',"thumbnailURL":"http://i.walmartimages.com/i/p/00/88/61/11/62/0088611162102_60X60.gif"});
and similar to hold prices to calculate and to show
The PicNet Table Filter Plugin for jQuery lets you filter a table of data with check boxes or search fields. Just make sure your table contains the data to be filtered, even if they are in hidden columns that the user can't see.
In my struts2 application, I have a JSP with two autocompleter fields and a submit button. The goal is when I submit, a table should be displayed in the same JSP (below the submit button) which populates data from the database (basing on the selected values of autocompleter).
I think definitely we should call some action(which goes to struts.xml and basing on the result some JSP will be shown). But, the idea is to display table in the same JSP. Can I achieve this by calling some action in a regular way. I am new to struts2 and can anyone help me providing a good solution.
You need to use ajax. Pass the value selected in the autocompleter to the ajax call as parameter and then you can return result list in the form of xml, json or whatever form you want.
There are many table plugins available to help displaying ajax result set in a table form. DataTables is my favourite.
For question regarding making ajax call/response in struts2 take a look here
Also, there is a struts2-jquery plugin available, you can explore that. Ihave not used it though