Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Study log-create search engine search tips

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Packing process

Package the website program into a war package and use clean package

Put the war package in the webapps on the server's tomcat

Change the server.xml file in the conf directory:

Add the following code to change the coding mode to prevent garbled code.

URIEncoding= "UTF-8"

There is an access record of tomcat in the logs directory, as follows:

[root@hadoop11 logs] # lscatalina.2015-08-14.log host-manager.2015-08-14.loglocalhost_access_log.2015-08-14.txtcatalina.out localhost.2015-08-14.log manager.2015-08-14.loglocalhost_access_log.2015-08-14.txt

This is the access to the record, which contains the entered record value for analysis.

To facilitate statistics, you need to change the log file in server.xml, as follows:

Prefix is the prefix, suffix is the suffix, and fileDataFormat is the frequency

Use ajax to trigger an asynchronous request, as follows:

Using jquery's autocomplete plug-in, the request will be sent to uri in the background, and the server will return a json structure data information to the foreground and display it on the page.

$(document) .ready (function () {$("# query") .autocomplete ({source: function (request, response) {$.ajax ({/ / here is the processing class of the request server url: "http://hadoop11:8080/web/suggest.do", / / the dataType here is the data structure returned by response: dataType: "json", / / data is the passed data data: {query: $("# query"). Val ()} / / if the response is successful, success success: function (data) {/ / the class in action is found here. The result attribute in the class is a set collection / / what is returned here is a collection, which is returned to / / struts2 in the structure of json. Objects added to the value stack will first make a get assignment to the attribute. Then execute the required method response ($.map (data.result, function (item) {return {value:item}})) }});}, minLength:1,});}); public class SearchAction extends ActionSupport {String text; String query; Set result; public Set getResult () {/ / this.result = RedisTool.zrevrange (query, 0,5); result = new HashSet (); result.add ("aaa") Result.add ("son"); return result;}. .

The class here corresponds to the result above.

Required script

Ui in turn relies on:

When using redis, use the sort arrangement to insert the index

The hGetAll key, which lists all the values under the key.

Pass a value through query: redis will query it and return a set collection.

Public static Set zrevrange (String text, int I, int j) {/ / TODO Auto-generated method stub try {CreateJedisObj (); / / hadoop_users return jedis.zrevrange (text, 0,5);} catch (Exception e) {e.printStackTrace (); jedis = null Return null;}}

You can be familiar with the operation of redis.

In the actual development, the update of the redis database can be updated one by one, and the original data records of redis can be deleted in the process of reduce.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report