Say I have a java/spring/jsf/jsp web application. User fills all required fields, chooses all the options, clicks generate report, spring beans do their job, database is queried for information, and user is directed to a "report" page generated according to entered information. I am looking for a way to save that page to be accessed later by link - kind of a share current page link. One example of this might be jsfiddle.net where you can enter information, save it and get a shareable link.
What i thought of, having my current knowledge, is saving some kind of url extension hash along with currently displayed page properties to database and query database for that information when someone accesses www.websiteUrl.com/extensionHash but making a query everytime someone accesses the extension seems kind of heavy on performance. Another way could be saving whole html page or just the content part on the server and serve later on request.
What is the most simple/productive way of doing this?
This is one option instead of link :
What you can do is you can load the required data for that report from database when your application starts, put the data in Application Context ( ServletContext in Java ) and whenever you want to get the information, instead of making a database call, you get that from Application Context.( so basically its like you are loading from cache) this way your perfomance is improved.
in java, You can achieve that by implementing a listner class.
Downvoters : please specify the reason.
Related
I am fairly new to javascript, I do know basics. I am looking to build my own (from scratch) java script library just like google analytics.js that will track user behavior on websites. Basically I'm looking to collect data like
Click through data
Dwell time
Page hits etc..
I spent lot of time trying to find website/tutorials to get me started on this but I keep ending up on google analytics.js or some private tools.
What I am looking for :
Is there any good starting point/resource/website which can help me build this js library
Are there reference for archetecture of end to end system including back-end?
Any open-source library that I can directly use?
Some things I already looked into
Chaoming build your own analytics tool
Splunk BYO analytics
At it's most basic, the architecture of such an application would only require a client, server, and database.
You can use basic javascript functions to record specific user actions on the frontend and then push them to your server. To identify your users you can set a cookie with a unique id. Then, everytime you send data to your server, you will get the specific user request as well so you can keep track of their actions. (Be careful of privacy laws first though).
For page hits, simply send a response to the server everytime someone opens your site - so call this function as soon as your Javascript loads. On the server, send a request to increment the appropriate value in your database.
For user dwell time, write a function that records the date when the user first hits your site and then count how long they stay there. Push your data to the server every so often and save updates to the user record by adding the new time spent to the current time spent. You could also watch for when a user is about to exit out of the site and then send the data all at once that way - although this method is more fragile.
For clicks and hovers, set up onclick and mouseover event handlers on your links or whatever elements you want to track. Then push the url of the link they clicked or whatever data you want - like "Clicked navbar after 200 seconds on site and after hovering over logo`.
If you want suggestions on specific technologies, then I suggest Node.js for your server side code and MongoDB for your database. There are many tutorials out there on how to use these technologies together. Look up javascript events for a list of the different things you can watch for on the frontend.
These are the building blocks you need. Now you just have to work on defining the data you want and using these technologies to get it.
In short, I had a scoreboard application written in HTML and Javascript that contained a timer, home name, guest name, home score, guest score, and period. I was able to make a display webpage without buttons (see image) and a controller webpage with buttons. Using Dropbox Datastores API, I was able to control the display webpage with the controller webpage. Now that the Datastores API is no longer working, I need a different way of syncing the variables across the webpages. Any thoughts on how I could do this? I was thinking about using a database.
If you only want to store the data for the current browser, I'd offer LocalStorage as a solution. Otherwise, yes, sending the data to a database is appropriate.
(I apologize for any incorrect lingo)
I am creating an internal web page as a sort of intranet for me and another associate to use in our department to keep track of information. I have created "pages" using HTML to navigate and saved in our department folder. Doesn't need to be flashy just functional.
I have a table with 5 columns of information for each item we need filled out. I have created a pop-up window and form for these 5 columns to open and the idea is that when the the user (me) fills the form out and clicks the submit button, the information is transferred to the parent page, saved and stored for later tracking.
I'm assuming this isn't possible by just saving .html files into our network folders. I think i might need a database to "save" the information the user filled out.
I wouldn't necessarily need the window pop-up..
Is this way over my head?
You would at least need a server side language such as PHP. Using a Database is highly recommended.
In my very humble opinion - Yes, it does sound as if this is over your head right now.
Recommended readings:
http://www.amazon.com/s/ref=nb_sb_ss_c_0_3?url=search-alias%3Dstripbooks&field-keywords=php&sprefix=php%2Caps%2C129
Let me know if my answer is helpful.
Im writing a browser plugin that needs to store a time variable specific to the user. Only thing is the js file which needs the data is "on every page" and cant really do local storage.
I need some direction for some alternatives for this.
Let me explain a little further how things work.
Plugin Structure
The plugin calls a javascript file from my server on specific websites - called appScript.js
appScript.js is our main file and places an image on the chosen websites. When the image is clicked it calls an iFrame called iframe.php which has a main.js file with it.
From the iFrame users connect to facebook and we pull their facebook ID and send the information to a php script which stores some data on a mysql table. Each users informations is located on the mySQL using their facebook ID as an index.
appScript.js needs to save a variable specific to the user.
My thought of alternatives
Store data locally - when i use local storage on the appScript.js it stores the data specific to the url and thus cant be accessed when the appScript.js is called on a different url.
Store it on my server - It is possible, but hopefully theres a better route to go down because I want the plugin to affect browsing speed as little as possible unless the image is clicked and the iframe called.(South african speeds aren't too quick). How it would work is it would have to connect to facebook, call the users ID, then send it to the server, wait for the response and then act on it, this could take time and slow down users browsing experience.
Store the data on the iFrame.php some how - well i need the data before the iFrame is called, so that cant happen.
I thought of dynamically loading an invisible iFrame onto the page which could use local storage because it would save it under my servers URL and thus be accessible on any page. Only issue is that i havent successfully been able to call data from a variable held on the iFrame with the appScript.js which isnt in an iframe. (if this in possible could someone maybe point me out to a working example. I've read up code but havent been able to implement it successfully)
I'm stumped - what else can i do? any ideas? i've run out of keywords to google and techniques to learn.
With Userscripts (GreaseMonkey, etc) there is a functions called GM_setVlaue, GM_getValue that will save (and get) values in a script-specific way.
If you don't want to use userscripts, you could look at the plugin source and see how they load/save values behind the scenes.
A site I am working on requires user information to be collected from a form when the user presses the submit button. The site will then take the information and plug it into a more robust form on a different page, so the user does not have to retype the information twice.
Is this possible using javascript?
Any help appreciated.
Once the user leaves the current page, the JavaScript on the original page is no longer running, They will load up the other page and run that page's JavaScript.
Do you have ownership of both pages?
If so, then you can leverage the form GET to pass information across pages, so the next page will have a Query string, and JavaScript can parse that.
Another way to move data from one page to another is to use Cookies. So it really depends on how much data you want to move around.
But I highly recommend that you leverage the server-side technology to handle the form GET or POST and carry information across pages.
This completely depends on the OTHER site. You can have a form with the same field names and post it to the same URL the other site's form uses.
BUT - if that site checks to see where the original post came from, it may block you out.