码农小汪-struts2学习2-Structs2简单使用流程

2024-08-21 01:08

本文主要是介绍码农小汪-struts2学习2-Structs2简单使用流程,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

从第一篇,我们简单的指导了,整个大致的流程之后我们可以创建使用一个简单的步骤需要知道涩。虽然现在的编译器已经给了我们足够好的支持,但是还是需要知道的涩。


structs2 简单的创建步骤

  1. 安装 Struts2的入口的配置文件,这个过滤器,让我们的整个框架在web上工作
filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping><filter-name>struts2</filter-name><url-pattern>/*</url-pattern>
</filter-mapping>
  1. 编写Action类而Struts2.x 的动作类需要从 com.opensymphony.xwork2.ActionSupport 类继承,然后需要重写他的方法execute,其实在接下来的过程中,我们会知道, 这个方法是默认执行的方法可以设置的,这里返回的字符串,就要去配置文件中寻找,得到一一对应的结果啦。小伙子慢慢来不要着急
public String execute() throws Exception
默认执行的,可以通过method进行设置
  1. 配置 Action 类,就是上面我们执行返回的结果,就是需要从这里获取哦,非常的重要,这里面可以配置很多的东西,比如拦截器,返回的是Json字符串,还有其他的一些。相应的根据ActionInvocation进行调用和执行哦
<package name="struts2" namespace="/"extends="struts-default"><action name="sum" class="action.FirstAction"><result name="positive">/positive.jsp</result><result name="negative">/negative.jsp</result></action></package>

在标签中可以有多个,第一个可以指定一个 Servlet 访问路径(不包括动作名),如“/test”。 extends 属性继承一个默认的配置文件“ struts-default”,一般都继承于它,就是处理的拦截器。默认进行过滤处理,如果自定义拦截器,之后最后要引用
struct 栈 。
标签中的 name 属性表示动作名, class 表示动作类名。
标签的 name 实际上就是 execute 方法返回的字符串,如果返回的是“ positive”,就跳转到positive.jsp 页面,如果是“ negative”,就跳转到 negative.jsp 页面。
在中可以有多个,在中可以有多个。

<struts><bean class="com.opensymphony.xwork2.ObjectFactory" name="struts"/><bean type="com.opensymphony.xwork2.factory.ResultFactory" name="struts" class="org.apache.struts2.factory.StrutsResultFactory" /><bean type="com.opensymphony.xwork2.factory.ActionFactory" name="struts" class="com.opensymphony.xwork2.factory.DefaultActionFactory" /><bean type="com.opensymphony.xwork2.factory.ConverterFactory" name="struts" class="com.opensymphony.xwork2.factory.DefaultConverterFactory" /><bean type="com.opensymphony.xwork2.factory.InterceptorFactory" name="struts" class="com.opensymphony.xwork2.factory.DefaultInterceptorFactory" /><bean type="com.opensymphony.xwork2.factory.ValidatorFactory" name="struts" class="com.opensymphony.xwork2.factory.DefaultValidatorFactory" /><bean type="com.opensymphony.xwork2.FileManager" class="com.opensymphony.xwork2.util.fs.DefaultFileManager" name="system" scope="singleton"/><bean type="com.opensymphony.xwork2.FileManagerFactory" class="com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory" name="struts" scope="singleton"/><bean type="com.opensymphony.xwork2.ActionProxyFactory" name="struts" class="org.apache.struts2.impl.StrutsActionProxyFactory"/><bean type="com.opensymphony.xwork2.ActionProxyFactory" name="prefix" class="org.apache.struts2.impl.PrefixBasedActionProxyFactory"/><bean type="com.opensymphony.xwork2.conversion.ObjectTypeDeterminer" name="struts" class="com.opensymphony.xwork2.conversion.impl.DefaultObjectTypeDeterminer"/><bean type="com.opensymphony.xwork2.util.PatternMatcher" name="struts" class="com.opensymphony.xwork2.util.WildcardHelper" /><bean type="com.opensymphony.xwork2.util.PatternMatcher" name="namedVariable" class="com.opensymphony.xwork2.util.NamedVariablePatternMatcher"/><bean type="com.opensymphony.xwork2.util.PatternMatcher" name="regex" class="org.apache.struts2.util.RegexPatternMatcher"/><bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="struts" class="org.apache.struts2.dispatcher.mapper.DefaultActionMapper" /><bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="composite" class="org.apache.struts2.dispatcher.mapper.CompositeActionMapper" /><bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="restful" class="org.apache.struts2.dispatcher.mapper.RestfulActionMapper" /><bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="restful2" class="org.apache.struts2.dispatcher.mapper.Restful2ActionMapper" /><bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest" name="jakarta" class="org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest" scope="default"/><bean type="org.apache.struts2.views.TagLibraryDirectiveProvider" name="s" class="org.apache.struts2.views.DefaultTagLibrary" /><bean type="org.apache.struts2.views.TagLibraryModelProvider" name="s" class="org.apache.struts2.views.DefaultTagLibrary" /><bean class="org.apache.struts2.views.freemarker.FreemarkerThemeTemplateLoader" /><bean class="org.apache.struts2.views.freemarker.FreemarkerManager" name="struts" /><bean class="org.apache.struts2.views.velocity.VelocityManager" name="struts" optional="true" /><bean class="org.apache.struts2.components.template.TemplateEngineManager" /><bean type="org.apache.struts2.components.template.TemplateEngine" name="ftl" class="org.apache.struts2.components.template.FreemarkerTemplateEngine" /><bean type="org.apache.struts2.components.template.TemplateEngine" name="vm" class="org.apache.struts2.components.template.VelocityTemplateEngine" /><bean type="org.apache.struts2.components.template.TemplateEngine" name="jsp" class="org.apache.struts2.components.template.JspTemplateEngine" /><bean type="com.opensymphony.xwork2.conversion.impl.XWorkConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.XWorkConverter" /><bean type="com.opensymphony.xwork2.conversion.ConversionPropertiesProcessor" name="struts" class="com.opensymphony.xwork2.conversion.impl.DefaultConversionPropertiesProcessor" /><bean type="com.opensymphony.xwork2.conversion.ConversionFileProcessor" name="struts" class="com.opensymphony.xwork2.conversion.impl.DefaultConversionFileProcessor" /><bean type="com.opensymphony.xwork2.conversion.ConversionAnnotationProcessor" name="struts" class="com.opensymphony.xwork2.conversion.impl.DefaultConversionAnnotationProcessor" /><bean type="com.opensymphony.xwork2.conversion.TypeConverterCreator" name="struts" class="com.opensymphony.xwork2.conversion.impl.DefaultTypeConverterCreator" /><bean type="com.opensymphony.xwork2.conversion.TypeConverterHolder" name="struts" class="com.opensymphony.xwork2.conversion.impl.DefaultTypeConverterHolder" /><bean class="com.opensymphony.xwork2.conversion.impl.XWorkBasicConverter" /><bean type="com.opensymphony.xwork2.conversion.impl.CollectionConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.CollectionConverter" scope="singleton"/><bean type="com.opensymphony.xwork2.conversion.impl.ArrayConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.ArrayConverter" scope="singleton"/><bean type="com.opensymphony.xwork2.conversion.impl.DateConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.DateConverter" scope="singleton"/><bean type="com.opensymphony.xwork2.conversion.impl.NumberConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.NumberConverter" scope="singleton"/><bean type="com.opensymphony.xwork2.conversion.impl.StringConverter" name="struts" class="com.opensymphony.xwork2.conversion.impl.StringConverter" scope="singleton"/><bean type="com.opensymphony.xwork2.TextProvider" name="struts" class="com.opensymphony.xwork2.TextProviderSupport" scope="default" /><bean type="com.opensymphony.xwork2.LocaleProvider" name="struts" class="com.opensymphony.xwork2.DefaultLocaleProvider" scope="singleton" /><bean type="org.apache.struts2.components.UrlRenderer" name="struts" class="org.apache.struts2.components.ServletUrlRenderer"/><bean type="org.apache.struts2.views.util.UrlHelper" name="struts" class="org.apache.struts2.views.util.DefaultUrlHelper"/><bean type="com.opensymphony.xwork2.util.ValueStackFactory" name="struts" class="com.opensymphony.xwork2.ognl.OgnlValueStackFactory" /><bean type="com.opensymphony.xwork2.util.reflection.ReflectionProvider" name="struts" class="com.opensymphony.xwork2.ognl.OgnlReflectionProvider" /><bean type="com.opensymphony.xwork2.util.reflection.ReflectionContextFactory" name="struts" class="com.opensymphony.xwork2.ognl.OgnlReflectionContextFactory" /><bean type="com.opensymphony.xwork2.TextProvider" name="system" class="com.opensymphony.xwork2.DefaultTextProvider" /><bean type="com.opensymphony.xwork2.conversion.NullHandler" name="java.lang.Object" class="com.opensymphony.xwork2.conversion.impl.InstantiatingNullHandler" /><bean type="com.opensymphony.xwork2.validator.ActionValidatorManager" name="struts" class="com.opensymphony.xwork2.validator.AnnotationActionValidatorManager" /><bean type="com.opensymphony.xwork2.validator.ActionValidatorManager" name="no-annotations" class="com.opensymphony.xwork2.validator.DefaultActionValidatorManager" /><bean type="com.opensymphony.xwork2.validator.ValidatorFactory" class="com.opensymphony.xwork2.validator.DefaultValidatorFactory"/><bean type="com.opensymphony.xwork2.validator.ValidatorFileParser" class="com.opensymphony.xwork2.validator.DefaultValidatorFileParser" /><bean class="com.opensymphony.xwork2.ognl.OgnlUtil" /><bean type="com.opensymphony.xwork2.util.TextParser" name="struts" class="com.opensymphony.xwork2.util.OgnlTextParser" scope="singleton"/><bean type="ognl.PropertyAccessor" name="com.opensymphony.xwork2.util.CompoundRoot" class="com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor" /><bean type="ognl.PropertyAccessor" name="java.lang.Object" class="com.opensymphony.xwork2.ognl.accessor.ObjectAccessor" /><bean type="ognl.PropertyAccessor" name="java.util.Iterator" class="com.opensymphony.xwork2.ognl.accessor.XWorkIteratorPropertyAccessor" /><bean type="ognl.PropertyAccessor" name="java.util.Enumeration" class="com.opensymphony.xwork2.ognl.accessor.XWorkEnumerationAccessor" /><bean type="ognl.PropertyAccessor" name="java.util.List" class="com.opensymphony.xwork2.ognl.accessor.XWorkListPropertyAccessor" /><bean type="ognl.PropertyAccessor" name="java.util.Set" class="com.opensymphony.xwork2.ognl.accessor.XWorkCollectionPropertyAccessor" /><bean type="ognl.PropertyAccessor" name="java.util.Map" class="com.opensymphony.xwork2.ognl.accessor.XWorkMapPropertyAccessor" /><bean type="ognl.PropertyAccessor" name="java.util.Collection" class="com.opensymphony.xwork2.ognl.accessor.XWorkCollectionPropertyAccessor" /><bean type="ognl.PropertyAccessor" name="com.opensymphony.xwork2.ognl.ObjectProxy" class="com.opensymphony.xwork2.ognl.accessor.ObjectProxyPropertyAccessor" /><bean type="ognl.MethodAccessor" name="java.lang.Object" class="com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor" /><bean type="ognl.MethodAccessor" name="com.opensymphony.xwork2.util.CompoundRoot" class="com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor" /><bean class="org.apache.struts2.views.jsp.ui.OgnlTool" /><bean type="org.apache.struts2.dispatcher.StaticContentLoader" class="org.apache.struts2.dispatcher.DefaultStaticContentLoader" name="struts" /><bean type="com.opensymphony.xwork2.UnknownHandlerManager" class="com.opensymphony.xwork2.DefaultUnknownHandlerManager" name="struts" /><!--  Silly workarounds for OGNL since there is currently no way to flush its internal caches --><bean type="ognl.PropertyAccessor" name="java.util.ArrayList" class="com.opensymphony.xwork2.ognl.accessor.XWorkListPropertyAccessor" /><bean type="ognl.PropertyAccessor" name="java.util.HashSet" class="com.opensymphony.xwork2.ognl.accessor.XWorkCollectionPropertyAccessor" /><bean type="ognl.PropertyAccessor" name="java.util.HashMap" class="com.opensymphony.xwork2.ognl.accessor.XWorkMapPropertyAccessor" /><package name="struts-default" abstract="true"><result-types><result-type name="chain" class="com.opensymphony.xwork2.ActionChainResult"/><result-type name="dispatcher" class="org.apache.struts2.dispatcher.ServletDispatcherResult" default="true"/><result-type name="freemarker" class="org.apache.struts2.views.freemarker.FreemarkerResult"/><result-type name="httpheader" class="org.apache.struts2.dispatcher.HttpHeaderResult"/><result-type name="redirect" class="org.apache.struts2.dispatcher.ServletRedirectResult"/><result-type name="redirectAction" class="org.apache.struts2.dispatcher.ServletActionRedirectResult"/><result-type name="stream" class="org.apache.struts2.dispatcher.StreamResult"/><result-type name="velocity" class="org.apache.struts2.dispatcher.VelocityResult"/><result-type name="xslt" class="org.apache.struts2.views.xslt.XSLTResult"/><result-type name="plainText" class="org.apache.struts2.dispatcher.PlainTextResult" /><result-type name="postback" class="org.apache.struts2.dispatcher.PostbackResult" /></result-types><interceptors><interceptor name="alias" class="com.opensymphony.xwork2.interceptor.AliasInterceptor"/><interceptor name="autowiring" class="com.opensymphony.xwork2.spring.interceptor.ActionAutowiringInterceptor"/><interceptor name="chain" class="com.opensymphony.xwork2.interceptor.ChainingInterceptor"/><interceptor name="conversionError" class="org.apache.struts2.interceptor.StrutsConversionErrorInterceptor"/><interceptor name="cookie" class="org.apache.struts2.interceptor.CookieInterceptor"/><interceptor name="cookieProvider" class="org.apache.struts2.interceptor.CookieProviderInterceptor"/><interceptor name="clearSession" class="org.apache.struts2.interceptor.ClearSessionInterceptor" /><interceptor name="createSession" class="org.apache.struts2.interceptor.CreateSessionInterceptor" /><interceptor name="debugging" class="org.apache.struts2.interceptor.debugging.DebuggingInterceptor" /><interceptor name="execAndWait" class="org.apache.struts2.interceptor.ExecuteAndWaitInterceptor"/><interceptor name="exception" class="com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor"/><interceptor name="fileUpload" class="org.apache.struts2.interceptor.FileUploadInterceptor"/><interceptor name="i18n" class="com.opensymphony.xwork2.interceptor.I18nInterceptor"/><interceptor name="logger" class="com.opensymphony.xwork2.interceptor.LoggingInterceptor"/><interceptor name="modelDriven" class="com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor"/><interceptor name="scopedModelDriven" class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor"/><interceptor name="params" class="com.opensymphony.xwork2.interceptor.ParametersInterceptor"/><interceptor name="actionMappingParams" class="org.apache.struts2.interceptor.ActionMappingParametersInteceptor"/><interceptor name="prepare" class="com.opensymphony.xwork2.interceptor.PrepareInterceptor"/><interceptor name="staticParams" class="com.opensymphony.xwork2.interceptor.StaticParametersInterceptor"/><interceptor name="scope" class="org.apache.struts2.interceptor.ScopeInterceptor"/><interceptor name="servletConfig" class="org.apache.struts2.interceptor.ServletConfigInterceptor"/><interceptor name="timer" class="com.opensymphony.xwork2.interceptor.TimerInterceptor"/><interceptor name="token" class="org.apache.struts2.interceptor.TokenInterceptor"/><interceptor name="tokenSession" class="org.apache.struts2.interceptor.TokenSessionStoreInterceptor"/><interceptor name="validation" class="org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor"/><interceptor name="workflow" class="com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor"/><interceptor name="store" class="org.apache.struts2.interceptor.MessageStoreInterceptor" /><interceptor name="checkbox" class="org.apache.struts2.interceptor.CheckboxInterceptor" /><interceptor name="profiling" class="org.apache.struts2.interceptor.ProfilingActivationInterceptor" /><interceptor name="roles" class="org.apache.struts2.interceptor.RolesInterceptor" /><interceptor name="annotationWorkflow" class="com.opensymphony.xwork2.interceptor.annotations.AnnotationWorkflowInterceptor" /><interceptor name="multiselect" class="org.apache.struts2.interceptor.MultiselectInterceptor" /><interceptor name="deprecation" class="org.apache.struts2.interceptor.DeprecationInterceptor" /><!-- Basic stack --><interceptor-stack name="basicStack"><interceptor-ref name="exception"/><interceptor-ref name="servletConfig"/><interceptor-ref name="prepare"/><interceptor-ref name="checkbox"/><interceptor-ref name="multiselect"/><interceptor-ref name="actionMappingParams"/><interceptor-ref name="params"><param name="excludeParams">dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,parameters\...*</param></interceptor-ref><interceptor-ref name="conversionError"/><interceptor-ref name="deprecation"/></interceptor-stack><!-- Sample validation and workflow stack --><interceptor-stack name="validationWorkflowStack"><interceptor-ref name="basicStack"/><interceptor-ref name="validation"/><interceptor-ref name="workflow"/></interceptor-stack><!-- Sample file upload stack --><interceptor-stack name="fileUploadStack"><interceptor-ref name="fileUpload"/><interceptor-ref name="basicStack"/></interceptor-stack><!-- Sample model-driven stack  --><interceptor-stack name="modelDrivenStack"><interceptor-ref name="modelDriven"/><interceptor-ref name="basicStack"/></interceptor-stack><!-- Sample action chaining stack --><interceptor-stack name="chainStack"><interceptor-ref name="chain"/><interceptor-ref name="basicStack"/></interceptor-stack><!-- Sample i18n stack --><interceptor-stack name="i18nStack"><interceptor-ref name="i18n"/><interceptor-ref name="basicStack"/></interceptor-stack><!-- An example of the paramsPrepareParams trick. This stackis exactly the same as the defaultStack, except that itincludes one extra interceptor before the prepare interceptor:the params interceptor.This is useful for when you wish to apply parameters directlyto an object that you wish to load externally (such as a DAOor database or service layer), but can't load that objectuntil at least the ID parameter has been loaded. By loadingthe parameters twice, you can retrieve the object in theprepare() method, allowing the second params interceptor toapply the values on the object. --><interceptor-stack name="paramsPrepareParamsStack"><interceptor-ref name="exception"/><interceptor-ref name="alias"/><interceptor-ref name="i18n"/><interceptor-ref name="checkbox"/><interceptor-ref name="multiselect"/><interceptor-ref name="params"><param name="excludeParams">^dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,^parameters\..*,^action:.*,^method:.*</param></interceptor-ref><interceptor-ref name="servletConfig"/><interceptor-ref name="prepare"/><interceptor-ref name="chain"/><interceptor-ref name="modelDriven"/><interceptor-ref name="fileUpload"/><interceptor-ref name="staticParams"/><interceptor-ref name="actionMappingParams"/><interceptor-ref name="params"><param name="excludeParams">^dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,^parameters\..*,^action:.*,^method:.*</param></interceptor-ref><interceptor-ref name="conversionError"/><interceptor-ref name="validation"><param name="excludeMethods">input,back,cancel,browse</param></interceptor-ref><interceptor-ref name="workflow"><param name="excludeMethods">input,back,cancel,browse</param></interceptor-ref></interceptor-stack><!-- A complete stack with all the common interceptors in place.Generally, this stack should be the one you use, though itmay do more than you need. Also, the ordering can beswitched around (ex: if you wish to have your servlet-relatedobjects applied before prepare() is called, you'd need to moveservletConfig interceptor up.This stack also excludes from the normal validation and workflowthe method names input, back, and cancel. These typically areassociated with requests that should not be validated.--><interceptor-stack name="defaultStack"><interceptor-ref name="exception"/><interceptor-ref name="alias"/><interceptor-ref name="servletConfig"/><interceptor-ref name="i18n"/><interceptor-ref name="prepare"/><interceptor-ref name="chain"/><interceptor-ref name="scopedModelDriven"/><interceptor-ref name="modelDriven"/><interceptor-ref name="fileUpload"/><interceptor-ref name="checkbox"/><interceptor-ref name="multiselect"/><interceptor-ref name="staticParams"/><interceptor-ref name="actionMappingParams"/><interceptor-ref name="params"><param name="excludeParams">^dojo\..*,^struts\..*,^session\..*,^request\..*,^application\..*,^servlet(Request|Response)\..*,^parameters\..*,^action:.*,^method:.*</param></interceptor-ref><interceptor-ref name="conversionError"/><interceptor-ref name="validation"><param name="excludeMethods">input,back,cancel,browse</param></interceptor-ref><interceptor-ref name="workflow"><param name="excludeMethods">input,back,cancel,browse</param></interceptor-ref><interceptor-ref name="debugging"/><interceptor-ref name="deprecation"/></interceptor-stack><!-- The completeStack is here for backwards compatibility forapplications that still refer to the defaultStack by theold name --><interceptor-stack name="completeStack"><interceptor-ref name="defaultStack"/></interceptor-stack><!-- Sample execute and wait stack.Note: execAndWait should always be the *last* interceptor. --><interceptor-stack name="executeAndWaitStack"><interceptor-ref name="execAndWait"><param name="excludeMethods">input,back,cancel</param></interceptor-ref><interceptor-ref name="defaultStack"/><interceptor-ref name="execAndWait"><param name="excludeMethods">input,back,cancel</param></interceptor-ref></interceptor-stack></interceptors><default-interceptor-ref name="defaultStack"/><default-class-ref class="com.opensymphony.xwork2.ActionSupport" /></package></struts>

如果你仔细的看看的话其实就会发现,他的拦截器就在那个default里面的,这里面在我们的自定义拦截器的时候,很多地方都是非常的有用的,在我们安装包的目录下的,慢慢的就好发现的,找不到百度就好了!

这个简单的方式就创建好了我们的第一个struct2的流程,其实还是可以慢慢的体会整个过程。

这篇关于码农小汪-struts2学习2-Structs2简单使用流程的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1091688

相关文章

HarmonyOS学习(七)——UI(五)常用布局总结

自适应布局 1.1、线性布局(LinearLayout) 通过线性容器Row和Column实现线性布局。Column容器内的子组件按照垂直方向排列,Row组件中的子组件按照水平方向排列。 属性说明space通过space参数设置主轴上子组件的间距,达到各子组件在排列上的等间距效果alignItems设置子组件在交叉轴上的对齐方式,且在各类尺寸屏幕上表现一致,其中交叉轴为垂直时,取值为Vert

Ilya-AI分享的他在OpenAI学习到的15个提示工程技巧

Ilya(不是本人,claude AI)在社交媒体上分享了他在OpenAI学习到的15个Prompt撰写技巧。 以下是详细的内容: 提示精确化:在编写提示时,力求表达清晰准确。清楚地阐述任务需求和概念定义至关重要。例:不用"分析文本",而用"判断这段话的情感倾向:积极、消极还是中性"。 快速迭代:善于快速连续调整提示。熟练的提示工程师能够灵活地进行多轮优化。例:从"总结文章"到"用

Security OAuth2 单点登录流程

单点登录(英语:Single sign-on,缩写为 SSO),又译为单一签入,一种对于许多相互关连,但是又是各自独立的软件系统,提供访问控制的属性。当拥有这项属性时,当用户登录时,就可以获取所有系统的访问权限,不用对每个单一系统都逐一登录。这项功能通常是以轻型目录访问协议(LDAP)来实现,在服务器上会将用户信息存储到LDAP数据库中。相同的,单一注销(single sign-off)就是指

Spring Security基于数据库验证流程详解

Spring Security 校验流程图 相关解释说明(认真看哦) AbstractAuthenticationProcessingFilter 抽象类 /*** 调用 #requiresAuthentication(HttpServletRequest, HttpServletResponse) 决定是否需要进行验证操作。* 如果需要验证,则会调用 #attemptAuthentica

中文分词jieba库的使用与实景应用(一)

知识星球:https://articles.zsxq.com/id_fxvgc803qmr2.html 目录 一.定义: 精确模式(默认模式): 全模式: 搜索引擎模式: paddle 模式(基于深度学习的分词模式): 二 自定义词典 三.文本解析   调整词出现的频率 四. 关键词提取 A. 基于TF-IDF算法的关键词提取 B. 基于TextRank算法的关键词提取

使用SecondaryNameNode恢复NameNode的数据

1)需求: NameNode进程挂了并且存储的数据也丢失了,如何恢复NameNode 此种方式恢复的数据可能存在小部分数据的丢失。 2)故障模拟 (1)kill -9 NameNode进程 [lytfly@hadoop102 current]$ kill -9 19886 (2)删除NameNode存储的数据(/opt/module/hadoop-3.1.4/data/tmp/dfs/na

Hadoop数据压缩使用介绍

一、压缩原则 (1)运算密集型的Job,少用压缩 (2)IO密集型的Job,多用压缩 二、压缩算法比较 三、压缩位置选择 四、压缩参数配置 1)为了支持多种压缩/解压缩算法,Hadoop引入了编码/解码器 2)要在Hadoop中启用压缩,可以配置如下参数

【前端学习】AntV G6-08 深入图形与图形分组、自定义节点、节点动画(下)

【课程链接】 AntV G6:深入图形与图形分组、自定义节点、节点动画(下)_哔哩哔哩_bilibili 本章十吾老师讲解了一个复杂的自定义节点中,应该怎样去计算和绘制图形,如何给一个图形制作不间断的动画,以及在鼠标事件之后产生动画。(有点难,需要好好理解) <!DOCTYPE html><html><head><meta charset="UTF-8"><title>06

Makefile简明使用教程

文章目录 规则makefile文件的基本语法:加在命令前的特殊符号:.PHONY伪目标: Makefilev1 直观写法v2 加上中间过程v3 伪目标v4 变量 make 选项-f-n-C Make 是一种流行的构建工具,常用于将源代码转换成可执行文件或者其他形式的输出文件(如库文件、文档等)。Make 可以自动化地执行编译、链接等一系列操作。 规则 makefile文件

学习hash总结

2014/1/29/   最近刚开始学hash,名字很陌生,但是hash的思想却很熟悉,以前早就做过此类的题,但是不知道这就是hash思想而已,说白了hash就是一个映射,往往灵活利用数组的下标来实现算法,hash的作用:1、判重;2、统计次数;