[opencms-dev] WebUser and AdditionalInfo problem...

Chris Stephens sub1 at elucid.org
Thu Jan 12 11:57:19 CET 2006


Hi folks,

I'm sure this is a newbie question but I'm having trouble storing  
AdditionalInfo against my WebUsers.

If I use CmsUser.setAdditionalInfo(keyString, valueString) to store a  
value against a user and then later in the same JSP I use  
CmsUser.getAdditionalInfo(keyString) to retrieve it then it all works  
fine. But this AdditionalInfo does not persist beyond thee context of  
the JSP.

So I added CmsObject.writeWebUser(CmsUser) to write the data away.

But this still does not persist the data!

What am I doing wrong..?

Any help much appreciated!

:)

This is my code (excerpted):

<%
CmsJspLoginBean cmsjsplogin = new CmsJspLoginBean(pageContext,  
request, response);
CmsJspActionElement cmsjspaction = new CmsJspActionElement 
( pageContext, request, response );
CmsObject cms = cmsjspaction.getCmsObject();
CmsUser user = cmsjsplogin.getUser();

//gets the request parameter (this JSP is a form that submits to  
itself. Users select things they like via checkboxes)
boolean like_ANTM2 = ("yes".equals(request.getParameter 
("like_ANTM2")) ? true : false);

if (like_ANTM2) {
	user.setAdditionalInfo("like_ANTM2","yes");
} else {
	user.setAdditionalInfo("like_ANTM2","no");
}

// is this necessary? It doesn't appear to do what I want anyway...
cms.writeWebUser(user);

%>
<html>
<head>
<title></title>
</head>
<body>
<div id="login_message">Welcome <%= cmsjsplogin.getUserName() %>!</div>
<div id="login_message">I like ANTM2: <%= user.getAdditionalInfo 
("like_ANTM2") %></div>


Thanks in advance,

Chris



More information about the opencms-dev mailing list