I just learned about ssh and want to write a website. I have several questions to answer. Question 1: I want to display news on the homepage. Currently, I can only read the database content using the following methods. $ {New. event} result :! IMG (img.ask.csdn.netupload201602231456235075_156909.png) I am troubled by the code writing method on the jsp page. Is there any way to automatically obtain a query set when I access the home page. Note: Instead of opening a new page through XX. action, I want to access index. jsp... mysqlsql server for the first time.
I just learned about ssh and want to write a website. I have several questions to answer.
Question 1: I want to display news on the homepage. Currently, I can only read the database content using the following methods.
<%
NewsDao dao = new NewsDao ();
Session. setAttribute ("newlist", dao. queryAllNews ());
%>
/C: forEach
Result:
This method of writing code on jsp pages makes me very difficult. Is there any way to automatically obtain the query set when accessing the home page.
Note: not through XX. action and open a new page. I want to access index for the first time. jsp can read the database content without writing the <%> code on jsp.
Question 2: When the news is opened, when the content is displayed, the content of the article is ugly. how can we save the content of the article and automatically wrap it when it is displayed.
(I can only think of saving it in a line break
And then use XX. innerHtml in js. it may be silly .)
Question 3: What should I do if I want to save the image? Currently, the mysql database is used. (Using sqlserver? Method)