How can I use a Struts 1.x DispatchAction and have buttons with large text values on them? - struts

All the DispatchAction examples have commands like "add", "show", and "delete". What if I need to have text like "Submit this form for further processing!", but I don't want to name my DispatchActions's method "submitThisFormForFurtherProcessing!" ? Is there a way I can have the text that shows on the submit button be different than the method name of the Struts Dispatch Action?

got it - use "LookupDispatchAction" rather than "DispatchAction". This has a method you need to override called Map getKeyMethodMap() that will map the button text to the name of the method that needs to get invoked for that button text.

Related

Know in `activate` if the navigation was due to clicking on the nav-bar

I am trying to get 3 different routing "styles" in my application. I need to identify these in each view-model's activate method:
User clicks a button or link in my app that causes my app to call this.router.navigate()
This one is easy because I always put a parameter into the URL, so in the target View-Model, I have that param in my activate method.
The users presses the back or forward buttons or loads the application for the first time.
I can also get this by using the this.router.isExplicitNavigation variable or checking if my state is uninitalized.
The user clicks on one of the views displayed in the nav-bar (setup in the app.ts configureRouter method).
Unfortunately I cannot find a way to distinguish this one from when the user presses the back and forward buttons on the browser.
So here is my question, is there a way to know when a view-model's activate method has been called because a user selected a nav-bar route?
If I understand your question correctly, you want distinguish between 1. and 3. In activate(), you receive all routing parameters (as the method's first argument), both:
from the route-template, such as /myRoute/:myparam
from the query string
So I'd suggest to put a query parameter for the menu bar, which parameter you can read in activate(). For example:
let's say your route /myRoute
from the button, simply navigate to /myRoute
from the navbar, navigate to /myRoute?from=navbar
You might know this, but you have multiple options to navigate from code:
router.navigate('compose your route manually')
router.navigateToRoute('route's name', parameters)
in template, using <a route-href="route: 'myRoute'; params.bind={...}" >
Your code:
//button
router.navigateToRoute('my-route');
//navbar
router.navigateToRoute('my-route', {from: 'navbar'});
//destination view-model
activate(params: Object): void {
if (params.from === 'navbar')
//routed from the navbar
else
//routed from a button
}

Changing default dropdown value in sap crm web ui

I want to change default values which gets populated in the below picture.
I tried modifying get_v_role method but it didn't serve my purpose.
Please help.
In personalize->personalize settings, there is sort option. It sometimes overwrites this arrangement of values of get_v method.
Also code can be written in inbound plug of this view. I did it for overview page drop down and it worked. You can try for your search page.
For filtering/changing drop-down value of search parameter, You've to Re-define GET_DQUERY_DEFINITIONS method of ZCL_XXX_IMPL class of component. GET_V_XX methods are only used to modify drop-down/F4 help of view pages not the search view.
STEPS:
Click F2 while placing the cursor on Account ID(for which parameter you want
to modify) drop-down.
Go to BSP Component using t-code - BSP_WD_CMPWB
Enter the component name and Enhancement set
Select the view.
Go to Implementation class .
If your component is enhanced then it will be having ZCL_XXX_IMPL class. otherwise you've to enhance that component. Click on that class.
After that find GET_DQUERY_DEFINITIONS method and implement same way as
GET_V_XXX.

MVC4 Dynamic Menu Generation

I want to generate menu from database for that I have implemented my logic and its responding well, the issue is that I am unable to render menu from my controller method. I want to ask if its possible to return HTML from action controller method and render it on my view by using Html.Action("MenuGenerator","Menu") but I am unable to achieve this. Moreover I donot want to create partial view for menu since my method returns menu as html string and I just want to flush it out to the view.
Html.Action is a basic helper method. All it does is return a MVCHtmlString. You will have to create your own helper extension that returns your custom HTML to build your menu.

What is the way in MVC to hold action parameter values on the client side and use them while redirecting to a an action with parameters?

If I am on a page and decide to click cancel, I want to redirect it to an action method with parameters. But to do that, what is the way to hold the action parameter values on the page and use them later on a click of link or button.
One way is to create hidden fields in the page while page is rendered and hold the values in them. Extract the value from them using Java script and alter the documen
Is this the right way to do it in mvc or there is a cleaner way to accomplish this. Please suggest.
In case you need to use a button you will need to use jquery (or vanilla java script) to redirect user somewhere by button. As an option you can create button with, for example, data-url attribute and use #Url.Action helper method (instead of Html.ActionLink. ActionLink generates entire a tag with all html parameters like href and other which you provide, but Url.Action generates only url - the value of href attribute) to generate link with parameters and implement button click event handler to redirect user by this url. Example:
Button (view, Razor syntax):
<input type="button" data-url="#Url.Action("Action","Controller", new { parameter=value }, null)" value="Click me" id="my-button"/>
Related jquery:
$(document).ready(function(){
$('#my-button').click(function(){
window.location.href = $(this).data('url');
});
});
1) if you already have the parameters in database.
All you need to is pass a id or something of the clicked data from which you can retrieve the required values in the controller.
In your syntax pass the values.
#Html.ActionLink("cancle","ActionName","ControllerName", new { id = Model.Id, type = "button" })
use this id in the controller and get the parameters from database and proceed.
2)if parameters are obtained dynamically (not available in DB).
your approach will be good (by saving it in hidden fields and later retrieving in controller or processing it in JS).

Any component like "Reply to post/blog" in SenchaTouch 2?

Is there any component like reply to post/blog in sencha touch 2 for giving any reply?
(for clearing question: component like, if we click to reply button then it will show box with subject and data etc)
You would have to implement it yourself, but it wouldn't be too difficult.
You would simply create a view which has a textareafield in it. You would show this view when you tap on a button, and then call field.setValue() with the predefined value you want to add.