热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

关于.net生成静态页面的方法总结

这几天在做国家教育平台阳光工程,由于考虑到将来的用户群比较多,所以我们考虑使用.net生成静态页面的方法来减少数据与数据库的访问量,虽然以前也写过一些静态的页面,但是感觉没有将来的比较复杂,所以搜

 

 这几天在做国家教育平台阳光工程,由于考虑到将来的用户群比较多,所以我们考虑使用.net生成静态页面的方法来减少数据与数据库的访问量,虽然以前也写过一些静态的页面,但是感觉没有将来的比较复杂,所以搜索了一下网络,再结合自己以前的一些经验,总结出以下几步思想:

1)做一个比较好的模板temp1.html,并在模板中写好题目,内容,作者 以及发布日期的标记,如果还有其他列表的话也要写好其他列表的标记,如 题目可以用标记:$Title$,内容可以用$cont$,发布日期$PubDate,最新发布新闻列表$DtNewest$;

2)设计数据库,可以设置两张表,一张表存放模板,一张用于存放发布新闻的内容

如 模板表:  TempTable   : ID ,classid,TempPath(存放模板的路径);

    新闻表:   NesTable:   ID,ClassID,title,cont,Filepath(发布后存放静态页面的路径),pubdate,author,status;

 

3)添加新闻时,现在记录添加到新闻表中,然后再根据栏目的ID找到该栏目的模板,把模板中的内容读取到一个字符串变量中,并用新闻表中的字段替换模板中的相应标记,然后调用c#中的读写文件的类,写到一个静态文件中如:News.HTml,写成功后再更新数据中静态文件路径filepath;

 

这样一个静态文件就写好了

 

另外本人也从网络上搜集了一些资料,供大家参考(关于新闻内容分页的情况下次叙述)

一、类似的模板

 模板页Text.html代码






$title$


 $author$


$content$



 

