does not change the locale with using LocaleAction - struts

i use struts 1.3 and want to make localization.
that's what I'm doing:
in struts-config.xml:
<form-bean name="English" type="org.apache.struts.action.DynaActionForm">
<form-property name="language" type="String" initial="en" />
</form-bean>
<form-bean name="Russian" type="org.apache.struts.action.DynaActionForm">
<form-property name="language" type="String" initial="ru" />
</form-bean>
<action-mappings>
<action path="/English" name="English"
type="org.apache.struts.actions.LocaleAction">
<forward name="success" path="/index.jsp" />
</action>
<action path="/Russian" name="Russian"
type="org.apache.struts.actions.LocaleAction">
<forward name="success" path="/index.jsp" />
</action>
<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor" />
on jsp.page
<html:link action="/Russian">
<bean:message key="jsp.header.russian"/>
</html:link>
<html:link action="/English">
<bean:message key="jsp.header.english"/>
</html:link>
maybe i do something wrong? any ideas?
P.S. yes, i have messages_ru.properties and messages_en.properties.

Oh, I found the reason, struts do not know of this type as a String.
<form-property name="language" type="java.lang.String" initial="en" />

Related

Outlook Web Add-In error 'There were deployment errors. Continue?'

Currently I'm working on an Outlook Add-In using Visual Studio 2022 with React (TypeScript). When starting the application a message box appears containing following message:
There were deployment errors. Continue?
The output of the build console doesn't help at all because it only says that an error has occurred but without any further information.
Is there any way to get more error details or does anyone know how to fix this?
Manifest:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0" xmlns:mailappor="http://schemas.microsoft.com/office/mailappversionoverrides/1.0" xsi:type="MailApp">
<Id>0ca51293-705c-45d5-975c-e59909dab3ea</Id>
<Version>1.0.0.0</Version>
<ProviderName>Company</ProviderName>
<DefaultLocale>de-DE</DefaultLocale>
<DisplayName DefaultValue="OutlookAddInWeb" />
<Description DefaultValue="OutlookAddInWeb Description" />
<IconUrl DefaultValue="~remoteAppUrl/Images/Button64x64.png" />
<HighResolutionIconUrl DefaultValue="~remoteAppUrl/Images/Button80x80.png" />
<SupportUrl DefaultValue="https://www.somesite.com/" />
<AppDomains>
<AppDomain>https://login.microsoftonline.com</AppDomain>
<AppDomain>https://localhost:44488</AppDomain>
</AppDomains>
<Hosts>
<Host Name="Mailbox" />
</Hosts>
<Requirements>
<Sets>
<Set Name="Mailbox" MinVersion="1.1" />
</Sets>
</Requirements>
<FormSettings>
<Form xsi:type="ItemEdit">
<DesktopSettings>
<SourceLocation DefaultValue="~remoteAppUrl/" />
</DesktopSettings>
</Form>
</FormSettings>
<Permissions>ReadWriteItem</Permissions>
<Rule xsi:type="ItemIs" ItemType="Message" FormType="Edit" />
<DisableEntityHighlighting>false</DisableEntityHighlighting>
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">
<VersionOverrides xmlns="http://schemas.microsoft.com/office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
<Requirements>
<bt:Sets DefaultMinVersion="1.5">
<bt:Set Name="Mailbox" />
</bt:Sets>
</Requirements>
<Hosts>
<Host xsi:type="MailHost">
<DesktopFormFactor>
<FunctionFile resid="Commands.Url" />
<ExtensionPoint xsi:type="MessageComposeCommandSurface">
<OfficeTab id="TabDefault">
<Group id="msgComposeGroup">
<Label resid="GroupLabel" />
<Control xsi:type="Button" id="msgComposeOpenPaneButton">
<Label resid="TaskpaneButton.Label" />
<Supertip>
<Title resid="TaskpaneButton.Label" />
<Description resid="TaskpaneButton.Tooltip" />
</Supertip>
<Icon>
<bt:Image size="16" resid="Icon.16x16" />
<bt:Image size="32" resid="Icon.32x32" />
<bt:Image size="80" resid="Icon.80x80" />
</Icon>
<Action xsi:type="ShowTaskpane">
<SourceLocation resid="Taskpane.Url" />
</Action>
</Control>
<Control xsi:type="Button" id="ActionButton">
<Label resid="ActionButton.Label" />
<Supertip>
<Title resid="ActionButton.Label" />
<Description resid="ActionButton.Tooltip" />
</Supertip>
<Icon>
<bt:Image size="16" resid="Icon.16x16" />
<bt:Image size="32" resid="Icon.32x32" />
<bt:Image size="80" resid="Icon.80x80" />
</Icon>
<Action xsi:type="ExecuteFunction">
<FunctionName>action</FunctionName>
</Action>
</Control>
</Group>
</OfficeTab>
</ExtensionPoint>
</DesktopFormFactor>
</Host>
</Hosts>
<Resources>
<bt:Images>
<bt:Image id="Icon.16x16" DefaultValue="~remoteAppUrl/Images/Button16x16.png" />
<bt:Image id="Icon.32x32" DefaultValue="~remoteAppUrl/Images/Button32x32.png" />
<bt:Image id="Icon.80x80" DefaultValue="~remoteAppUrl/Images/Button80x80.png" />
</bt:Images>
<bt:Urls>
<bt:Url id="Commands.Url" DefaultValue="~remoteAppUrl/commands.html" />
<bt:Url id="Taskpane.Url" DefaultValue="~remoteAppUrl/" />
</bt:Urls>
<bt:ShortStrings>
<bt:String id="GroupLabel" DefaultValue="Outlook Add-in" />
<bt:String id="TaskpaneButton.Label" DefaultValue="Show Taskpane" />
<bt:String id="ActionButton.Label" DefaultValue="Perform an action" />
</bt:ShortStrings>
<bt:LongStrings>
<bt:String id="TaskpaneButton.Tooltip" DefaultValue="Opens a pane displaying all available properties." />
<bt:String id="ActionButton.Tooltip" DefaultValue="Perform an action when clicked." />
</bt:LongStrings>
</Resources>
<WebApplicationInfo>
<Id>1d32bd7d-70ab-42b5-b11a-8e73a6b8ab4a</Id>
<Resource>api://localhost:44488/1d32bd7d-70ab-42b5-b11a-8e73a6b8ab4a</Resource>
<Scopes>
<Scope>openid</Scope>
<Scope>profile</Scope>
</Scopes>
</WebApplicationInfo>
</VersionOverrides>
</VersionOverrides>
</OfficeApp>
Use https://learn.microsoft.com/en-us/office/dev/add-ins/testing/troubleshoot-manifest to validate your manifest file. There are issues with your manifest file.

