<%-- <%@ page import="org.thdl.lex.*,org.thdl.lex.component.*" errorPage="/jsp/error.jsp" %> --%>
<%@ page import="org.thdl.lex.*,org.thdl.lex.component.*" %><%@ page import="java.util.HashMap" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%-- <%@ taglib prefix="input" uri="http://jakarta.apache.org/taglibs/input-1.0" %> --%>
<!--functionForm.jsf-->
<c:out value='<a name="${ component }" ></a>' escapeXml="false" />
<c:choose>
	<c:when test="${ ! empty param.formMode && param.formMode == 'insert'}">
		<c:set var="updateMode" value="${ false }" />		
		<c:set var="newCmd" value="insert" />
		<c:set var="function" value="0" />
		<c:set var="id" value="" />
		<c:set var="note" value="" />
	</c:when>
	<c:when test="${ ! empty param.formMode && param.formMode == 'update'}">
		<c:set var="updateMode" value="${ true }" />		
		<c:set var="newCmd" value="update" />
		<c:set var="function" value="${ component.function }" />
		<c:set var="id" value="${ component.id }" />
		<c:set var="note" value="${ component.note }" />
	</c:when>
	<c:otherwise>
		<c:set var="updateMode" value="${ false }" />		
		<c:set var="newCmd" value="" />
		<c:set var="function" value="ERROR" />
		<c:set var="id" value="" />
		<c:set var="note" value="ERROR" />
	</c:otherwise>
</c:choose>

<form id="newCompForm" action="/lex/action" method="post">
<p>
<input type="hidden" name="comp" value="function" />
<c:if test="${ updateMode }">
<c:out value='<input type="hidden" name="id" value="${id}" />' escapeXml="false" />
</c:if>
<c:out value='<input type="hidden" name="cmd" value="${newCmd}" />' escapeXml='false' />
<c:out value='<input type="hidden" name="parentId" value="${ param.parentId }" />' escapeXml='false' />

Grammatical Function: 
<select name="function">
	<c:forEach var="funcTypes" items="${ applicationScope.flatData.functionsGeneral }" >
		<c:set var="sel" value="" />
		<c:if test="${ funcTypes.key == function }">
			<c:set var="sel" value="selected='selected'" />
		</c:if>
		<c:out value="<option value='${ funcTypes.key }' ${sel}>${ funcTypes.value }</option>" escapeXml="false" /> <br />
	</c:forEach>
</select>

<br />
<jsp:include page="metaForm.jsf" />

<input type="submit" value="Submit Grammatical Function" />
</p>
</form>
