<%@ page import="org.apache.log4j.*" %> <%@ page import="com.ecyrd.jspwiki.*" %> <%! public void jspInit() { wiki = WikiEngine.getInstance( getServletConfig() ); } Category log = Category.getInstance("JSPWiki"); WikiEngine wiki; %> <% String pagereq = "UserPreferences"; String headerTitle = ""; NDC.push( wiki.getApplicationName()+":"+pagereq ); String userName = wiki.getUserName( request ); if( userName == null ) { userName=""; } String ok = request.getParameter("ok"); String clear = request.getParameter("clear"); if( ok != null || "save".equals(request.getParameter("action")) ) { // // Servlet 2.2 API assumes all incoming data is in ISO-8859-1, so when // returning UTF-8, you get the right bytes but with the wrong encoding. // // For more information, see: // http://www.jguru.com/faq/view.jsp?EID=137049 // String name; name = new String( request.getParameter("username").getBytes("ISO-8859-1"), "UTF-8"); UserProfile profile = new UserProfile(); profile.setName( name ); Cookie prefs = new Cookie( WikiEngine.PREFS_COOKIE_NAME, profile.getStringRepresentation() ); prefs.setMaxAge( 90*24*60*60 ); // 90 days is default. response.addCookie( prefs ); response.sendRedirect( wiki.getBaseURL()+"Wiki.jsp" ); } else if( clear != null ) { Cookie prefs = new Cookie( WikiEngine.PREFS_COOKIE_NAME, "" ); prefs.setMaxAge( 0 ); response.addCookie( prefs ); // FIXME: Should really redirect to some other place, like this page. response.sendRedirect( wiki.getBaseURL()+"Wiki.jsp" ); } response.setContentType("text/html; charset="+wiki.getContentEncoding() ); %> <%=wiki.getApplicationName()%>: User Preferences <%@ include file="cssinclude.js" %>
<%@ include file="LeftMenu.jsp" %>

<%@ include file="LeftMenuFooter.jsp" %>

<%@ include file="PageHeader.jsp" %>

This is a page which allows you to set up all sorts of interesting things. You need to have cookies enabled for this to work, though.

User name: This must be a proper WikiName, no punctuation.


Removing your preferences

In some cases, you may need to remove the above preferences from the computer. Click the button below to do that. Note that it will remove all preferences you've set up, permanently. You will need to enter them again.

<% NDC.pop(); NDC.remove(); %>