Dave Newton wrote:
Tomasz Nazar wrote:
One more question: I don't see how would you pass two parameters into
the action. Can you tell?

Yeah, but you won't like it ;)

In the AdminCrud action I manually pick apart the URL and create 'table', 'command', and 'id' values that I pass to the command handlers.

Basically I'm using the wildcard mapping only to get to my action; the rest isn't automatic.

There's a couple of ways to do this better ;-) Firstly, you can reference the URL pattern matches ({1} etc) in the 'parameter' attribute of the action mapping, so you can pass stuff along that way.

More usefully, you can use the <attribute> element within your action mapping to do the same thing (this requires a post-1.2.7 build so if you don't want to use a nightly build you'll need to wait for the upcoming 1.3 to use this).

For example:

  <action path=path="/Admin/*/*"
          type="actions.AdminCrud"
          name="adminForm"
          parameter="noId"
          scope="request"
          validate="false">
    <attribute name="param1" value="{1}"/>
    <attribute name="param2" value="{2}"/>
    <forward name="list"      path="/do/Admin/{1}/List" redirect="true"/>
    <forward name="tableOk"   path="/WEB-INF/jsp/crud_{1}_{2}.jsp"/>
    <forward name="tableBad"  path="/WEB-INF/jsp/tableBad.jsp"/>
    <forward name="actionBad" path="/WEB-INF/jsp/actionBad.jsp"/>
  </action>

Then your action has setParam1(String), etc. methods and you can avoid re-parsing the URL.

L.
--
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/laurie


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to