struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve <it_soluti...@hotmail.com>
Subject RE: Struts 2 Annotation Tutorial (additional info)
Date Thu, 29 Sep 2011 04:01:15 GMT
Thank you both for your responses.  

Since I had " <constant name="struts.convention.action.suffix"
value="Controller"/>" listed in my struts.xml file, I tried renaming my
HelloAction class to "HelloController" or "HelloActionController" and tried
various urls to match but no luck.  I even tried removing the
"struts.convention.action.suffix" element but it didn't seem to make any
difference.

I've reverted back and below is what I've currently got.

The URL I use is:
http://localhost:8080/Struts2_Annotations_Ant/hello.action



My HelloAction class is as follows (sorry for forgetting to send it in the
first place):
package org.apache.struts.struts2annotations.action;

import org.jboss.xnio.log.Logger;

import com.opensymphony.xwork2.ActionSupport;

public class HelloAction extends ActionSupport {

	private static final long serialVersionUID = 1L;
	private static final Logger logger =
Logger.getLogger(HelloAction.class.getName());
	
	private String message;

	public String execute() throws Exception {
		logger.info("In execute method of class Hello");
		message = "Hello from Struts 2 with no XML configurtaion";
		return SUCCESS;
	}
	
	public void setMessage(String message) {
		this.message = message;
	}

	public String getMessage() {
		return message;
	}

}

-----Original Message-----
From: M. Rakowski [mailto:matthias@rakowski.biz] 
Sent: Wednesday, September 28, 2011 10:49 AM
To: user@struts.apache.org
Subject: Re: Struts 2 Annotation Tutorial (additional info)

I wrote:

 > make sure your Hallo-Action is in class HalloController in package  >
foo.actions.bar (foo and bar are random names)

which is not quite correct:
the prefix of the actions-package can be random.
The sub-packages names defines the url namespace.
For example, you can access the foo.actions.HalloController with
/context-path/hallo and the foo.actions.bar.BazController action with
/context-path/bar/baz

Regards, Matthias

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



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


Mime
View raw message