enable users post data and make it appear in my website
I have developed some webpages with html, javascript and jsp.
I have also developed a simple editor based on javascript.
Can anyone tell me how to make 开发者_Python百科the exact content given by the user in the editor to be available in a webpage when submit button is clicked. Should server side coding be performed and how?
Should the content entered by the user be stored in a database and retrieved in a page? If so, how to store image content along with text? I use a mysql database.
It is for an my academic project. Thanks in advance...
To fulfill the requirement of retrieving the content of the editor on a page at some later point in time you will need to:
On user submission in your editor:
- Send the content of the editor to the server in a POST request.
- On the server, read the content sent in the POST request.
- Store it in the database in a format which you can either a) embed in an html document b) translate to a form you can embed in an html document.
On the server when handling a request for a document that should show the submitted content:
- Read the content from the database.
- Write the content to the page using.
I would get this functionality working before considering the special case of images being included in your content. That depends on how your JavaScript editor is allowing users to add images to content. For example, is it uploading them to the server and then embedding an image tag with the uri of the uploaded image?
the answer is yes!
the users post data should be stored in mysql .
and mysql didn't store the image. it store a link address(or path) to a File which is an image in your server.
when you find a user post from database which contains an image. u will get a link or path from this data. use it should get an image.
there is lots of javascript editors, you can config ckeditor to keep what
精彩评论