I've a little issue to propose.
I've defined in Spring a bean named EnvParam. I've passed this bean in my report processed by Jasper, using an hashmap of parameters.
In Jasper XML I've mapped my bean with import tag in this way:
<import value="Mypath.EnvParam" />
After that I want to point my bean properties in GUI elements.
So, I've defined in Jasper some variables in this way:
varDummy = $P{EnvParam}.myProperty
so in my GUI element I've that link $V{varDummy}.
When I run my application my report doesn't show the correct value of property, setting NULL in my GUI.
But if I put in my GUI object my property $P{EnvParam}.myProperty without using of variable the value will show correctly.
I've resolved my issue, changing the procession time of variable, put the value as "REPORT"
The default the value has set on "NOW" (I think - in italian, version used the value named "ADESSO")
Related
I have an xml file that contains values that define a java object, the values are processed via a java method to handle some specific tasks, the xml file has the below architecture :
<javaObject>
<attr1>value1</attr1>
<attr2>${property.name}</attr2>
<attr3>value3</attr3>
</javaObject>
My goal is to get the attr2 from the property file, I've tried ${property.name} but it's not working, I've also tried
<property name="property.name" value="${property.name} />
At runtime, I get a NULL when I call the value of attr2
What is the best way to implement that ?
If I understand your question correctly, you unmarshal the object and want to work with the value of proeprty.name?
You can inject the value of property.name in your class via
#Value("${property.name}")
String propertyName
I have a property set to "true", that I want to bind to my checkStatus field.
#Value("${prop.checkstatus}")
private boolean checkStatus;
I am able to access the value from inside an #Service class. However, if I use #Value inside a class that I instantiate or retrieve using AppliationContext.getBean("classA"), the value is always "false" since it cannot get the correct value from the property file. Please advise as I need to access this value from an instance and from a bean.
In some parts of the code, I create the object using new and try to access #Value. I understand that this is not possible since the new object is not managed by spring. But there are parts of the code where the object is retrieved using applicationcontext. Still I cannot access the #Value. Is there a better approach in retrieving #Value both for objects created using new and applicationcontext.getbean?
I have a form made with fxml, it has like 20 fields. (I.e. Person) and I have my controller with the 20 fields (one for every field) o want to know if there is a way to box all these fields in a unique bean like PersonBean. Actually I have to set all the fields to the bean manually in the initialize method.
Something like in the Id of the fxml input put something like "person.name".
Not 100% sure but try something like:
text="${controller.person.name}"
where person is a property of the controller and name is a property of PersonBean.
See:
http://docs.oracle.com/javafx/2/api/javafx/fxml/doc-files/introduction_to_fxml.html#expression_binding
Binding a Label's text property (in an FXML file) to an IntegerProperty (in a controller)
You might need to provide JavaFX properties such as
ObjectProperty<PersonBean> personProperty();
StringProperty nameProperty();
but maybe there is also some support for plain JavaBeans properties.
I am working on a project which made use of an old (but nice) framework Struts 1.3, and I am trying to accomplish a simple task.
I have a bean containing a property, which is a key corresponding to a property file. I would like to use it for recall the appropriate translation.
Variable in property file
props.myprop.sample=This is my sample property
The property is in a bean passed to the jsp called for convenience AllProps which has a getter for the property, and this should be a pseudo code:
<bean:define id="sample" name="AllProps" property="sample" type="java.lang.String"/> // should result in sample = props.myprop.sample
<div><bean:message key="sample"/></div>
Which should output:
<div>This is my sample property</div>
But obviously result in a property not found, can you give me help on how to deal with this ?
I would like to stick as much as possible to Struts tag, then Jsp tag, and scriptlet as last resource.
Thanks
Straight from the documentation:
<bean:message>
Render an internationalized message string to the response.
Retrieves an internationalized message for the specified locale, using
the specified message key, and write it to the output stream. Up to
five parametric replacements (such as "{0}") may be specified.
The message key may be specified directly, using the key attribute, or
indirectly, using the name and property attributes to obtain it from a
bean.
(emphasis mine)
So, all you need is
<bean:message name="AllProps" property="sample"/>
JSF 1.1, using a backing bean with a nested objects inside I can read all properties of the nested object.
For example assuming a backing bean named "foo" with a nested object "bar" can I set/write via h:form all the properties of foo.bar?
I mean something like this:
f:view
h:form
h:inputText value="#{myBean.mySelectedReport.someProp}" /
and this in the backing bean:
public SomeObject getMySelectedReport() {...}
but when I sent it to the correct backing bean it doesn't store the value of the someProp value
Nice, I can answer by myself as I solved by myself:
if useful for others having the same problem the problem is the JSF 1.1 wildcard on "from-view-id", for example "/ajax/uiChannel*" match only pages without any query params into the "from url",
only this one "/ajax/uiChannel.jsp?*" and "/ajax/uiChannel*?*" wildcard seems to work