------ Solution ------- -------------------------------------
configuration file header information is not
应该是
<?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">
你的是
<!DOCTYPE truts PUBLIC
少了一个s
------ Solution ------------------------------------- -------
addition to your namespace = "/ hello".
your form in the form of action can not be hello bar. You can change the namespace = "/", or action = "hello.hello"
------ Solution ------------------- -------------------------
if namespace = "/" then hello.action
--- --- Solution --------------------------------------------
Since you changed over to the namespace "/" , then the form of the action = "hello.action" a .
------ For reference only ------------- --------------------------
are you seeing this
------ For reference only ---------------------------------------
strong ah Oh this I changed over , 3L proposal also heard , but still the same error amount , why ah
------ For reference only - -------------------------------------
Here I have changed, but still the same error ah
------ For reference only ---------------------- -----------------
I paste the code in order to facilitate it
package com;
public class HelloAction {
private String message;
public String getMessage()
{
return message;
}
public void setMessage(String message)
{
this.message=message;
}
public String execute()
{
System.out.println("............");
if((this.message.equals(""))||(this.message==null))
{
message="请输入问候语";
}
return "success";
}
}
<?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="com" extends="struts-default" namespace="/" >
<action name="hello" class="com.HelloAction">
<result name="success">/hello.jsp</result>
</action>
</package>
</struts>
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
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_3_0.xsd">
<display-name></display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2Filter</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>问候程序</title>
</head>
<body>
<s:property value="message"/>
<s:form action="hello">
<s:textfield name="message" label="问候语 " value=""/>
<br>
<s:submit value="提交"/>
</s:form>
</body>
</html>
error code :2013-3-14 13:59:17 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
serious : Exception occurred during processing request: null
java.lang.NullPointerException
at org.apache.struts2.impl.StrutsActionProxy.getErrorMessage (StrutsActionProxy.java: 69)
at com.opensymphony.xwork2.DefaultActionProxy.prepare (DefaultActionProxy.java: 185)
at org.apache.struts2.impl.StrutsActionProxy.prepare (StrutsActionProxy.java: 63)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy (StrutsActionProxyFactory.java: 39)
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy (DefaultActionProxyFactory.java: 58)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction (Dispatcher.java: 534)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter (FilterDispatcher.java: 434)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (ApplicationFilterChain.java: 235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter (ApplicationFilterChain.java: 206)
at org.apache.catalina.core.StandardWrapperValve.invoke (StandardWrapperValve.java: 233)
at org.apache.catalina.core.StandardContextValve.invoke (StandardContextValve.java: 191)
at org.apache.catalina.core.StandardHostValve.invoke (StandardHostValve.java: 127)
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java: 102)
at org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java: 109)
at org.apache.catalina.connector.CoyoteAdapter.service (CoyoteAdapter.java: 298)
at org.apache.coyote.http11.Http11Processor.process (Http11Processor.java: 859)
at org.apache.coyote.http11.Http11Protocol $ Http11ConnectionHandler.process (Http11Protocol.java: 588)
at org.apache.tomcat.util.net.JIoEndpoint $ Worker.run (JIoEndpoint.java: 489)
at java.lang.Thread.run (Thread.java: 619)
------ For reference only ---------------------------------- -----
+1
------ For reference only ----------------------- ----------------
put it into hello.action eh ? ?
------ For reference only -------------------------------------- -
I get is based on your approach and then you see a warning message is the same mistake ah
2013-3-14 20:21:56 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING : No configuration found for the specified action: 'hello.action' in namespace:.'' Form action defaulting to 'action' attribute's literal value.
2013-3-14 20:21:56 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING : No configuration found for the specified action: 'hello.action' in namespace:.'' Form action defaulting to 'action' attribute's literal value.
2013-3-14 20:21:57 org.apache.catalina.startup.HostConfig checkResources
Information : Reloading context [/ ssts]
------ For reference only ---------------------- -----------------
not find hello.action directory is not action configuration problem ah
------ For reference only ---------------------------------------
changed
In addition to your struts.xml in line with warnings
------ For reference only -------------------------------------- -
details without warning is a problem I
------ For reference only ---------------- -----------------------
Thank you solve the problem
------ for reference only ---------------------------------------
how to solve ah ?
------ For reference only -------------------------------------- -
how to solve
------ For reference only -------------------------- -------------
this post pit father
------ For reference only ----------------- ----------------------
I appear this error was originally written struts.xml I structs.xml. . . . . . . . . . . . . . .
------ For reference only -------------------------------------- -
parade , brother to curse , the landlord can not be so shameless you do not , fuck
------ For reference only ------------------ ---------------------
lzsb, the solution does not stick , obviously your mistakes and say ls crowd had nothing
- ----- For reference only ---------------------------------------
landlord Kengren ah ! By , the solutions do come out ah ? ? ?
没有评论:
回复删除发表评论