首页 \ 问答 \ linux下怎么让一个程序自启动 比如编写了简单的HELLO WORLD!程序 怎么才能让这个程序在Linux下开机自启

linux下怎么让一个程序自启动 比如编写了简单的HELLO WORLD!程序 怎么才能让这个程序在Linux下开机自启

比如编写了简单的HELLO WORLD!程序 怎么才能让这个程序在Linux下开机自启动?
更新时间:2023-10-18 06:10

最满意答案

一般有两种注解法

1.直接注在get方法上面,像这种

@RequiredStringValidator(message="Supply password")

public String getPassword() {

return password;
    }

2.注在方法上面,like

@Validations( 
requiredStrings={ 
@RequiredStringValidator(fieldName="username",message="用户名不能为空!"), 
@RequiredStringValidator(fieldName="telNum",message="电话号码不能为空!") 
}, 
regexFields={@RegexFieldValidator(fieldName="telNum",expression="^(\\+86|0|1)\\d{10,11}$", 
message="电话号码格式不正确!")} 
) 

但无论是哪种注解,默认情况下都是对这个action的所有方法进行验证。

如果验证不通过,将跳回result name 为 “input”的视图。错误信息是在 FieldError 里, 当然我们也可以用@InputConfig(resultName=“xxx”),设置验证不通过跳回的视图.

@SkipValidation 如果某个方法不想验证,那么就可以用这个标签了

默认配置下,验证框架是对所有方法都进行了验证,其实我们可以对不需要验证的方法上写了@SkipValidation注解。。但这样又出现了问题,若有两个方法都需要进行验证但参数又不相同,那怎么办呢?那就是开启方法级别的验证啦

其他回答

你好!

...可以啊啊

如有疑问,请追问。

相关问答

更多
  • 使用的是2.1.6版本吧?网上的教程都是早期版本,照样配置不对。 经查API文档,需要加入包struts2-dojo-plugin-2.1.6.jar 试试
  • 一般有两种注解法 1.直接注在get方法上面,像这种 @RequiredStringValidator(message="Supply password") public String getPassword() { return password; } 2.注在方法上面,like @Validations( requiredStrings={ @RequiredStringValidator(fieldName="username",message="用户名不能为空!"), @RequiredString ...
  • 导包 必须导入struts2-convention-plugin-2.3.15.jar包,它在struts2安装包下lib目录中。 @Action来代替元素! String value():指定访问路径; Result[] results():指定局部结果。 @Result来代替元素! String name():指定结果名称; String
  • Struts2注解[2022-10-17]

    @Action(value="/backend/info/commodity/list", results={@Result(name="success",location="/backend/info/commodity/commodity_list.jsp"),@Result(name="error",location="....")}) public String list(){ return SUCCESS; }
  • Struts2 注解问题[2022-10-11]

    @result 注解相当于配置文件里的, dashboard /secure 1) Result组件是 Struts2中用于输出的组件,实际上就是Java代码。name就是 的name属性,针对你的问题1),name="home" 有个 ,2 type="chain" --chain 转发到 home action。
  • 如果你要跳的那个方法在同个action页面里,就用 return this.方法名; 如果不是同个action里,用struts.xml里 /action!doApproval.action 这样就可以了
  • @Controller默认产生的Bean的name就是类(UserAction)的第一个字母小写(userAction)。 当然你也可以自己设定啊,@Controller("uu"),这样就
  • 可以使用codebehind插件,更加方便。什么叫做使用注释来执行自定义方法? JSP应该写成Test!add.action或者Test!delete.action
  • 你的假设是正确的,当添加一个字段错误时,它会默认返回“INPUT”结果,导致输入结果被渲染。 我会建议寻找实施可预备的,这将允许您始终在页面呈现之前填充组合框。 Your assumption is correct, when a field error is added, it will by default return the "INPUT" result, causing the input result to be rendered. I would suggest looking into im ...
  • Struts2通过Java,XML或Annotations提供了服务器端验证的绝佳选择...... 顺便说一句,如果你真的只想执行客户端验证, 好的, 你可以在JSP中放入你在任何非struts JSP或HTML中使用的相同javascript库... 只需导入它们并开始使用它们。 Struts2 offers a great choice for server-side validation, through Java, XML or Annotations... by the way, if you r ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)