You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// 부모 함수 호출parent.함수명;// 부모 요소 접근$(parent.document).find('셀렉터');// 부모 오소 접근parent.document.getElementById('아이디');// 자식 요소 접근$('#iframe 아이디').contents().find('셀렉터');// 자식 요소 접근frames['아이프레임아이디'].document.getElementById('아이디');
개발자 도구(F12)
잘 활용하자 !!
console 창에서 바로 log 찍어서 해당 값 확인할 수 있음
특정 요소에 접근할 때 ..
Spring BeanUtils copyProperties
객체 복사할 때 setter 메소드로 일일이 설정하지 않아도 사용할 수 있음
설정하지 않을 property가 있으면 매개변수에 넣어줄 수 있음(가변인자)
// before
person2.setName(person1.getName());
person2.setAddress(person1.getAddress());
person2.setId(person1.getId());
person2.setPhone(person1.getPhone());
// after
BeanUtils.copyProperties(person1, person2);
publicstaticvoidcopyProperties(Objectsource, Objecttarget) throwsBeansException {
copyProperties(source, target, (Class)null, (String[])null);
}
publicstaticvoidcopyProperties(Objectsource, Objecttarget, Class<?> editable) throwsBeansException {
copyProperties(source, target, editable, (String[])null);
}
publicstaticvoidcopyProperties(Objectsource, Objecttarget, String... ignoreProperties) throwsBeansException {
copyProperties(source, target, (Class)null, ignoreProperties);
}
privatestaticvoidcopyProperties(Objectsource, Objecttarget, @NullableClass<?> editable, @NullableString... ignoreProperties) throwsBeansException {
Assert.notNull(source, "Source must not be null");
Assert.notNull(target, "Target must not be null");
Class<?> actualEditable = target.getClass();
if (editable != null) {
if (!editable.isInstance(target)) {
thrownewIllegalArgumentException("Target class [" + target.getClass().getName() + "] not assignable to Editable class [" + editable.getName() + "]");
}
actualEditable = editable;
}
PropertyDescriptor[] targetPds = getPropertyDescriptors(actualEditable);
List<String> ignoreList = ignoreProperties != null ? Arrays.asList(ignoreProperties) : null;
PropertyDescriptor[] var7 = targetPds;
intvar8 = targetPds.length;
for(intvar9 = 0; var9 < var8; ++var9) {
PropertyDescriptortargetPd = var7[var9];
MethodwriteMethod = targetPd.getWriteMethod();
if (writeMethod != null && (ignoreList == null || !ignoreList.contains(targetPd.getName()))) {
PropertyDescriptorsourcePd = getPropertyDescriptor(source.getClass(), targetPd.getName());
if (sourcePd != null) {
MethodreadMethod = sourcePd.getReadMethod();
if (readMethod != null && ClassUtils.isAssignable(writeMethod.getParameterTypes()[0], readMethod.getReturnType())) {
try {
if (!Modifier.isPublic(readMethod.getDeclaringClass().getModifiers())) {
readMethod.setAccessible(true);
}
Objectvalue = readMethod.invoke(source);
if (!Modifier.isPublic(writeMethod.getDeclaringClass().getModifiers())) {
writeMethod.setAccessible(true);
}
writeMethod.invoke(target, value);
} catch (Throwablevar15) {
thrownewFatalBeanException("Could not copy property '" + targetPd.getName() + "' from source to target", var15);
}
}
}
}
}
}
The text was updated successfully, but these errors were encountered:
iframe 부모 & 자식 접근
개발자 도구(F12)
Spring BeanUtils copyProperties
객체 복사할 때 setter 메소드로 일일이 설정하지 않아도 사용할 수 있음
설정하지 않을 property가 있으면 매개변수에 넣어줄 수 있음(가변인자)
The text was updated successfully, but these errors were encountered: