intellij - bind jcombobox to arraylist - swing

I am using intellij and I have an arraylist which I want to display its toStirng.
I want to accomplish the following
1. iterate through its value and get the object value,
2. when changed - get the object not only the string
will I have to mark the custom create in intellij and to create it myself ?
thanks.

Yes, using Custom create property is the preferred way for such cases.

Related

Hide JsonValue from log file using <flter-spec>

I'am trying to hide the Json value of the student field from log files using filter-spec,
this is my filter-spec :
after i applied the flter this is how the data is showing in the log file
all i want it is to replace ("student" : "testStudent") with ("student": "****") instead it is got replaced with ("student: ****)
does anyone have an example on how to hide the json value using filter-spec?
Thanks in advance
It is not actually possible replace a JSON value with a filter. You'd need to use a custom filter or custom handler in order to do this.
You could file a feature request though. It does seem like a decent idea for a filter to be able to filter values in structured formats.

Concat old value with new data in MySQL using Spring MVC

I have an application in which I have to implement a function that concats old data in a column with the new data in the same column. The data is managed by DTO. At present the functionality deletes the old value and sets the new value by getter and setter methods. How can I change it so that I get the required functionality? Thanks in advance!
Give a try with below query.
update t set data=concat(data, 'a');
For example current value is apple so after above query the new value will be applea
Refer : this

Using a variable in multiple views

I'm working with flash builder (flex) and wanna assign value to a variable in a view and use that variable in other views.
but the problem is when i define for example an array in one view it's undefined in other views and i cant use value of that variable in my functions.
whats the solution?
You have to create a reference the view which has your variable in the other view .
Make sure that your variable is public and bindable.

insert a date field mysql, struts2 spring hibernate

I'm working on a project using spring hibernate struts2 framework and MySQL database, I have a problem when I wanted to add a field of type Date
does not work, it means when I try to insert a Date field, it sends me this error:
WARNING: Error setting value
ognl.MethodFailedException: Method "setDATE_PANNE" failed for object model.Panne # 1d055e2 [java.lang.NoSuchMethodException: setDATE_PANNE ([Ljava.lang.String;)]
/ - Encapsulated exception ------------ \
java.lang.NoSuchMethodException: setDATE_PANNE ([Ljava.lang.String;)
NB: (DATE_PANNE -> this is the date fields) and setDATE_PANNE is the setter for this attribute. DATE_PANNE is of type date
apparently the problem is that struts2 has taken my Date as a String thing that he should not do.
I do not know how to convert and where?
I have recently been working with struts 2 and have run into this ognl Exception a few times. It seems to happen when you have a control on a JSP, such as an input checkbox named "checkBox", and a method from your controller (java class, not JSP) similarly named "setCheckBox()". Somehow, behind the scenes, struts 2 or Ognl is generating a naming conflict and is unable to execute the correct method. Simply renaming either the control on the JSP (from my example from "checkBox" to "checkBox1") or renaming the method from the controller should solve your issue. Let me know if I did not elaborate enough. Hope this helps.
Regards,
Nick

JDBC update of different fields

I'm developing Web Service that has access to database via JDBC. I'm using DAO pattern. I've implemented all necessary methods: findAll, add, update, delete. But I got confused with update method. It has Object as input parameter. But how does he know which field needs to be updated. For example, I need to update field 'name' I use query 'update table set name='smth where id=2' but if I need to update 'surname'?? what is the best practice to tell update method what actually to update?
thank you
You'll need to change your method signature to include a Map of column names and values.
public interface FooDao<K, V> {
// other methods here, of course.
public void update(V target, Map<String, Object> parameters);
}
Have a look at the Spring JDBC template for a nice example of how to design and implement such a thing.