[opencms-dev] login.jsp was already included earlier

Uhlig, Roman Knuepfer Verlag roman.uhlig at knve.de
Thu Jul 6 12:07:43 CEST 2006


 
Hi Chris,

I'm always getting this error message when including template elements in a jsp, but forget to assign a template property to it. Since you are using a template in your jsp, this might be the cause of the error as well.

Regards,
Roman Uhlig
Knuepfer Verlag GmbH


-----Ursprüngliche Nachricht-----
Von: Christoph P. Kukulies [mailto:kuku at physik.rwth-aachen.de] 
Gesendet: Donnerstag, 6. Juli 2006 10:24
An: opencms-dev at opencms.org
Betreff: [opencms-dev] login.jsp was already included earlier

I'm caught again by this multiple inclusion problem and cannot figure out why.

I'm testing a login.html (which I click on the name for testing from within the workplace). That login.html has attached a template in /system/modules/my.frontend/pages/login.jsp

The login.jsp contains the following code (I "stole" this code piece from an earlier posting in this mailing list):

<%@ page session="false" import="java.util.*,org.opencms.jsp.*" %> <%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>

<%
// get required OpenCms objects
CmsJspLoginBean cms = new CmsJspLoginBean(pageContext, request, response);

// Check for the template
String template = cms.property("template", "search");

// Insert the template head
cms.include(template, "head"); 

// read parameters from the request
String username = request.getParameter("username"); String password = request.getParameter("password"); String action = request.getParameter("action"); String requestedResource = request.getParameter("requestedResource");

// read properties
String login_project = cms.property("login_project", "search"); String login_redirect = cms.property("login_redirect", "search");

	login_redirect = requestedResource;

// now process the login data
if ("logout".equals(action)) {
	cms.logout();
} else if ("login".equals(action)) {
	cms.login(username, password, login_project, login_redirect); } if (! cms.isLoggedIn()) { // current user is not logged in - display the login form
	String message = "The Extranet area is protected.";
	if (! cms.isLoginSuccess()) {
		// previous login attempt was not successful
		message = "Login failed, please try again:";
	}
%>
<form action="<%= cms.getFormLink()%>?requestedResource=<%=requestedResource%>" method="POST"> <table border="0" cellpadding="2" cellspacing="0"> <tr><td colspan="2"><%= message %></td><tr> <br> <br> <tr><td>Username:</td><td><input name="username" size="25" = value="<%= username!=null?username:"" %>"></td></tr> <tr><td>Password:</td><td><input name="password" size="25"
type="password"></td></tr>
<tr><td><input type="submit" value="Login"></td><td><input = type="hidden"
name="action" value="login"></td></tr>
</table>
</form>
<%
} else {
// current user is already logged in - display the logout form
	String lien = cms.link(request.getParameter("requestedResource"));
	//System.out.println("ressource redirect :" + lien); %>
<!--
	<html>
		<body>
			<form action="<%=lien%>" method="POST">
				<input type="submit" value="Voir"/>
			</form>
		</body>
	</html>
-->
<%
}
%>
<%
// Insert the template head
cms.include(template, "foot");
%>

Now I'm scratching my head why I get this "included earlier" error.


--
Chris Christoph P. U. Kukulies kukulies (at) rwth-aachen.de



More information about the opencms-dev mailing list