struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tamtam ...@moonover.net>
Subject [Struts2]blank extension
Date Thu, 13 Dec 2007 14:52:31 GMT
Hello,
i have a question about DefaultActionMapper(struts2.0.11).

I want to access like a "http://example.com/webapps/sayHello".
So, blank is set to "struts.action.extension" in struts.xml.
Access to "http://example.com/webapps/sayHello?name=hogehoge" is
successfull,
but access to "http://example.com/webapps/page/sample/index.jsp", i got
error.

I tried to access *.jsp, all jsp got error.
Does someone have good idea?

thanks.


web.xml:
<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>

struts.xml:
<constant name="struts.action.extension" value="" />
<package name="sample" extends="struts-default">
  <action name="sayHello" class="com.example.sample.action.SayHelloAction">
      <result name="success">/page/sample/hello.jsp</result>
  </action>
</package>

SayHelloAction.java:
package com.example.sample.action;
import com.opensymphony.xwork2.ActionSupport;
@SuppressWarnings("serial")
public class SayHelloAction extends ActionSupport {
  private String name;
  public void setName(String name) {
      this.name = name;
  }
  public String getName() {
      return this.name;
  }
  @Override
  public String execute() throws Exception {
      return SUCCESS;
  }
}

index.jsp:
<html><body>
<s:form name="form01" action="sayHello" method="POST">
  <s:textfield name="name" value="" maxlength="16"/>
  <s:submit name="btnHello" value="hello!!"/>
  <s:fielderror><s:param>name</s:param></s:fielderror>
</s:form>
</body></html>

hello.jsp:
<html><body>
<h1>Hello, Mr. <s:property value="name"/> !!</h1>
</body></html>

StackTrace:
There is no Action mapped for action name index.jsp. - [unknown location]
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Thread.java:619)


--
tamtam

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message