struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mosho <roshini.bha...@gmail.com>
Subject Re: Question about Lookup dispatch action
Date Wed, 23 Aug 2006 14:26:30 GMT


Yes, that's exactly the way it works.
My navigation with lookupDispatchAction works perfectly. The problem arises
when I have another to link instead of button to submit the form, how do I
pass navigation parameter value then?
The javascript with hidden field doesn't solve the problem.

Thanks!


Scott Van Wart-2 wrote:
> 
> mosho wrote:
>> Request[/planName] does not contain handler parameter named navigation
>>   
> 
> In your struts-config.xml, are you including 'parameter="navigation"' in 
> your action mapping?  A la:
> 
>   <action path="/planName" type="my.pkg.PlanNameAction" 
> name="planNameForm" parameter="navigation">
>      ...
>   </action>
> 
> The parameter gives you a place to pass additional data to your action.  
> In the case of LookupDispatchAction, it uses it to find out which 
> request parameter (in this case, "navigation") it should look at to 
> determine which method to call in your subclass.  So your form will 
> submit, and be stuff like:
> 
>   navigation=Next%20Record
> 
> It looks messy, but that's OK.  The framework takes it and translates it 
> back into "Next Record".  Now in your subclass, you override 
> getKeyMethodMap() right?  And somewhere in there, you have something like,
> 
>   map.put( "navigation.next.record", "next" );
> 
> Where "next" corresponds to the public ActionForward next( 
> ActionMapping.......) method you have defined in your subclass.
> 
> And in your MessageResources.properties (or whatever the file's called 
> in your web app), you have:
> 
>   navigation.next.record=Next Record
> 
> See how everything links together?  Now the button text you choose is 
> likely different, but this flexibility is the reason you NEVER refer to 
> the button by its text.  Let Struts do that internally, only your users 
> should see it.  Just thought I'd give you a little background so you 
> know what you're getting into; anyone correct me if I'm wrong :)
> 
> Oh one last thing.  Make sure you're NOT overriding execute() in your 
> subclass.  It's fine for regular Action-derived classes, but you're 
> using LookupDispatchAction, which needs to run its own implementation of 
> execute().
> 
> - Scott
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Question-about-Lookup-dispatch-action-tf2124092.html#a5945508
Sent from the Struts - User forum at Nabble.com.


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


Mime
View raw message