In the properties-local.xml file, I've created some properties. These properties are used to form the URL to where the form data will be sent. The properties are as follows:
<property as="xs:string" name="streamlyne.protocol">http</property>
<property as="xs:string" name="streamlyne.username">uname</property>
<property as="xs:string" name="streamlyne.pass">gesundheit</property>
<property as="xs:string" name="streamlyne.host">127.0.0.1:8090</property>
<property as="xs:string" name="streamlyne.api.path">ekualiti-kc/remoting/api/orbeonforms</property>
<property as="xs:string" name="streamlyne.api.action">saveFormData</property>
The send property is as follows:
<property as="xs:string" name="oxf.fr.detail.process.save-draft.S2S_Forms.*">
save
then send(
uri = "{xxf:property('streamlyne.protocol')}://{xxf:property('streamlyne.username')}:{xxf:property('streamlyne.pass')}#{xxf:property('streamlyne.host')}/{xxf:property('streamlyne.api.path')}/{xxf:property('streamlyne.api.action')}/{xxf:get-request-parameter('propsalID')}",
replace = "none",
method = "post",
content = "xml",
annotate = "id"
)
then success-message("save-success")
recover error-message("save-error")
</property>
The above configuration worked fine.
ISSUE:
I wanted to give the name of the password property as streamlyne.password. When I tried doing so, the save action failed. So I changed the name to streamlyne.password1. It failed again. Is there any convention, not to put the literal password in a property name attribute? I know this sounds silly. But I'm quite sure renaming the property name to pass worked pretty well!
Indeed, xxf:property() doesn't return the value properties that contains the string "password". This is done on purpose to prevent form authors from accessing the value of properties you want Orbeon Forms to know about, but you wouldn't necessarily want form authors to know about, say oxf.http.ssl.keystore.password.
So in your case, I'd just recommend using another name (say pass as you suggested, or secret).
Related
Is it possible to use a URL parameter as a property binding in UI5?
My problem is that I want to have different OData collections placed in the same UI5 aggregation. For example let's say I've "/Car("Mustang")/parts" and "/Car("Whatever")/parts". Both of them can be placed in the same view.
The application's URL contains the keyword like http://something/#/carMustang. This URL is coming from a routing pattern like "car{carHandle}".
How am I supposed to do stuff like this:
<List items="{/Car({carHandle})/parts}">
<StandardListItem title={someProperty}>
</StandardListItem>
</List>
So what would be the best practice to do this? I would like to avoid nasty fiddles in the controller.
In your view:
<List id="parts" items="{parts}">
<StandardListItem title="{someProperty}"/>
</List>
In your controller code which reacts on matched routes:
var carHandle = event.getParameter("carHandle");
this.byId("parts").bindObject("/Car/" + carHandle);
In Struts2 you can populate a label for a component with a value from a properties file. The properties file must have the same name as the Struts2 Action Class that will serve up the JSP and be in the same folder as that Action Class.
<s:textfield key="field.label.casereference" name="caseReference" />
I want to do the same thing with a displaytag column. But it doesn't seem to work.
Columns in displaytag have an attribute called titleKey that is suppose to let you do this. But it doesn't seem to work.
<display:table class="displaytag" id="Table2" name="getResultlistCases" clearStatus="true" requestURI="/AbsHearingSrALJ_homePage.action">
<display:column style="width:8%;" property="aljNum" titleKey="field.label.aljNumber" />
<display:column style="width:9%;" property="location" titleKey="field.label.location" />
<display:column style="width:10%;" property="caseName" titleKey="field.label.caseName" />
<display:column style="width:25%;" property="scheduledTime" titleKey="field.label.scheduledTime" />
The titleKey field is not getting the value from the properties file. It works when I use the key field of a Struts2 textfield, but not with a column's titleKey field for displaytag.
Does anyone know if it is possible to get this to work?
Displaytag provides an interface I18nResourceProvider with a few ready
to use implementations which match the behaviour of common frameworks.
This is configured in displaytag.properties using the locale.provider
key. By default the JSTL implementation is used.
And in org.displaytag.localization.I18nJstlAdapter description:
It will make the titleKey attribute of column tag works the same as
fmt:message's key property. This tag must be the descendant of a
fmt:bundle tag in order to use the titleKey.
So you should use following approach (I tested - it worked):
<fmt:bundle basename="action.HelloWorld">
<display:table name="test">
<display:column property="aljNum" titleKey="field.label.aljNumber" />
</display:table>
</fmt:bundle>
Remember also that "basename" in fmt:bundle is a fully-qualified resource name without ".properties" extension.
I need receive two string parameters in loadUserByUsername method. I do not want to use spring security authentication, for this a have my own implementation that needs password too (It´s a integration system).
Is it possible create another method with the same name loadUserByUsername(String username, String password) in the same class, and call that method instead another one ?
I don't understand this requirement but UserDetailsService.loadUserByUsername(String) is just fine. At the time this method is invoked the user is already authenticated and hence the password is not needed anymore. So, if you need a password at that point there's a fair chance you're doing something wrong.
If you want to implement your own authentication mechanism based on username & password you need to provide your own AuthenticationProvider.
<security:authentication-manager alias="authenticationManager">
<security:authentication-provider ref="yourProvider" />
</security:authentication-manager>
<bean id="yourProvider" class="package.yourProviderClass">
<!-- I suppose you need this, too -->
<property name="userDetailsService" ref="yourUserDetailsService" />
</bean>
Have a look at the existing implementations and find the one that most closely offers what you need.
I have a Action class with few fields (String, int etc) + instance of User class (userBean) inside it. If I want to validate field values I can do it using validation framework, but if I want to validate "userBean.username" from User class how can I do that using validation framework?
Tried below but did not work
<field name="userBean.username">
<field-validator type="requiredstring">
<param name="trim">true</param>
<message key="errors.required" />
</field-validator>
</field>
Thanks in advance
You need to validate the inputs of a form, you can't use it this way. The validation framework kicks in before the action treats the request (see interceptors), that's why you can't do what you're doing. So regarding your question, you need to put the actual field name which matches your username and then set its value to your UserBean instance.
If you need more infos, just check the official doc.
I want to assign the value from field Description to a hidden field test.
But the problem is the "Description" contains sequence of words and the following code is assigning only first word to "test"
<s:hidden value=<s:property value="Description" /> name="test">
I am kind of new to struts. Can someone please help.
Also it would be nice if i get to know good tutorial links of struts2.
If this is a property in your action class you need not to use <s:property value="Description" /> as the Description will be available at the top of value stack and you can use OGNL to fetch the value from value-stack.This is what you need to do
<s:hidden value="%{description}" name="test" />
Please make sure the value in hidden filed should be similar to the name of property in your action class as it will be resolved to either the getter and setter in your action class or the public property defined in your action.
So this means value="%{description}" will be converted by OGNL like getDescription() and will try to find the getter in your action class to fetch the property value.
<s:hidden value="%{description}" name="test" />