why does this code doesn't go into infinite loop?

1)
I'm looking at some code that is perhaps Struts1 and was wondering if someone can explain why I'm not getting an infinite loop, and instead, I'm being forwarded to a jsp page instead:
struts-config.xml:
<struts-config>
<global-forwards>
<forward name="a.t" path="/Search.do"/>
</global-forwards>
<action-mappings>
<action path="/Search"
type="path.SearchAction"
scope="request"
name="searchForm"
validate="true">
<forward name="orders" path="a.t"/>
<forward name="success" path="a.t"/>
<forward name="cancel" path="/Search.do"/>
</action>
</action-mappings>
...
</struts-config>
I searched for a.t and found it's also referenced in this
tiles.xml. Don't know what's the purpose of this.
<tiles-definitions>
<definition name="a.t" extends="admin.default">
<put-attribute name="content" value="/mypath/hello.jsp"/>
</definition>
</tiles-definitions>
Abridged SearchAction.java class:
public class SearchAction extends Action
(
....
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws
Exception
{
....
return mapping.findForward("success");
}
)
My Original thinking is that since it always returns "success", and according to the struts-config.xml
<forward name="success" path="a.t"/>
it would go to find a.t, which is defined in the global-foward
<struts-config>
<global-forwards>
<forward name="a.t" path="/Search.do"/>
</global-forwards>
and
path="/Search.do"
would in theory send me back to SearchAction.java
Since
<action-mappings>
<action path="/Search"
points to SearchAction.java
2)
I don't know why the original author decided to do:
<forward name="orders" path="a.t"/>
<forward name="success" path="a.t"/>
<forward name="cancel" path="/Search.do"/>
Is there a difference between
<forward name="success" path="a.t"/>
vs.
<forward name="success" path="/Search.do"/>
I'm being forwarded to a jsp page instead:
I hope you are being forwarded to hello.jsp
My Original thinking is that since it always returns "success", and
according to the struts-config.xml
<forward name="success" path="a.t"/>
it would go to find a.t, which is defined in the global-foward
<struts-config>
<global-forwards>
<forward name="a.t" path="/Search.do"/>
</global-forwards>
and path="/Search.do"
The path="a.t" will not again search for mapping with same name in <global-forwards>. Instead it searches for the suitable mapping in tiles.xml and finds the following block and redirects to hello.jsp
<tiles-definitions>
<definition name="a.t" extends="admin.default">
<put-attribute name="content" value="/mypath/hello.jsp"/>
</definition>
</tiles-definitions>
Is there a difference between
<forward name="success" path="a.t"/>
vs.
<forward name="success" path="/Search.do"/>
<forward name="success" path="a.t"/> will get mapped to tiles.xml and forward to hello.jsp
<forward name="success" path="/Search.do"/> will get mapped to SearchAction.java. Since you have only returned success, it will again go to hello.jsp, but the original author has done so, because in future he can add any other mapping also, for different cases say, failure
Action class:
return mapping.findForward("failure");
struts-config.xml:
<forward name="failure" path="failure.jsp"/>

