Recommended: ASP Optimization: Several Best Choices to Improve ASP Performance ASP developers are constantly working to get better performance and scalability in their design projects. Fortunately, there are many books and sites that provide great advice on this. However, the basis of these suggestions is the conclusion drawn from the structure of the ASP platform work,
I went to the forum today and saw a netizen bluesky asked a question, which is better, ASP or JSP, and what is the difference?There seems to be no thread safety problem for ASP, while there is a thread safety problem for JSP. This does not mean that ASP is good, but on the contrary, ASP is not as good as JSP.
For ASP: every request, the server-side code must be explained and executed. After execution, all the others are gone except Session and Application. In this way, ASP cannot implement static variables. I don’t know if it is really impossible to implement them. Please give me some advice.
In JSP, Servlet (JSP will also become Servlet) is multi-threaded. After execution, not only the Session and Application are still there, but the Servlet instance is still in memory. You can use it directly if you request it in the future. It is this that improves efficiency.
I always feel that the Servlet model is advanced than ASP, and the Java language makes it very professional! This is really something that ASP is far from comparable.
Some differences between JSP and ASP
Session Management
In order to track the user's operation status, ASP applies a SESSION object. JSP uses an object called HttpSession to implement the same function. Session information is saved on the server side, and Session id is saved in the client's cookie. If the client prohibits cookies, the Session Id must be brought behind the url. Session usually sets a 30-minute expiration time on the server, which automatically fails when the customer stops activity. The information stored and retrieved in the Session cannot be basic data types (primitivedatatypes) such as (int, double), but must be the corresponding object (object) of Java such as (Integer, Double).
HttpSessionsession=request.getSession();//Get a session object or create a session.getId()//Get sessionID number Integerid=(Integer)session.getValue(id)//Retrieve the session value and convert it into an integer session.putValue(ItemValue,itemName);//ItemValue must not be a simple type
Application Management
Sometimes the server needs to manage parameters for the entire application so that every customer can get the same parameter value. Like Session, ASP uses Application objects and JSP uses ServletContext objects, and the operation methods are the same as Session.
getServletContext().setAttribute(Item,ItemValue);//Set an application variable
Integeri=(Integer)getServletContext().getAttribute(ItemName);//get//item
ServerSideIncludes
ASP and JSP have the same meaning on server-side references. Both ASP and JSP can implement virtual files on servers (IIS, APACHE) that support this function. But JSP is to include the results of the dynamic page, not the code itself that contains the file. When the files you include are on another server, not including any code and objects is a very effective feature.
ASP:<!--#includefile=subfile.asp-->
JSP:%@includefile=subfile.jsp--
Share: The code for the Max Film Station to generate Rss Feed Some time ago, in order to add Rss subscription function to my movie site, I wrote an ASP code that dynamically generates Rss Feed. I can't upload attachments, so I just pasted the code. It's not long anyway. Friends who use Max as movie site can use it directly. Change other types of sites.