JSP:页面
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>登陆界面</title>
</head>
<body>
<div>登陆界面</div>
<s:form id="1" name="2" action="loginAction" >
<s:textfield name="username" label="用户名" ></s:textfield>
<s:password name="password" label="密 码"></s:password>
<s:submit label="确认"></s:submit>
<s:reset label="取消"></s:reset>
</s:form>
</body>
</html>
struts.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
"http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<constant name="struts.i18n.encoding" value="UTF-8" />
<package name="myStruts2" extends="struts-default">
<action name="loginAction" class="java.com.coco.LoginAction">
<result name="success">/JSP/success.jsp</result>
<result name="input">/JSP/input.jsp</result>
</action>
</package>
</struts>
action类:
package java.com.coco;
public class LoginAction {
private String username;
private String password;
public String execute() {
return "success";
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
发布完后重启tomcat后:
2013-6-28 12:59:24 org.apache.catalina.core.AprLifecycleListener init
信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.6.0_03\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jdk1.6.0_03/bin/../jre/bin/client;C:/Program Files/Java/jdk1.6.0_03/bin/../jre/bin;C:/Program Files/Java/jdk1.6.0_03/bin/../jre/lib/i386;C:\Program Files\Java\jdk1.6.0_03\bin;C:\Program Files\AMD APP\bin\x86;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\ATI Technologies\ATI.ACE\Core-Static;D:\java\eclipse;
2013-6-28 12:59:24 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2013-6-28 12:59:24 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 272 ms
2013-6-28 12:59:24 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2013-6-28 12:59:24 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.14
2013-6-28 12:59:25 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
信息: Parsing configuration file [struts-default.xml]
2013-6-28 12:59:25 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
信息: Parsing configuration file [struts-plugin.xml]
2013-6-28 12:59:27 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
信息: Parsing configuration file [struts.xml]
2013-6-28 12:59:27 org.apache.struts2.config.Settings getLocale
警告: Settings: Could not parse struts.locale setting, substituting default VM locale
2013-6-28 12:59:27 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter struts2
Action class [java.com.coco.LoginAction] not found - action - file:/D:/java/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/myStruts2/WEB-INF/classes/struts.xml:8:64
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:374)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:329)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:429)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:239)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:152)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:205)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3696)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4343)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2013-6-28 12:59:27 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2013-6-28 12:59:27 org.apache.catalina.core.StandardContext start
严重: Context [/myStruts2] startup failed due to previous errors
2013-6-28 12:59:27 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2013-6-28 12:59:27 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2013-6-28 12:59:27 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/14 config=null
2013-6-28 12:59:27 org.apache.catalina.startup.Catalina start
信息: Server startup in 2713 ms
在D:\java\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\myStruts2\WEB-INF\classes\java\com\coco这个目录下有LoginAction.class文件
本人菜鸟自学Struts2结果刚入门就卡住了,求解脱~~~~
相关推荐
<action name="yourActionName" class="your.ActionClass"> <result name="success">/path/to/your/successPage.jsp <result name="error">/path/to/your/errorPage.jsp ...
通过这种方式,开发者可以快速定位并修复问题,提高开发效率,同时保证代码质量。对于团队协作项目,这样的工具也能帮助团队成员更好地理解和维护他人编写的Action,促进代码的可读性和一致性。 总的来说,这个...
jclasslib bytecode viewer Purpose jclasslib bytecode viewer is a ... The action in the "View menu" can be invoked when a Java, Groovy or Kotlin file is open in the editor. The bytecode will be shown i
解决idea导入jfinal-weixin-demo 无法启动或启动成功404等问题
教义枚举类型 该软件包提供了一个基本实现,用于定义映射到MyCLabs\Enum\Enum对象的学说实体列类型。 该类在出色的包中定义。安装推荐的安装方法是使用 composer require acelaya/...class Action extends Enum{ publi
2. **Class not found**:如果出现找不到Action类的错误,确认Action类的包名和路径是否正确,以及是否已编译并放入类路径。 3. **404 Not Found**:可能是URL不正确或者Web.xml配置有问题。检查Action的命名、...
扫描结果可通过`BroadcastReceiver`监听`ACTION_DISCOVERY_STARTED`和`ACTION_DISCOVERY_FINISHED`广播,以及设备发现的`ACTION_FOUND`广播: ```java IntentFilter filter = new IntentFilter(); filter.addAction...
2. **警告:No configuration found for the specified action: 'sum.action' in namespace: ''** 这个警告通常是因为Struts2找不到指定的Action。如果在JSP中使用 `<s:form action=”sum.action”>`,对应的源文件...
public class ActionSupportextends Objectimplements Action, Validateable, ValidationAware, TextProvider, LocaleProvider, SerializableProvides a default implementation for the most common actions....
针对Action class [userAction] not found - action 和java.lang.NoSuchMethodError: org.springframework.web.context.ConfigurableWebApplicationContext.setId(Ljava/lang/String;)V 两类异常非常有用的解决方法
- **ClassNotFound Exception**:这可能是因为缺少了必要的依赖JAR,或者JAR版本不正确。 - **Struts Action Mapping找不到**:可能是因为struts-config.xml配置错误,Action或ActionMapping没有正确定义。 - **Null...
在Struts2框架下使用`<jsp:forward/>`进行页面跳转时,可能会遇到“404 Not Found”错误,即“no found”的问题。这个错误通常是由于配置不正确或者路径解析不准确导致的。 首先,我们需要理解Struts2的工作原理。...
通过vips-openslideload插件,用户可以充分利用这些特性,快速加载和操作OpenSlide图像,而无需担心内存占用过多或处理速度过慢的问题。 总的来说,vips-openslideload是VIPS库与OpenSlide库之间的桥梁,使得开发者...
在这个例子中,如果`repository.Get(id)`找不到对应的数据,Action会返回一个`NotFound()`结果,而不是null,这有助于提供更明确的错误信息。 总结,ASP.NET Core提供了丰富的Action返回值类型选择,使得开发者可以...
echo 'Controller not found.'; } ``` ### MVC与单一入口的结合 在MVC结构中,单一入口可以与路由机制结合,实现URL与Controller/Action的映射。例如,`/article/view/1` 可以映射到 `ArticleController` 的 `...
10. **JSP标签问题**: 使用Struts2的JSP标签时,可能会遇到`struts tags not found`的错误。确保struts2-jsp-plugin已正确配置,并且JSP页面导入了正确的标签库。 总的来说,理解和解决Struts2错误集合需要对框架有...
在集成过程中可能会遇到各种问题,例如:404错误、ClassNotFound异常等。这些问题通常与配置文件的错误、类路径问题、过滤器配置不当或JAR包缺失有关。当遇到这些问题时,检查web.xml和struts.xml的配置,确保所有...
在Web.xml文件中还可以配置错误页面,以处理常见的HTTP错误码,如404 Not Found、500 Internal Server Error等。例如: ```xml <error-code>404 <location>/common/404.jsp <error-code>500 <location>/...
在本文的实例中,有一个自定义的按钮组件`g-btn`,它绑定了一个`tap`事件,并在事件触发时发送一个`action`事件到外部: ```javascript Component({ methods: { btnTest: function(){ this.triggerEvent('action...
- FIX: The TFlexPanel.FindControlAtPoint method maked virtual to realize RealTime-capability when on mouse cursor moving the flex-object search not occurs. - FIX: After deleting the selected points ...