path attribute of forward tag in struts-config.xml file

<action-mappings>
<action name="loginAction" path="/loginAction"
type="com.xx.yy.actions.LoginAction" scope="request"
validate="false">
<forward name="landingPage" path="landingpage" />
<forward name="error" path="errorpage" />
</action>
<action name="admin" path="/adminAction"
type="com.xx.yy.actions.AdminHome" scope="request"
validate="true" input="/jsp/login.jsp">
<forward name="success" path="/jsp/admin/admin.jsp" />
<forward name="failure" path="/jsp/admin/admin.jsp" />
</action>
</action-mappings>
In the above code path attribute of forward tag is landingpage for action loginAction .
So in this case control takes to which page or action?In this context what is landingpage?Is it a jsp or another action?
In admin action path attribute of forward tags are jsps so its clear that control will be directed to jsp depending on logic in action class.
In that line...
<forward name="landingPage" path="landingpage" />
...the path attribute may be an Apache Tiles configuration name.

mutiple button in HTML in struts framework

I have five buttons in my HTML code each doing differnt task . I have written one form bean and five different action classes since on click of submit button all five buttons do completely different business operation altoghether.
Am I doing it right . If so how to capture this scenarion in my struts.xml
Generally, I like to have 1 Action class for every action a user can take. So if they are executing different business logic, then I think you are right to have just 5 different Action classes.
1 form bean also probably makes sense, if all the buttons correspond to the same form.
As far as how to capture this in the struts.xml, I don't think you need to do anything special. Just configure the 5 actions as you would normally, and specify 5 different actions, all using the same form bean.
<!--This example is not tested, it is just to give you an idea-->
<form-beans>
<form-bean
name="form1"
type="app.Form1"/>
</form-beans>
<action-mappings>
<action
path="/Action1"
type="app.Action1"
name="form1"
input="/pages/input.jsp">
<forward
name="success"
path="/pages/success.jsp"/>
<forward
name="failure"
path="/pages/input.jsp"/>
</action>
<action
path="/Action2"
type="app.Action2"
name="form1"
input="/pages/input.jsp">
<forward
name="success"
path="/pages/success.jsp"/>
<forward
name="failure"
path="/pages/input.jsp"/>
</action>
<action
path="/Action3"
type="app.Action3"
name="form1"
input="/pages/input.jsp">
<forward
name="success"
path="/pages/success.jsp"/>
<forward
name="failure"
path="/pages/input.jsp"/>
</action>
<action
path="/Action4"
type="app.Action4"
name="form1"
input="/pages/input.jsp">
<forward
name="success"
path="/pages/success.jsp"/>
<forward
name="failure"
path="/pages/input.jsp"/>
</action>
<action
path="/Action5"
type="app.Action5"
name="form1"
input="/pages/input.jsp">
<forward
name="success"
path="/pages/success.jsp"/>
<forward
name="failure"
path="/pages/input.jsp"/>
</action>
</action-mappings>

HTTP Status 503 - Servlet action is currently unavailable