二、C#生成静态页类代码|支持列表生成代码

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using zj123.Model;
using System.IO;
using System.Text.RegularExpressions;
using System.Runtime.InteropServices;
using System.Text;
using System.Collections;
namespace WebUI.html
{
    public class EasyHtml
    {
        public bool MakeHtml(string artid)
        {
           
            bool succ = false;
            int len = Convert.ToInt32(Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["titlelength"]) ?? "20");
            //读取数据
            string sql = string.Format("select a.*,b.ClassName,b.Depth,b.OrderBy,b.isTop,b.isList,b.IsLinks,b.Links,b.PicURL,b.ParentID,b.TemplateoutId,b.TemplateinNeiId,b.TemplateinListId from article a,zone b  where a.classid=b.classid and a.Status=3 and a.articleid={0}", artid);
            DataTable dt = DbHelperOleDb.Query(sql).Tables[0];
            if(dt.Rows.Count>0)
            {
            //外模板
                string waitemp = "";
                DataTable waidt  =DbHelperOleDb.Query(string.Format("select * from template where TemplateID={0}",Convert.ToString(dt.Rows[0]["TemplateoutId"]).Trim())).Tables[0];
                if (waidt.Rows.Count > 0)
                {
                    waitemp = Convert.ToString(waidt.Rows[0]["TemplateContent"]);
                }
            //内模板
                string neitemp = "";
                DataTable neidt = DbHelperOleDb.Query(string.Format("select * from template where TemplateID={0}", Convert.ToString(dt.Rows[0]["TemplateinNeiId"]).Trim())).Tables[0];
                if (neidt.Rows.Count > 0)
                {
                    neitemp = Convert.ToString(neidt.Rows[0]["TemplateContent"]);
                }
                //替换模板
                waitemp = waitemp.Replace("$intemplate$", neitemp);
                //替换类型
                string tempclassname = classes.Common.GetP(Convert.ToString(dt.Rows[0]["classid"]));
                waitemp = waitemp.Replace("$ClassName$", tempclassname);
            #region "文章列表"
  
                //最新的文章
                System.Text.StringBuilder sbneartitle = new System.Text.StringBuilder("

");
                DataTable nearTitledt = DbHelperOleDb.Query("select top 10 case when len(title)>" + len + " then substring(title,1," + len + ") else title end as Title,HtmlPath from article where iscreate=1 order by updatetime desc").Tables[0];
                for (int i = 0; i                 {
                    sbneartitle.AppendFormat("
  • {1}
  • ",Convert.ToString(nearTitledt.Rows[i]["HtmlPath"]),Convert.ToString(nearTitledt.Rows[i]["Title"]));
                    }
                    sbneartitle.Append("
    ");
                    waitemp = waitemp.Replace("$NearTitle$", sbneartitle.ToString());
                    sbneartitle.Remove(0,sbneartitle.ToString().Length);
                    if (waitemp.Contains("$OnTopTitle$"))
                    {
                        sbneartitle.Append("
    ");

                        //固定
                        nearTitledt = DbHelperOleDb.Query("select top 10 case when len(title)>" + len + " then substring(title,1," + len + ") else title end as Title,HtmlPath from article where iscreate=1 and OnTop=1 order by updatetime desc").Tables[0];
                        for (int i = 0; i                     {
                        sbneartitle.AppendFormat("

  • {1}
  • ", Convert.ToString(nearTitledt.Rows[i]["HtmlPath"]), Convert.ToString(nearTitledt.Rows[i]["Title"]));
                        }
                        sbneartitle.Remove(0, sbneartitle.ToString().Length);
                        sbneartitle.Append("
    ");
                        waitemp = waitemp.Replace("$OnTopTitle$", sbneartitle.ToString());
                        sbneartitle.Remove(0, sbneartitle.ToString().Length);
                    }
                 
                    if (waitemp.Contains("$HitsTitle$"))
                    {
                        sbneartitle.Append("
    ");
                        //热门
                        nearTitledt = DbHelperOleDb.Query("select top 10 case when len(title)>" + len + " then substring(title,1," + len + ") else title end as Title,HtmlPath from article where iscreate=1 and Hits>1000 order by Hits desc,updatetime desc").Tables[0];
                        for (int i = 0; i                     {
                        sbneartitle.AppendFormat("
  • {1}
  • ", Convert.ToString(nearTitledt.Rows[i]["HtmlPath"]), Convert.ToString(nearTitledt.Rows[i]["Title"]));
                        }
                        sbneartitle.Append("
    ");


                        waitemp = waitemp.Replace("$HitsTitle$", sbneartitle.ToString());
                        sbneartitle.Remove(0, sbneartitle.ToString().Length);
                    }
            
                    if (waitemp.Contains("$Elite$"))
                    {
                        sbneartitle.Append("

    ");
                        //推荐Elite
                        nearTitledt = DbHelperOleDb.Query("select top 10 case when len(title)>" + len + " then substring(title,1," + len + ") else title end as Title,HtmlPath from article where iscreate=1 and Elite=1 order by updatetime desc").Tables[0];
                        for (int i = 0; i                     {
                        sbneartitle.AppendFormat("
  • {1}
  • ", Convert.ToString(nearTitledt.Rows[i]["HtmlPath"]), Convert.ToString(nearTitledt.Rows[i]["Title"]));
                        }

                        sbneartitle.Append("

    ");
                        waitemp = waitemp.Replace("$Elite$", sbneartitle.ToString());

                        sbneartitle.Remove(0, sbneartitle.ToString().Length);
                    }

                
               
                    //相关Classid
                    if (waitemp.Contains("$ClassTitle$"))
                    {
                        sbneartitle.Append("

    ");
                        nearTitledt = DbHelperOleDb.Query("select top 10 case when len(title)>" + len + " then substring(title,1," + len + ") else title end as Title,HtmlPath from article where iscreate=1 and classid=" + Convert.ToString(dt.Rows[0]["classid"]) + " order by updatetime desc").Tables[0];
                        for (int curr = 0; curr                     {
                            sbneartitle.AppendFormat("
  • {1}
  • ", Convert.ToString(nearTitledt.Rows[curr]["HtmlPath"]), Convert.ToString(nearTitledt.Rows[curr]["Title"]));
                        }

                        sbneartitle.Append("

    ");
                        waitemp = waitemp.Replace("$ClassTitle$", sbneartitle.ToString());
                        sbneartitle.Remove(0, sbneartitle.ToString().Length);
                    }

                    //相关Classid
                    if (waitemp.Contains("$LikeTitle$"))
                    {
                        sbneartitle.Append("

    ");
                        DataTable dtlike = zj123.Model.Article.GetLike(artid);
                        for (int likei = 0; likei                     {
                            sbneartitle.AppendFormat("
  • {1}
  • ", Convert.ToString(dtlike.Rows[likei]["HtmlPath"]), Convert.ToString(dtlike.Rows[likei]["Title"]));
                        }
                        sbneartitle.Append("
    ");
                        waitemp = waitemp.Replace("$LikeTitle$", sbneartitle.ToString());
                        sbneartitle.Remove(0, sbneartitle.ToString().Length);
                    }

                        /////////////////////////////////////////////////////////////////////////////////////////////
                #endregion
                        //替换最新的数据
                        for (int j = 0; j                     {
                            if (dt.Columns[j].ColumnName.Trim() == "Title")
                            {
                                string temp1 = "";
                                string temp2 = "";
                                string typefOnt= Convert.ToString(dt.Rows[0]["TitleFontType"]);
                                if (typefOnt== "0")
                                {
                                    temp1 = "";
                                    temp2 = "
    ";
                                }
                                else if (typefOnt== "1")
                                {
                                    temp1 = "";
                                    temp2 = "
    ";
                                }
                                else if (typefOnt== "2")
                                {
                                    temp1 = "";
                                    temp2 = "
    ";
                                }
                                else
                                {

                                }
                                //System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex();
                                //Match match = Regex.Matches();
                                //reg.Replace(waitemp, Convert.ToString(dt.Rows[0][dt.Columns[j].ColumnName.Trim()]), 1, waitemp.IndexOf("$Title$"));
                                string temp11 = waitemp.Substring(0, waitemp.IndexOf("$Title$") + 8);
                                string temp22 = waitemp.Substring(waitemp.IndexOf("$Title$") + 8);
                                temp11 = temp11.Replace("$Title$", Convert.ToString(dt.Rows[0][dt.Columns[j].ColumnName.Trim()])+"---"+Regex.Replace(Regex.Replace(tempclassname,"<[^>]*>",""),"[>|<]*",""));
                                temp22 = temp22.Replace("$Title$", "" + temp1 + Convert.ToString(dt.Rows[0][dt.Columns[j].ColumnName.Trim()]) + temp2 + "");
                                waitemp = temp11 + temp22;
                                temp11 = null;
                                temp22 = null;
                                //waitemp = waitemp.Replace("$" + dt.Columns[j].ColumnName.Trim() + "$", "" +temp1+ Convert.ToString(dt.Rows[0][dt.Columns[j].ColumnName.Trim()]) +temp2+ "");
                            }
                            else if (dt.Columns[j].ColumnName.Trim().ToLower() == "hits")
                            {
                                waitemp = waitemp.Replace("$" + dt.Columns[j].ColumnName.Trim() + "$", Convert.ToInt16(dt.Rows[0][dt.Columns[j].ColumnName.Trim()]) > 1000 ? ("热门") : (""));
                            }
                            else if (dt.Columns[j].ColumnName.Trim().ToLower() == "ontop")
                            {
                                waitemp = waitemp.Replace("$" + dt.Columns[j].ColumnName.Trim() + "$", Convert.ToString(dt.Rows[0][dt.Columns[j].ColumnName.Trim()]).ToLower() == "true" ? ("置顶") : (""));
                            }
                            else if (dt.Columns[j].ColumnName.Trim().ToLower() == "elite")
                            {
                                waitemp = waitemp.Replace("$" + dt.Columns[j].ColumnName.Trim() + "$", Convert.ToString(dt.Rows[0][dt.Columns[j].ColumnName.Trim()]).ToLower().ToString() == "true" ? ("推荐") : (""));
                            }
                            else
                            {
                                waitemp = waitemp.Replace("$" + dt.Columns[j].ColumnName.Trim() + "$", Convert.ToString(dt.Rows[0][dt.Columns[j].ColumnName.Trim()]));
                            }

                        }
                    //替换链表信息
                    //$typejs$
                    waitemp = waitemp.Replace("$typejs$", Convert.ToString(dt.Rows[0]["ClassID"]));
                    //$numjs$
                    waitemp = waitemp.Replace("$numjs$", "10");
                    //$setjs$
                    waitemp = waitemp.Replace("$setjs$","");
                   
                    ///js脚本信息


                   //根据路径生成页面
                    //路径 检查
                    string path = System.Web.HttpContext.Current.Request.PhysicalApplicationPath.Trim()  + Convert.ToString(dt.Rows[0]["Links"]) + "//" + Convert.ToDateTime(dt.Rows[0]["CreateTime"]).ToString("yyyy-MM");
                    if(!Directory.Exists(path))
                      Directory.CreateDirectory(path);
                  string filename = "//"+ Convert.ToString(dt.Rows[0]["ArticleID"]) + ".html";
                    using(StreamWriter sw = new StreamWriter(path+"//"+filename,false,System.Text.Encoding.GetEncoding("gb2312")))
                    {
                        sw.Write(waitemp);
                        sw.Flush();
                        sw.Close();
                    }
                    //修改文章转台
                    try
                    {
                        if (artid == null)
                            return false;
                        int j = int.Parse(artid);
                    }
                    catch
                    {
                        return false;
                    }

                    string sql1 = string.Format("update article set iscreate=1,htmlpath='{0}' where articleid={1}", "/" + Convert.ToString(dt.Rows[0]["Links"]).Replace("////", "/") + "/" + Convert.ToDateTime(dt.Rows[0]["CreateTime"]).ToString("yyyy-MM") + filename, artid);
                    DbHelperOleDb.ExecuteSql(sql1);
                   
                }
                else
                {
                    return false;
                }
          

                return succ;
            }
            ///


            /// 生成列表页
            ///

            ///
            ///
            public bool MakeList(string classid)
            {
                int len = Convert.ToInt32(Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["titlelength"]) ?? "20");
                bool succ = false;
                try
             {        
              int i = int.Parse(classid);

             }
             catch
             {
              
           return false;
             }
                DataTable dt = DbHelperOleDb.Query(string.Format("select a.*,b.ClassName,b.Depth,b.OrderBy,b.isTop,b.isList,b.IsLinks,b.Links,b.PicURL,b.ParentID,b.TemplateoutlistId,b.TemplateoutId,b.TemplateinNeiId,b.TemplateinListId,b.keywords,b.[description] from article a,zone b  where a.classid=b.classid and  iscreate=1 and a.Status=3 and a.classid={0} order by a.UpdateTime desc,OnTop desc,Elite desc,Hits desc", classid)).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    string classpath = HttpContext.Current.Request.PhysicalApplicationPath + @"/" + Convert.ToString(dt.Rows[0]["Links"]).Trim();
                    //读取外模板信息
                    string templatewai = "";
                    DataTable templatewaidt = DbHelperOleDb.Query(string.Format("select * from template where TemplateID={0}", Convert.ToString(dt.Rows[0]["TemplateoutlistId"]))).Tables[0];
                    if (templatewaidt.Rows.Count > 0)
                    {
                        templatewai = Convert.ToString(templatewaidt.Rows[0]["TemplateContent"]);
                    }
                    //根据类型替换标题
                    string tempclassname = classes.Common.GetP(classid);
                    templatewai = templatewai.Replace("$Title$", Convert.ToString(dt.Rows[0]["ClassName"]).Trim() +"--"+Regex.Replace(Regex.Replace(tempclassname,"<[^>]*>",""),"[<|>]*",""));
                    templatewai = templatewai.Replace("$ClassTitleTop$", Convert.ToString(dt.Rows[0]["ClassName"]).Trim());
                    templatewai = templatewai.Replace("$ClassName$", tempclassname);
                    templatewai = templatewai.Replace("$Keyword$", Convert.ToString(dt.Rows[0]["Keywords"]).Trim());
                    templatewai = templatewai.Replace("$Description$", Convert.ToString(dt.Rows[0]["Description"]).Trim());

                    int zOng= dt.Rows.Count;
                    int size = 10;
                    try
                    {
                        size = Convert.ToInt16(System.Configuration.ConfigurationManager.AppSettings["pagesize"]);
                    }
                    catch
                    {

                        size = 10;
                    }
                    int pagecount = zong % size == 0 ? (zong / 10) : (zong / 10 + 1);
                    string listcOntent= "";
                    DataTable dtlist = DbHelperOleDb.Query(string.Format("select * from template where TemplateID={0}", Convert.ToString(dt.Rows[0]["TemplateinListId"]))).Tables[0];
                    if (dtlist.Rows.Count > 0)
                    {
                        listcOntent= Convert.ToString(dtlist.Rows[0]["TemplateContent"]);
                    }
                    //// Match mat = Regex.Match(this.rtbconten.Text.Trim(), "(?.*)", RegexOptions.Multiline | RegexOptions.IgnoreCase);
                    //// MessageBox.Show(mat.Groups["content"].Value);
                    ////(?.*)
                    ////
                    Match mat = Regex.Match(listcontent, "(?.*)(?.*)(?.*)(?.*)",RegexOptions.IgnoreCase|RegexOptions.Multiline);
                    string head = Convert.ToString(mat.Groups["head"]);
                    string body = Convert.ToString(mat.Groups["body"]);
                    string page = Convert.ToString(mat.Groups["page"]);
                    string bottom = Convert.ToString(mat.Groups["bottom"]);
                    //循环生成分页
                    for (int i = 0; i                 {
                        //System.Text.StringBuilder sbneilist = new System.Text.StringBuilder("

                        System.Text.StringBuilder sbneilist = new System.Text.StringBuilder(head);


                        int l = 0;
                        for (int j = (i * size                     {
                            //sbneilist.Append("

    ");

                        }

                        //sbneilist.Append("

    ");
                        sbneilist.Append(page.Replace("¥pages¥", classes.Common.GetPage(i + 1, size, zong)));
                        // sbneilist.Append("
    ");
                            //string temp = listcontent;
                            string temp = body;
                            for (int k = 0; k                         {
                              
                                temp = temp.Replace("$" + dt.Columns[k].ColumnName.Trim() + "$", Convert.ToString(dt.Rows[j][dt.Columns[k].ColumnName.Trim()]));
                            }
                            if ((++l) % 5 == 0)
                            {
                                sbneilist.Append(temp).Append("
    ");
                            }
                            else
                            {
                                sbneilist.Append(temp);
                            }
                          
                            //sbneilist.Append("
    ");
                        sbneilist.Append(bottom);

                        #region "文章列表"

                        //最新的文章
                        System.Text.StringBuilder sbneartitle = new System.Text.StringBuilder("");
                        DataTable nearTitledt = DbHelperOleDb.Query("select top 10 case when len(title)>" + len + " then substring(title,1," + len + ") else title end as Title,HtmlPath from article where iscreate=1 order by updatetime desc").Tables[0];
                        for (int curr = 0; curr                     {
                            sbneartitle.AppendFormat("

  • ·{1}
  • ", Convert.ToString(nearTitledt.Rows[curr]["HtmlPath"]), Convert.ToString(nearTitledt.Rows[curr]["Title"]));
                        }
                        sbneartitle.Append("");
                        templatewai = templatewai.Replace("$NearTitle$", sbneartitle.ToString());
                        sbneartitle.Remove(0, sbneartitle.ToString().Length);
                        sbneartitle.Append("");

                        //固定
                        nearTitledt = DbHelperOleDb.Query("select top 10 case when len(title)>" + len + " then substring(title,1," + len + ") else title end as Title,HtmlPath from article where iscreate=1 and OnTop=1 order by updatetime desc").Tables[0];
                        for (int curr = 0; curr                     {
                            sbneartitle.AppendFormat("

  • ·{1}
  • ", Convert.ToString(nearTitledt.Rows[curr]["HtmlPath"]), Convert.ToString(nearTitledt.Rows[curr]["Title"]));
                        }
                        sbneartitle.Remove(0, sbneartitle.ToString().Length);
                        sbneartitle.Append("");
                        templatewai = templatewai.Replace("$OnTopTitle$", sbneartitle.ToString());
                        sbneartitle.Remove(0, sbneartitle.ToString().Length);
                        sbneartitle.Append("");
                        //热门
                        nearTitledt = DbHelperOleDb.Query("select top 10 case when len(title)>" + len + " then substring(title,1," + len + ") else title end as Title,HtmlPath from article where iscreate=1 and Hits>1000 order by Hits desc,updatetime desc").Tables[0];
                        for (int curr = 0; curr                     {
                            sbneartitle.AppendFormat("
  • ·{1}
  • ", Convert.ToString(nearTitledt.Rows[curr]["HtmlPath"]), Convert.ToString(nearTitledt.Rows[curr]["Title"]));
                        }
                        sbneartitle.Append("");


                        templatewai = templatewai.Replace("$HitsTitle$", sbneartitle.ToString());
                        sbneartitle.Remove(0, sbneartitle.ToString().Length);
                        sbneartitle.Append("");
                        //推荐Elite
                        nearTitledt = DbHelperOleDb.Query("select top 10 case when len(title)>" + len + " then substring(title,1," + len + ") else title end as Title,HtmlPath from article where iscreate=1 and Elite=1 order by updatetime desc").Tables[0];
                        for (int curr = 0; curr                     {
                            sbneartitle.AppendFormat("

  • ·{1}
  • ", Convert.ToString(nearTitledt.Rows[curr]["HtmlPath"]), Convert.ToString(nearTitledt.Rows[curr]["Title"]));
                        }
                        sbneartitle.Remove(0, sbneartitle.ToString().Length);
                        sbneartitle.Append("");
                        templatewai = templatewai.Replace("$Elite$", sbneartitle.ToString());
                        sbneartitle.Append("");
                        //相关Classid
                        nearTitledt = DbHelperOleDb.Query("select top 10 case when len(title)>" + len + " then substring(title,1," + len + ") else title end as Title,HtmlPath from article where iscreate=1 and classid=" + classid + " order by updatetime desc").Tables[0];
                        for (int curr = 0; curr                     {
                            sbneartitle.AppendFormat("
  • ·{1}
  • ", Convert.ToString(nearTitledt.Rows[curr]["HtmlPath"]), Convert.ToString(nearTitledt.Rows[curr]["Title"]));
                        }

                        sbneartitle.Append("");
                        templatewai = templatewai.Replace("$ClassTitle$", sbneartitle.ToString());
                        sbneartitle.Remove(0, sbneartitle.ToString().Length);
                        //sbneartitle.Append("

    ");
                        //DataTable dtlike = zj123.Model.Article.GetLike(artid);
                        //for (int likei = 0; likei                     //{
                        //    sbneartitle.AppendFormat("
  • {1}
  • ", Convert.ToString(dtlike.Rows[likei]["HtmlPath"]), Convert.ToString(dtlike.Rows[likei]["Title"]));
                        //}
                        //sbneartitle.Append("
    ");
                        //waitemp = waitemp.Replace("$LikeTitle$", sbneartitle.ToString());
                        //sbneartitle.Remove(0, sbneartitle.ToString().Length);
                        /////////////////////////////////////////////////////////////////////////////////////////////
                        #endregion
                        //替换链表信息
                        //$typejs$
                        templatewai = templatewai.Replace("$typejs$", classid);
                        //$numjs$
                        templatewai = templatewai.Replace("$numjs$", "10");
                        //$setjs$
                        templatewai = templatewai.Replace("$setjs$", "");
                        string tempzOng= templatewai.Replace("$intemplate$", sbneilist.ToString());
                        string indexshow = (i + 1).ToString() == "1" ? ("") : ((i + 1).ToString());

        

     

        软件开发培训,项目实训,请到华海实训,一流经验,一流的项目实训师,软件工程师成长的摇篮。


    推荐阅读
    • 用阿里云的免费 SSL 证书让网站从 HTTP 换成 HTTPS
      HTTP协议是不加密传输数据的,也就是用户跟你的网站之间传递数据有可能在途中被截获,破解传递的真实内容,所以使用不加密的HTTP的网站是不 ... [详细]
    • Cookie学习小结
      Cookie学习小结 ... [详细]
    • HTTP(HyperTextTransferProtocol)是超文本传输协议的缩写,它用于传送www方式的数据。HTTP协议采用了请求响应模型。客服端向服务器发送一 ... [详细]
    • 为什么多数程序员难以成为架构师?
      探讨80%的程序员为何难以晋升为架构师,涉及技术深度、经验积累和综合能力等方面。本文将详细解析Tomcat的配置和服务组件,帮助读者理解其内部机制。 ... [详细]
    • 本文详细介绍了 Java 网站开发的相关资源和步骤,包括常用网站、开发环境和框架选择。 ... [详细]
    • 本文介绍了 Go 语言中的高性能、可扩展、轻量级 Web 框架 Echo。Echo 框架简单易用,仅需几行代码即可启动一个高性能 HTTP 服务。 ... [详细]
    • 2020年9月15日,Oracle正式发布了最新的JDK 15版本。本次更新带来了许多新特性,包括隐藏类、EdDSA签名算法、模式匹配、记录类、封闭类和文本块等。 ... [详细]
    • 本文详细介绍了Java代码分层的基本概念和常见分层模式,特别是MVC模式。同时探讨了不同项目需求下的分层策略,帮助读者更好地理解和应用Java分层思想。 ... [详细]
    • 基于iSCSI的SQL Server 2012群集测试(一)SQL群集安装
      一、测试需求介绍与准备公司计划服务器迁移过程计划同时上线SQLServer2012,引入SQLServer2012群集提高高可用性,需要对SQLServ ... [详细]
    • javax.mail.search.BodyTerm.matchPart()方法的使用及代码示例 ... [详细]
    • 深入解析HTML5字符集属性:charset与defaultCharset
      本文将详细介绍HTML5中新增的字符集属性charset和defaultCharset,帮助开发者更好地理解和应用这些属性,以确保网页在不同环境下的正确显示。 ... [详细]
    • oracle c3p0 dword 60,web_day10 dbcp c3p0 dbutils
      createdatabasemydbcharactersetutf8;alertdatabasemydbcharactersetutf8;1.自定义连接池为了不去经常创建连接和释放 ... [详细]
    • HTML中span元素为何会脱离li元素对齐?
      在HTML布局中,有时会遇到span元素未能与li元素保持对齐的问题。本文将探讨这一现象的原因,并提供解决方案。 ... [详细]
    • 开机自启动的几种方式
      0x01快速自启动目录快速启动目录自启动方式源于Windows中的一个目录,这个目录一般叫启动或者Startup。位于该目录下的PE文件会在开机后进行自启动 ... [详细]
    • 在JavaWeb开发中,文件上传是一个常见的需求。无论是通过表单还是其他方式上传文件,都必须使用POST请求。前端部分通常采用HTML表单来实现文件选择和提交功能。后端则利用Apache Commons FileUpload库来处理上传的文件,该库提供了强大的文件解析和存储能力,能够高效地处理各种文件类型。此外,为了提高系统的安全性和稳定性,还需要对上传文件的大小、格式等进行严格的校验和限制。 ... [详细]
    author-avatar
    好人langren_840
    这个家伙很懒,什么也没留下!
    PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
    Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有