나는 다음과 같은 파일이 있습니다단추로 숨겨진 속성에 값을 설정하는 방법은 무엇입니까?
class MyForm {
private boolean boo;
public void setBoo(boolean boo){
this.boo = boo;
}
public boolean getBoo(){
return this.boo;
}
}
MyFooAction.java
public class MyFooAction extends BaseAction {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
ActionForward aForward = null;
String forward = "success";
try {
MyForm myForm = (MyForm) form;
String boo = (String)request.getParameter("boo");
if(boo.equals("true")){
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>DONE");
}
else {
//some code here
}
aForward = mapping.findForward(forward);
}
catch (Exception e) {
throw new Exception();
}
return aForward;
}
}
문제는 방법에 changeBoo()
을 구현하는 것입니다
을 View.jsp
<@ page import=...
<bean:define id="mForm" name="myForm" type="MyForm"/>
<html:form action="MyFoo" method="post" styleId="myForm" enctype="multipart/form-data">
<html:hidden property="boo"/>
<input type="button" value="Press me" onclick="javascript:changeBoo()"/>
</html:form>
MyForm.java을 자바 스크립트를 변경하려면 e 값이 boo
이고 정확한 값이 boo
인 MyFooAction
을 호출 하시겠습니까?
감사합니다 :)하지만 이드는 필요하지 않습니다. 그것 없이는 모든 것이 잘 작동합니다. 오류 : 속성 : id가 유효한 속성 이름이 아닙니다. –