2013-03-28 2 views
1

pdf와 Excel을 만들 때 두 개의 버튼이있는 페이지가 있습니다. 그러나 그 중 하나만 작동합니다. 형태는 거의 동일합니다. 두 버튼을 모두 작동하게하려면 어떻게합니까? 양식에 대한 이드와 어쩌면? 자바 스크립트?두 개의 버튼이있는 양식, 단 하나만 작동합니다.

<portlet:actionURL var="createExcel"> 
<portlet:param name="action" value="createExcelorConstrainSearch" /> 
</portlet:actionURL> 
<portlet:actionURL var="createPdf"> 
<portlet:param name="action" value="createPDForConstrainSearch" /> 
</portlet:actionURL> 

<form:form commandName="tg35FormBackingModel" action="${createExcel}" method="post"> 
<form:form commandName="tg35FormBackingModel" action="${createPdf}" method="post"> 
<div> 
<table> 
<tr> 

는 ....

</form:form> 
</form:form> 

<button type="submit" name="PDF"></button> 
<button type="submit" name="EXCEL"></button> 
+1

양식을 중첩하지 않고 각 양식 안에 하나의 버튼을 넣으십시오. – DavidA

+0

정말 같은 형태이며, 다른 동작과 다른 버튼 만 있습니다. – brbe24

답변

0

당신은 그들에게 작업 (하지만 한 번에) 모두를 만들 것입니다 형태에 name 속성을 추가 할 수 있습니다. 양식 데이터와 함께 전송 된 name 값을 읽음으로써 어느 것이 서버 측에서 눌러 졌는지 확인할 수 있습니다.

+0

이름 값을 어떻게 읽습니까? – brbe24

+0

이렇게 :'request.getParameter ("name"))','name'은 버튼의'name' 속성의 값입니다. –

+0

나는 이미 if (request.getParameter ("EXCEL")! = null)을 가지고 있지만, 아마도 폼에 같은 이름이 필요합니까? – brbe24

관련 문제