SourceForge.net Logo
Version: 0.27 - Last update: 2004-05-30 Home Page - SourceForge Project Page - Contact

Jodd
  Overview
  News
  Download
  License
  References

Development
  Using Jodd
  Javadoc
  JUnit report

Community
  Contribute
  Report a bug

More reading
  Milestone 0.30



Top 25%

BSD
 

More framework details

Here are some more details about Jodd mvc2 framework.

Action Parameters

Configuration WEB-INF/actions.xml file also may specify one or more parameters for each Action. Parameters are specified in action tag:

action.xml - parameters
 
<action path="/mvc2/act.do" type="MvcAction">
	<forward name="ok" path="/mvc2/world.jsp"/>
	<param name="login" value="1"/>
</action>

Above action definition specifies action that has one parameter. For example, such parameter as in above example may specify that for this request user must be login, however, parameters may be used in many different ways.

Inside of ActionServlet obtaing action parameters is easy:

Action parameters
 
String value = getActionParameter(request, "login");

Action not found

Jodd framework reserves the following global forward name: jodd.servlet.ActionController.actionNotFound. It is suggested to create global forward that points to a page or other action that will be invoked when not existing action is requested:

Action not found example
 
<global-forwards>
	<forward name="jodd.servlet.ActionController.actionNotFound" path="/mvc2/error.jsp"/>
</global-forwards>

This name is public static so it canbe changed if needed.

Action data

Once inside of ActionServlet action handler, it is possible to get various data:
  • getActionPath(request) - returns current request path that triggered invocation of the action
  • getActionForwardPath(request, "ok") - returns forward path from forward string, or null if not found. May be used for checking forwards, in case when they are created dynamically.
  • getActionType(request) - returns class type of current ActionServlet instance, i.e. current class (without reflection).
  • getActionMethodName(request) - returns method name of current action handler, i.e. current method (without reflection).

Parameters for forward strings

ActionServlet may returns a forward string that has parameters, as for the URL:

Parameters for forward strings
 
...
return "ok?id=1";

If "ok" forward string is mapped to the path "/mvc2/world.jsp", then the following URL will be used for forwarding (or redirection):

Resulting URL
 
/mvc2/world.jsp?id=1

This is helpful when forwarding is required to another action and not a view. More, ActionServlet recognizes situation when there are already existing parameters in the mapped path.

Invoking external actions

From one ActionServlet action handler it is possible to invoke any other one, by using invokeExternalAction() method.


http://jodd.sourceforge.net
najgor at users.sourceforge.net