We are slowly migrating our application from Struts1 to Struts 2, but for the first iteration we are simply having them run together and all new pages will be in Struts2. My problem is: how do I navigate from a strut1 page to a struts2 page?
I have a struts1 page that allows the user to select a report type. All but one selection is struts1. The last selection is a struts2 page. I need to get from the selection screen (struts1) to the new struts2 page.
Here is some code:
struts-config.xml
<action path="/reporting" type="........ReportingAction" name="reportForm" input="/WEB-INF/jsps/reporting.jsp" scope="session">
<forward name="outbound" path="/WEB-INF/jsps/reportingSelectDate.jsp">
</forward>
<forward name="inbound" path="/WEB-INF/jsps/reportingInboundSelectDate.jsp">
</forward>
<forward name="usage" path="/WEB-INF/jsps/reportingUsageSelectDate.jsp">
</forward>
<forward name="expansion" path="/s2/expansionReportEntry.jsp">
</forward>
<forward name="failure" path="/WEB-INF/jsps/reporting.jsp">
</forward>
<forward name="login" path="/login.do">
</forward>
</action>
I want to forward "expansion" to the new Struts 2 page. Is this the correct way to go about it? Assuming I have struts.xml and web.xml set up correctly. I have struts2 filter handling .action and struts1 doing .do.
The right way is to redirect to the new framework, even if maintaining two frameworks is not recommended
<forward name="expansion" path="/s2/expansionReportEntry.action" redirect="true">
Related
I'm using the pages that comes with the default instalation of magento on my web store. The customer want's to have diferent contents on right column of that pages.
For instance, on "customer-service" page wants to have the top FAQ's but on "contacts" want to have the telephone and mail information.
How can I achive that? I been trying to change the 2columns-right layout, on the right column, to each page but I was unable to find a way to do that.
Thanks in advanced.
In 'CMS > Pages' from the Magento back office, go into the 'Design' tab in each page you want to change and set the 'Layout' to '2 columns with rightbar'.
Then, you can use the right.permanent.callout block to call in what content you wish on various pages/page types as wanted.
For example, displaying an image in the right sidebar on contact page only:-
<contacts_index_index>
<reference name="right">
<block type="catalog/product_compare_sidebar" before="cart_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
<block type="core/template" name="right.permanent.callout" template="callouts/right_col.phtml">
<action method="setImgSrc"><src>images/media/col_right_callout.jpg</src></action>
<action method="setImgAlt" translate="alt" module="catalog"><alt>Keep your eyes open for our special Back to School items and save A LOT!</alt></action>
</block>
</reference>
</contacts_index_index>
You can modify to change the page, page type, or template/block as you wish.
I'm working on Joomla project which is using Form Maker. My task is to improve HTML template but I absolutely can't find it. I've searched everywhere I could in the extension's directory folder.
Structure:
|-models
|----formaker.php
|----index.html
|-uploads
|----index.html
|-views
|----formmaker
|--------tmpl
|------------default.php
|------------default.xml
|------------index.html
|------------main.js
|--------index.html
|--------view.html.php
|----index.html
|-controller.php
|-formmaker.php
|-index.html
|-wd_captcha.php
From my point of view main file is in views/formmaker/tmpl/default.php but I've didn't find the way how I can modify especially the HTML template to change the form params.
Update - Structure of default.xml:
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="Form">
<message></message>
</layout>
<fields name="request">
<fieldset name="request" addfieldpath="/administrator/components/com_formmaker/models/forms" >
<field name="id" type="modal_contacts" label="Select a Form" required="true"/>
</fieldset>
</fields>
</metadata>
Thank you in advance
According to the Form Maker extension the only possible solution to change the HTML markup of the form elements, it's only to rewriting the whole script for your needs.
Wouldn't recommend to use this script, even Premium version.
Form parametars are in xml file. Try at this path views/formmaker/formmaker.xml
Greetings.
I was trying to add an app bar to the windows phone 8(VS 2013 & framework 4.5) application.
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Mode="Default" Opacity="1.0" >
<shell:ApplicationBarIconButton IconUri="/Images/save.png" Text="save" Click="Button1_Click" />
<shell:ApplicationBarIconButton IconUri="/Images/delete.png" Text="delete" Click="Button2_Click" />
<shell:ApplicationBarIconButton IconUri="/Images/help.png" Text="help" Click="Button3_Click" />
<shell:ApplicationBarIconButton IconUri="/Images/settings.png" Text="settings" Click="Button4_Click" />
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem Text="get default size value" Click="MenuItem1_Click" />
<shell:ApplicationBarMenuItem Text="get mini size value" Click="MenuItem2_Click" />
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
The app bar buttons are getting displayed in this specific page, but in other pages it is not visible. How we can make the app bar and its button visible global?
Thanking you in advance
Sebastian
you needed To create a global Application Bar that can be reused on multiple pages. Usually we create an Application Bar on the page we want to use it on, and it applies only to that page. For this purposes here is a good example create a global Application Bar , you needed to create a global Application Bar by using XAML in App.xaml as shown in example.
or
You need to write same AppBar code in all individual pages for displaying it to all pages as you Described in Question
You can also create it programmatically and store a reference to it in your App.xaml.cs, and insert it in every page, in constructor, like this:
this.ApplicationBar = App.GlobalAppBar;
Creation is simple as:
ApplicationBarIconButton firstButton = new ApplicationBarIconButton();
firstButton.IconUri = new Uri("/Images/save.png", UriKind.Relative);
firstButton.Click += Button1_Click;
firstButton.Text = "save";
GlobalAppBar = new ApplicationBar();
GlobalAppBar.Buttons.Add(firstButton);
I have a razor script in Umbraco that is quite complex and I want at some point of it to render a macro in it.
The macro which is called SuggestionBox is actually a user control (.ascx) and traditionally this is referenced on the template using
<umbraco:macro Alias="SuggestionBox" language="cshtml" runat="server"></umbraco:macro>
But now I need to call it from the razor script instead so I tried;
#Html.Raw(umbraco.library.RenderMacroContent("SuggestionBox", Model.Id))
as well as:
#RenderPage("SuggestionBox")
No luck so far as I'm sure I'm using these wrongly.
I read somewhere it might be infeasible if the page is wrapped in a masterpage.
It works if I add it to the Template like I traditionally would:
<umbraco:macro Alias="EventsRenderer" language="cshtml" runat="server"></umbraco:macro>
<div class="talkingPointPanel">
<h3><umbraco:Item field="talkingPoinstSuggestionText" runat="server"></umbraco:Item></h3>
<umbraco:macro Alias="SuggestionBox" language="cshtml" runat="server"></umbraco:macro>
</div>
Where EventsRenderer renders the page that should ideally contain the SuggestionBox.
using
#Html.Raw(umbraco.library.RenderMacroContent("<?UMBRACO_MACRO macroAlias=\"SuggestionBox\" />", Model.Id))
Gives me this error:
<!-- Error generating macroContent: 'System.Web.HttpException (0x80004005): HtmlForm cannot render without a reference to the Page instance. Make sure your form has been added to the control tree.
at System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
at umbraco.presentation.templateControls.Macro.Render(HtmlTextWriter writer)
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
at umbraco.library.RenderMacroContent(String Text, Int32 PageId)' -->
Any ideas?
<umbraco:Macro runat="server" language="cshtml">#{
HtmlTextWriter writer = new HtmlTextWriter(this.Output);
var navigation = new umbraco.presentation.templateControls.Macro();
navigation.Alias = "Navigation";
navigation.MacroAttributes.Add("ulclass", "art-vmenu");
navigation.MacroAttributes.Add("level", 2);
navigation.RenderControl(writer); }</umbraco:Macro>
Try something like this. It works for me ... I have made a Navigation macro. Be Aware though your variables should be given in toLower, if caps are used, the parameters will not come through.
In Umbraco 4.10+ To call a macro inside Razor script, use:
#Umbraco.RenderMacro("macroNameHere", new { propertyName1 = CurrentPage.pageProperty }))
Try something like this:
#Html.Raw(umbraco.library.RenderMacroContent("<?UMBRACO_MACRO macroAlias=\"SuggestionBox\" />", Model.Id))
I have a part of my web application that is an RESTfull api and part a more standard web-pages.
I wish to have the REST part with some custom filters such as the EntryPoint, SuccessHandler and FailureHandler. This part is within the /rest/** mapping.
In the other hand, everything else needs to have more common filters and is mapped with /**.
The problem is to find an easy way to define the filterChainProxy with different mapping-filters.
Right now this solution doesn't work:
<!-- Normal web app -->
<http auto-config="true" use-expressions="true" authentication-manager-ref="authenticationManager">
<form-login/>
<logout/>
<intercept-url pattern="/**" access="hasRole('ROLE_USER')" />
</http>
<!-- Configure RESTfull services -->
<http use-expressions="true" authentication-manager-ref="authenticationManager" entry-point-ref="restAuthenticationEntryPoint" >
<form-login authentication-success-handler-ref="restAuthenticationSuccessHandler" login-page="/rest/login" username-parameter="username" password-parameter="password" />
<logout logout-url="/rest/logout" />
<intercept-url pattern="/rest/**" method="GET" access="hasRole('ROLE_USER')" />
<intercept-url pattern="/rest/**" method="POST" access="hasRole('ROLE_ADMIN')" />
<intercept-url pattern="/rest/**" method="PUT" access="hasRole('ROLE_ADMIN')" />
<intercept-url pattern="/rest/**" method="DELETE" access="hasRole('ROLE_ADMIN')" />
</http>
It complains with: the univseral match being before other patterns.
Is there a way to define such a thing without resorting to define the filterChainProxy with the definition? The http version does help quite a lot to reduce the amount of configuration as I will have to manually set a UsernamePasswordAuthenticationFilter etc.
The next problem is more simple: I have to respond, after the form-login authentication with a JSON object.
So far, I have implemented a SuccessHandler (actually a version of the SimpleUrlAuthenticationSuccessHandler without the redirect part).
How do I write my JSON output?
I must have something like this:
HTTP 200 OK
with:
{"success":true,"customer {"email":"customer#email.com","session_id":"b83a41dfaca6785399f00837888886e646ff9088"}}
and a similar thing with the FailureHandler. It must be quite simple and it's surely is some very basic thing, but how do you do that? Redirecting to a custom controller is not a solution since I will have the 301 redirect status that a very simple REST client might not be able to understand.
At the very least, I wish to have only the http header and no body at all.
thanks!
If you can upgrade to Spring Security 3.1 it supports multiple chains using namespace configuration.