JSF multiple forms in one view

C

christian.lernt

Hi!

Does somebody knows what I'm doing wrong here?

Look at this very basic example:

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test multiple forms</title>
</head>
<body>
<f:view>
<h:form>
<h:eek:utputText value="Field 1: " />
<h:inputText value="#{testMultiform.field1}" /><br>
<h:eek:utputText value="Field 2: " />
<h:inputText value="#{testMultiform.field2}" />
<br>
<h:commandLink value="Test form 1"
action="#{testMultiform.executeForm1}">
</h:commandLink>
</h:form>
<c:import url="footer.jsp"/>
</f:view>
</body>
</html>

and the imported file (footer.jsp) looks like this:

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>

<f:subview id="footer">
<h:form>
<h:commandLink value="Test form 2" action="exe2">
</h:commandLink>
</h:form>
</f:subview>

The example uses two forms components (one included with the c:import
JSTL command), each with a commandLink component. I know that JSF
permits two forms in a view. However the second commandLink, inside the
second form component, is ignored. Could somebody say me the reason?

Thanks!

Christian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top