[opencms-dev] Webuser vs. User

Christoph P. Kukulies kuku at physik.rwth-aachen.de
Sun Jun 18 18:05:04 CEST 2006


What is the difference between a Webuser and a User in OpenCms?

How do I retrieve the name of the currently logged in user?
What ist the parameter name (username or user?)
Where is it documented?

The following code snippet always returns "null" as username.
I can try getParameter("username") to no avail as well.

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

<jsp:useBean id="loginBean" class="org.opencms.jsp.CmsJspLoginBean">
<% 
   loginBean.init(pageContext,request,response);
   if(request.getParameter("user")!= null){
      loginBean.login(request.getParameter("user"),request.getParameter("password"),null,
                      request.getParameter("requestedResource"));

   }
%>
</jsp:useBean>
<cms:include property="template-elements" element="head" />
<cms:include element="titel" />
<%
   String username=request.getParameter("user");
   out.write("<font color=\"red\">"+username+"</font>");
   if(!loginBean.isLoggedIn()){
      if(!loginBean.isLoginSuccess()){
         out.write("login failed!");
      }
%>
      <form method="GET">
      <input type="hidden" name="requestedResource" value="<%= request.getParameter("requestedResource")%>">
      <input name="username" value="<%=(username!=null)?username:"" %>">
      <input name="password" type="password">
      <input type="submit" value="Login">
      </form> 
  
<%     
   } else {
      out.write("You are logged in as <b>"+username+"</b>");
     }
%>
 

<cms:include property="template-elements" element="foot" />
--
Chris Christoph P. U. Kukulies kukulies (at) rwth-aachen.de



More information about the opencms-dev mailing list