Tag: struts2 namespace

命名空间/动作名称hello没有映射的Action

package com.tutorialspoint.struts2; public class HelloWorldAction{ private String name; public String execute() throws Exception { return “success”; } public String getName() { return name; } public void setName(String name) { this.name = name; } } 的index.jsp Hello World Hello World From Struts2 Please enter your name 在struts.xml /HelloWorld.jsp web.xml中 Struts 2 index.jsp struts2 org.apache.struts2.dispatcher.FilterDispatcher struts2 /* […]

HTTP状态404 – 没有映射名称空间的动作和与上下文路径相关联的动作名称

我已经学习了Struts2的理论,现在正在练习。 在执行项目时遇到问题。我在谷歌搜索的方式很多,但找不到结果。请帮帮我。 下面是代码。请帮助我的朋友们…… 项目结构: web.xml中 struts2 struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts2 /* login.jsp 在struts.xml pages/homepage.jsp pages/login.jsp LoginAction.java package com.practice.structs.actions; import com.opensymphony.xwork2.ActionSupport; public class LoginAction extends ActionSupport { private String userName; private String password; public String validateUser(){ if(this.userName.equalsIgnoreCase(“abc”) && this.password.equalsIgnoreCase(“abc”)) { return “success”; }else{ addActionError(getText(“error.login”)); return “error”; } } /** * @return the userName */ public String getUserName() […]

如何比较Struts 2中url请求参数中的单个字符

我正在读取具有单个字符的url参数。 它将是Y或N 我必须写一个条件来检查它是Y还是N并做相应的事情。 这是我写的,但似乎没有用(总是去其他)。 url是 http://wwww.helloworld.com/showInfo?thecountry=us&theconditionTypeInUrl=Y 我也试过了 struts.xml包含 dis.Info dis.noInfo

Struts2 URL无法访问

我真的很喜欢Struts2 – 我可以通过省略部分路径来访问JSP页面。 注意路径假设包含pages/welcome_user.jsp 。 关键是要查看路径中的单词pages 。 这是struts.xml文件: pages/login.jsp pages/welcome_user.jsp 我可以通过以下方式访问login.jsp : http://localhost/Struts2Example/User/Login 和welcome_user.jsp通过: http://localhost/Struts2Example/User/Welcome 请注意,在这两个URL中,我都可以删除pages ,为什么? 来源: http : //www.mkyong.com/misc/how-to-use-mkyong-tutorial/ 有人可以通过上面的教程告诉我有什么问题吗?