Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alternative way for custom TextProvider #18

Merged
merged 2 commits into from
Oct 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
import com.opensymphony.xwork2.TextProvider;

import java.util.ResourceBundle;

/**
* Exdending the TextProviderFactory is optional, as Factory return the TextProvider class it gets as argument.
* See struts.xml for example configuration without extending TextProviderFactory.
*/
public class MyTextProviderFactory extends StrutsTextProviderFactory {

@Override
Expand Down
16 changes: 13 additions & 3 deletions text-provider/src/main/resources/struts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,20 @@
<bean type="com.opensymphony.xwork2.TextProviderFactory"
class="org.apache.struts_example.MyTextProviderFactory"
name="myTextProviderFactory"
scope="singleton"/>

scope="singleton"/>
<constant name="struts.textProviderFactory" value="myTextProviderFactory"/>


<!--
Alternatively, if you prefer to extend only TextProviderSupport,
you can define the custrom TextProvider like this (see Struts v2.5.10 TextProvider Javadocs):
-->
<!--
<bean class="com.company.MyTextProviderSupport" name="MyTextProviderSupport"
type="com.opensymphony.xwork2.TextProvider" />
<constant name="struts.xworkTextProvider" value="MyTextProviderSupport" />
-->

<package name="default" extends="struts-default">

<default-action-ref name="index"/>
Expand Down