各位大侠,我是学习j2ee的新手,最新发现我的struts2有一点问题。
我在Action中的Excute()方法里面使用System.out.println("该Action被调用")方法,启动Action后控制台没有打印出任何东西,是不是我的配置有问题呢?启动struts2的必需的包已经放到里面了。
希望各位高手指点一下
我在Action中的Excute()方法里面使用System.out.println("该Action被调用")方法,启动Action后控制台没有打印出任何东西,是不是我的配置有问题呢?启动struts2的必需的包已经放到里面了。
希望各位高手指点一下
解决方案 »
- weblogic启动web工程包java.lang.NoSuchMethodError
- 关于struts2 submit标签中value 该怎么写
- Hibernate 添加oracle本机时间出错。
- s2sh 整合
- hibernate 效率问题 每次打开session会扫描全部表,耗时不少
- 高分求从JavaBean生成castor mapping,有答案就结帖,在线等!!!
- 如何实现动态的创建下拉列表框呢?求解
- 谁能给我段axis1.3下将符合SOAP规范的document转化成SOAP消息的代码啊?
- 如何把JScrollPane的垂直滚动条总是置于最低!
- 南京地区诚招java开发工程师若干名
- ireport报表问题
- 科学工作流引擎的研究与实现
index.jsp
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>测试两种程序结合</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<s:form action="findUrl">
<table width="100%" border="1">
<tr>
<td align="right" width="50%">请输入你需要的商品:</td>
<td align="left" width="50%"><s:textfield name="name" theme="simple"/>
<s:submit value="查询" theme="simple" /></td>
</tr>
</table>
<br>
</s:form>
</body>
</html>findUrlAction.java
import com.opensymphony.xwork2.ActionSupport;
public class findUrlAction extends ActionSupport{
public String excute() throws Exception{
System.out.println("已经执行action");
return SUCCESS;
}}
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<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>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>struts.xml
<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="test" extends="struts-default">
<action name="findUrl" class="findUrlAction">
<result name="success" >suc.jsp</result>
</action>
</package>
</struts>
不可能打不出来的。
就是没调用到那个action
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Genuitec\Common\binary\com.sun.java.jre.win32.x86_1.5.0.011\bin;C:\Tomcat 6.0\bin
2009-12-17 21:46:59 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2009-12-17 21:46:59 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 1270 ms
2009-12-17 21:46:59 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2009-12-17 21:46:59 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.20
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
2009-12-17 21:47:01 org.apache.catalina.core.ApplicationContext log
信息: Loading Spring root WebApplicationContext
2009-12-17 21:47:13 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
信息: Parsing configuration file [struts-default.xml]
2009-12-17 21:47:14 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
信息: Parsing configuration file [struts-plugin.xml]
2009-12-17 21:47:14 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
信息: Parsing configuration file [struts.xml]
2009-12-17 21:47:14 org.apache.struts2.config.Settings getLocale
警告: Settings: Could not parse struts.locale setting, substituting default VM locale
2009-12-17 21:47:15 com.opensymphony.xwork2.util.ObjectTypeDeterminerFactory <clinit>
信息: Setting DefaultObjectTypeDeterminer as default ...
2009-12-17 21:47:15 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2009-12-17 21:47:15 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2009-12-17 21:47:16 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/203 config=null
2009-12-17 21:47:16 org.apache.catalina.startup.Catalina start
信息: Server startup in 17087 ms
2009-12-17 21:47:45 com.opensymphony.xwork2.validator.ActionValidatorManagerFactory <clinit>
信息: Detected AnnotationActionValidatorManager, initializing it...提交表单之后的控制台信息
@Override (重写了 ActionSupport 类中的 execute方法) 注解试一下看看~~ :) 方法名写错了