Build website using JSP or Javascript [closed] - javascript

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have to build a website which involve e-commerce stuff like it should allow the users to login and then view the available items. Once the user selects the items and makes payment, it may need additional information in the form of some images/videos to complete the order. So, after payment step, it prompts the user to upload the file and when the file is uploaded on the server, request is complete and the user is kept informed about the status.
All the core functionality is already implemented using REST-ful webservices. I am not able to decide if I should implement the website using HTML+JS (using AJAX to call webservices) or should still use JSP and call webservices using java at server side? Someone suggested me that using JSP is better since it will execute on server side and hence will be secured and faster. But, I somehow feel that HTML+JS is easier to go. Is there some specific advantage to use a server side script like JSP for this purpose? Any ideas are most welcome.

Yes server side scripting will be fruitful for this purpose for security constraints. Or you can use angular js though they are easy to learn and they are secure and can make fast XHR request response. :)

Related

How to send information back and forth from a javascript file to a python file [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
So I have an html file with javascript and a python file. In the javascript file, the user enters a string. In the python, I would like it to search it in an api, and then return the string to be displayed in the html file. How do I do this? I have looked up how to use AJAX and get/post methods, but nothing has worked so far. Also, I should mention I am using flask.
The basic mechanics of having an HTML page communicate directly with another program is web server programming. If you want the web server to execute python, then consider setting up a Django server. Learning how to set up a web server and getting the two programs to talk with each other may take a while if it is your first time.

Website building, ask server to run a script with input [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm quite a newbie in everything related to web development, but I had this project in my mind that I really wanted to realize.
At the moment I am struggling with a method to send a request to the server hosting the website. The idea is that from the site you can enter keywords, and those keywords should be run in a script (python or java(script)) on the server after which it returns an output to the webpage. In theory this script could be executed in the website itself as javascript, but I would like to use the computing power and internet access from the server.
I have researched on using Json and javascript for the job, but I think there has to be a better way for this purpose. Is there anyone that can direct me where to look?
You should build your form in HTML. (More info: https://www.w3schools.com/html/html_forms.asp)
In client-side JavaScript (the code that website users have executing in their browser), you should use the jQuery library to scoop the data out of your form. Take a look at the .submit() and .val() functions to get started. Then you can use jQuery's AJAX function to submit requests to the server-side API in a JSON format.
On the server, in addition to creating a way of serving up the webpages (with their client-side JavaScript), you will then need to create an API to receive and respond to these requests. One way to do this is by running Node.js with Express, which will allow you to write your API in JavaScript. The downside to this is you will have to pay to get a full-fledged virtualized cloud server through AWS, Rackspace, or another host. The other option is for you to write your API in PHP, which is supported by free webhosts like x10hosting.com.

How can I run a python script from javascript? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
im working on a project where i have to create a gui for. The page that i'm working on has a form for user input that asks for a string. i want to take that input and send it to a python script that I have created for processing. The python script will then return a string of words to the javascript so that i can display it to the user in the webpage. Is there any way I can do so?
note: i am not an expert in programming hence please cut me some slack. it would be great if i could get a few examples as well.
You probably want to create and expose an HTTP endpoint using a Python web framework; the easiest choice would be Flask
This would require you to create a route/action view to handle POST requests using the Python script you created. You can then consume that HTTP endpoint using AJAX.
Another option would be to leverage the "serverless" infrastructure that Amazon Web Services provides; that way you could create an HTTP endpoint using Amazon API Gateway, and have that endpoint call an Amazon Lambda Python function, which would run your Python script and return the results. The advantage of this method is that is incredibly cheap and relatively easy to set up, especially if you only need to call that one Python script. Also, with this set up you wouldn't have to spin or maintain any web server yourself, since your Python script would be running directly on Amazon's servers.
Best of luck.

How to connect html page to Marklogic Database using javascript? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am newbie to web designing. Here I am trying to develop a web page where it prompts for username and password and when I click on button, this html has to make connection with these username and password values entered by user to Marklogic database . Could anyone please help how to do this? Is it through Javascript or PHP? If so please advise where can I find step by step explanation of this process ? Also it is okay if I get procedure for any NOSQL database.
OK. Your statement is a bit big and broad.. I decided to extract the most relevant concepts:
Sample Application including authentication
MarkLogic
Javascript or PHP
Therefore, I suggest looking at a reference framework using all javascript:
http://www.marklogic.com/what-is-marklogic/whats-new/samplestack/
This can have a node.js middle tier in node.js and does not require java.
It is a big step forward and (sort of) complex, but it is a complete example.
If it is too much for what you are looking for, then I suggest you research more specifically what you need in these two specific items in MarkLogic documents:
HTTP Server (where you can run your HTML/CSS/Javascript from)
REST API (for which you can use against your js code)
This is a 2-tier approach where your application(HTTP) server is serving both your HTTP site as well s the default REST enpoints.

Can Javascript somehow spy my website? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
If I were malicious (or malicious and thoughtless) I could add some PHP to websites I'm working (or back-end web applications I'm building) that can send some data I'm not authorised to have to my remote server. There are numerous ways to achieve that.
I was wondering: can Javascript do something similar?
For example, is it possible to be spied by using some html/css/javascript web template which will disclose informations from(about) my website - send any kind of information from my website/web app to remote server of malicious developer?
Thanks in advance.
Yes, of course you can send data to other servers using javascript. The difference to your PHP-snippet approach is only that it is executed client-side, at the user's view of the application. So, you can only leak data that the current user is knowing, and you can only compromise the application with the rights of the current user (and his credentials).
However, it would be more difficult to detect javascript injections (which can also happen clientside or during the transfer) than malicious PHP snippets.

Categories

Resources