Transfer flyingwcy servlet design

xiaoxiao2021-03-06  61

Servlet design

This article introduces several servlet methods, these methods are powerful. I believe there is a certain help for web design. Don't take a method of testing, wait for all the content, then use these methods and combine the previous Workshop to make a small program. (1) ParstextMessage () method In this example: Defines a data acceptance class. The parseExtMessage () method accepts a group of objects from the form and their values. When we do some product development, such as custom forms, often do not know how many objects delivered, for such problems, the program is unknown, after using this method, you can report all the objects. Arrived. Let's take a look at this example: Private void ParstextMessage (httpservletRequest request) {enumeration name; / / list all objects passing all objects String Name; / String [] value; // // Accept all object name = request.getParameterNames ); While (Names.haASMoreElements ()) {// Get Object Name Name = (String) Names.NexTelement (); // Re-found according to the object name VALUE = Request.GetParameterValues ​​(Name); // Put the object Names and values ​​are placed in a class, this class has a PT (Name, Value) in the previous exercise;} // Get a page ID, why set the Page ID in the Java rule, there is PageId = getPostPageId ); // Get the transaction ID, if there is transaction, TRXID = getposttrxid ();} (2) getjspbeanInsions () method This is an I / O management class. This method returns the JSP data from the session according to the ID of the page, and if you use getSession (true). GetaTRibute (pageID). Private JPC_JspBean getjspBeanInsSion (String pageID) {// Based on the page's ID to return JSP data return (JPC_JspBean) Request.getSession (). getAttribute (PageID);} (3) DispatchTransAction () method Instances of the class, then start transaction processing.

转载请注明原文地址:https://www.9cbs.com/read-117629.html

New Post(0)