I am using spring source dm server version 2.0.0.
I developed one application in spring/struts/hibernate. When I am running my application in spring dm server with
it gives me error like:
HTTP Status 503 - Servlet action is currently unavailable
type: Status report
message: Servlet action is currently unavailable
description: The requested service (Servlet action is currently unavailable) is not currently available.
My web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<!-- Action Servlet Configuration -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<!-- Spring Framework context Loader -->
<servlet>
<servlet-name>context</servlet-name>
<servlet-class>
org.springframework.web.context.ContextLoaderServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Spring Framework context config location -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext*.xml
</param-value>
</context-param>
<!--TODO Prevent direct calls to *.jsp -->
<!-- Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<!-- The Welcome File List -->
<welcome-file-list>
<welcome-file>start.jsp</welcome-file>
</welcome-file-list>
<!-- Define the basename for a resource bundle for I18N -->
<context-param>
<param-name>
javax.servlet.jsp.jstl.fmt.localizationContext
</param-name>
<param-value>
com.patni.temgt.web.ApplicationResources
</param-value>
</context-param>
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/SettleTest</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
and struts-config.xml is:
<form-beans>
<form-bean name="timeEntryForm"
type="com.patni.temgt.web.CreateTimeEntryActionForm" />
<form-bean name="expenseEntryForm"
type="com.patni.temgt.web.CreateExpenseEntryActionForm" />
<form-bean name="timeEntryReportForm"
type="com.patni.temgt.web.TimeEntryReportActionForm" />
<form-bean name="adminCostingCodeForm"
type="com.patni.temgt.web.AdminCostingCodeActionForm" />
<form-bean name="loginForm"
type="com.patni.temgt.web.LoginActionForm" />
<form-bean name="adminEnvironmentVariableForm"
type="com.patni.temgt.web.AdminEnvironmentVariableActionForm" />
<form-bean name="adminEmployeeForm"
type="com.patni.temgt.web.AdminEmployeeActionForm" />
<form-bean name="adminContactDetailForm"
type="com.patni.temgt.web.AdminContactDetailActionForm" />
<form-bean name="adminApplicationUserForm"
type="com.patni.temgt.web.AdminApplicationUserActionForm" />
<form-bean name="adminUserRoleForm"
type="com.patni.temgt.web.AdminUserRoleActionForm" />
<form-bean name="myCostingCodeForm"
type="com.patni.temgt.web.MyCostingCodeActionForm" />
</form-beans>
<global-forwards>
<forward name="login" path="/WEB-INF/jsp/login.jsp" />
</global-forwards>
<action-mappings>
<action path="/timeEntry"
type="com.patni.temgt.web.CreateTimeEntryAction"
name="timeEntryForm" scope="session" validate="false"
input="/WEB-INF/jsp/timeEntry.jsp">
<forward name="success" path="/WEB-INF/jsp/timeEntry.jsp" />
<forward name="invalid" path="/WEB-INF/jsp/timeEntry.jsp" />
</action>
<action path="/expenseEntry"
type="com.patni.temgt.web.CreateExpenseEntryAction"
name="expenseEntryForm" scope="session" validate="false"
input="/WEB-INF/jsp/expenseEntry.jsp">
<forward name="success" path="/WEB-INF/jsp/expenseEntry.jsp" />
<forward name="invalid" path="/WEB-INF/jsp/expenseEntry.jsp" />
<forward name="list" path="/WEB-INF/jsp/expenseList.jsp" />
<forward name="approvallist" path="/expenseApproval.htm?action=list" redirect="true" />
</action>
<action path="/expenseApproval"
type="com.patni.temgt.web.ExpenseApprovalAction"
name="expenseEntryForm" scope="session" validate="false"
input="/WEB-INF/jsp/expenseApprovalList.jsp">
<forward name="approvallist" path="/WEB-INF/jsp/expenseApprovalList.jsp" />
</action>
<action path="/adminCostingCode"
type="com.patni.temgt.web.AdminCostingCodeAction"
name="adminCostingCodeForm" scope="session" validate="false"
input="/WEB-INF/jsp/adminCostingCode.jsp">
<forward name="success" path="/WEB-INF/jsp/adminCostingCode.jsp" />
<forward name="invalid" path="/WEB-INF/jsp/adminCostingCode.jsp" />
</action>
<action path="/login"
type="com.patni.temgt.web.LoginAction"
name="loginForm" scope="session" validate="false"
input="/WEB-INF/jsp/login.jsp">
<forward name="mainPage" redirect="true"
path="/settleMain.htm" />
</action>
<action path="/settleMain"
type="com.patni.temgt.web.SettleMainAction">
<forward name="success" path="/WEB-INF/jsp/settleMain.jsp" />
</action>
<action path="/adminEnvironmentVariable"
type="com.patni.temgt.web.AdminEnvironmentVariableAction"
name="adminEnvironmentVariableForm" scope="session"
input="/WEB-INF/jsp/adminEnvironmentVariable.jsp">
<forward name="success"
path="/WEB-INF/jsp/adminEnvironmentVariable.jsp" />
<forward name="invalid"
path="/WEB-INF/jsp/adminEnvironmentVariable.jsp" />
</action>
<action path="/adminEmployee"
type="com.patni.temgt.web.AdminEmployeeAction"
name="adminEmployeeForm" scope="request"
input="/WEB-INF/jsp/adminEmployee.jsp">
<forward name="success" path="/WEB-INF/jsp/adminEmployee.jsp" />
<forward name="invalid" path="/WEB-INF/jsp/adminEmployee.jsp" />
</action>
<action path="/adminContactDetail"
type="com.patni.temgt.web.AdminContactDetailAction"
name="adminContactDetailForm" scope="request"
input="/WEB-INF/jsp/adminContactDetail.jsp">
<forward name="employee" path="/adminEmployee.htm" />
<forward name="company" path="/adminCompany.htm" />
<forward name="success" path="/WEB-INF/jsp/adminContactDetail.jsp" />
<forward name="invalid" path="/WEB-INF/jsp/adminContactDetail.jsp" />
</action>
<action path="/adminApplicationUser"
type="com.patni.temgt.web.AdminApplicationUserAction"
name="adminApplicationUserForm" scope="request"
input="/WEB-INF/jsp/adminApplicationUser.jsp">
<forward name="success" path="/WEB-INF/jsp/adminApplicationUser.jsp" />
<forward name="invalid" path="/WEB-INF/jsp/adminApplicationUser.jsp" />
</action>
<action path="/adminUserRole"
type="com.patni.temgt.web.AdminUserRoleAction"
name="adminUserRoleForm" scope="request"
input="/WEB-INF/jsp/adminUserRole.jsp">
<forward name="success" path="/WEB-INF/jsp/adminUserRole.jsp" />
<forward name="invalid" path="/WEB-INF/jsp/adminUserRole.jsp" />
</action>
<action path="/timeEntryReporting"
type="com.patni.temgt.web.TimeEntryReportAction"
name="timeEntryReportForm" scope="request"
input="/WEB-INF/jsp/timeEntryReporting.jsp">
<forward name="success" path="/WEB-INF/jsp/timeEntryReporting.jsp" />
<forward name="invalid" path="/WEB-INF/jsp/timeEntryReporting.jsp" />
</action>
<action path="/myCostingCodes"
type="com.patni.temgt.web.MyCostingCodeAction"
name="myCostingCodeForm" scope="request"
input="/WEB-INF/jsp/myCostingCodes.jsp" parameter="method">
<forward name="success" path="/WEB-INF/jsp/myCostingCodes.jsp" />
<forward name="invalid" path="/WEB-INF/jsp/myCostingCodes.jsp" />
</action>
</action-mappings>
<controller>
<set-property property="processorClass"
value="org.springframework.web.struts.DelegatingRequestProcessor" />
</controller>
<!-- ========== Message Resources Definitions =========================== -->
<!-- Will look for a properties file
com.patni.temgt.web.ApplicationResources.properties" -->
<message-resources
parameter="com.patni.temgt.web.ApplicationResources" />
<!-- Start the Spring Web Context plugin for Struts -->
<plug-in
className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"
value="/WEB-INF/action-servlet.xml" />
</plug-in>
what could be the reason for this?
It means that the servlet identified by "action" (org.apache.struts.action.ActionServlet) failed to initialize, probably due to a configuration issue or a missing class on the class path.
There should be an exception printed in the console of your application server or in a log file. It probably will indicate what the problem is.