alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

jforum example source code file (PreferencesContent.jsp)

This example jforum source code file (PreferencesContent.jsp) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - jforum tags/keywords

could, if, post, post, set, string, tab, this, this, utf-8, utf-8, you, you, your

The jforum PreferencesContent.jsp source code

<%@ taglib uri="/WEB-INF/jspwiki.tld" prefix="wiki" %>
<%@ page errorPage="/Error.jsp" %>
<%@ page import="com.ecyrd.jspwiki.*" %>
<%
  //  Determine the name for the user's favorites page
  WikiContext c = WikiContext.findContext( pageContext );
  String pagename = c.getName();
  String username = null;
 
  username = c.getEngine().getVariable( c, "username" );
  if( username == null ) username = "";

  String myFav = username + "Favorites";
%>

<h3>Your  profile

<wiki:TabbedSection defaultTab='<%=request.getParameter("tab")%>'>
  <!-- Tab 1: user preferences -->
  <wiki:Tab id="prefs" title="Preferences">
    <div class="formcontainer">
      <div class="instructions">
        Set your user preferences here. Your choices will be saved in your browser as cookies.
      </div>
    </div>
    <wiki:Permission permission="editPreferences">
      <wiki:UserCheck status="anonymous">
        <div class="formcontainer">
          <div class="instructions">
            <wiki:Messages div="error" topic="prefs" prefix="Could not save prefs: "/>
          </div>
          <form id="setCookie" action="" 
                method="POST" accept-charset="UTF-8">
            <div class="block">
              <label>Wiki name
              <input type="text" name="assertedName" size="30" value="
              <div class="description">
                Your wiki name. If you haven't created a user profile
                yet, you can tell <wiki:Variable var="applicationname" /> 
                who you are by 'asserting' an identity. You wouldn't
                lie to us would you?
              </div>
              <div class="description">
                Note that setting your user name this way isn't a
                particularly trustworthy method of authentication, 
                and the wiki may grant you fewer privileges as a
                result. <a onclick="TabbedSection.onclick('profile')" >
                Create a user profile</a> if you'd prefer a
                traditional username and password, which is more
                secure.
              </div>
              <input type="submit" name="ok" value="Set user name" />
              <input type="hidden" name="action" value="setAssertedName" />
            </div>
          </form>
        </div>
      </wiki:UserCheck>
      
      <!-- Clearing the 'asserted name' cookie -->
      <wiki:UserCheck status="asserted">
        <div class="formcontainer">
          <form id="clearCookie" action=""
                method="POST" accept-charset="UTF-8">
            <div class="block">
              <div class="description">
                Clears your 'asserted' user name.
              </div>
              <input type="submit" name="ok" value="Clear user name" />
              <input type="hidden" name="action" value="clearAssertedName" />
            </div>
          </form>
          <form action="" method="GET">
             <div class="block">
              <div class="description">
                 You may set your personal Favourites list which will appear in the navigation menu.
              </div>
              <input type="submit" name="ok" value="Edit or create your personal favourites"/>
             </div>
          </form>
        </div>
      </wiki:UserCheck>
    </wiki:Permission>
  </wiki:Tab>
  
  <!-- Tab 2: If user can register, allow edits to profile -->
  <wiki:Tab id="profile" title="Profile">
    <wiki:Permission permission="editProfile">
      <div class="formcontainer">
        <div class="instructions">
          <wiki:UserProfile property="new">
            Hi! Looks like you haven't set up a wiki profile yet.
            You can do that here. To set up your profile, we need
            to know a little bit about you.
          </wiki:UserProfile>
          <wiki:UserProfile property="exists">
            Edit your wiki profile here.
          </wiki:UserProfile>
        </div>
        <div class="instructions">
          <wiki:Messages div="error" topic="profile" prefix="Could not save profile: "/>
        </div>
        <form id="editProfile" action="" 
              method="POST" accept-charset="UTF-8">
              
          <!-- Login name -->
          <div class="block">
            <label>Login name
            <wiki:UserProfile property="new">
              <input type="text" name="loginname" size="30" value="
              <div class="description">
                This is your login id; once set, it cannot be changed.
              </div>
            </wiki:UserProfile>
            <wiki:UserProfile property="exists">
              <p>

<div class="description"> This is your login id. </div> </wiki:UserProfile> </div> <!-- Password; not displayed if container auth used --> <wiki:UserCheck status="setPassword"> <div class="block"> <label>Password <input type="password" name="password" size="30" value="" /> <div class="description"> Sets your account password. It may not be blank. </div> </div> <div class="block"> <label>Password (re-type) <input type="password" name="password2" size="30" value="" /> <div class="description"> Type your password again. </div> </div> </wiki:UserCheck> <!-- Wiki name --> <div class="block"> <label>Wiki name <wiki:UserProfile property="new"> <input type="text" name="wikiname" size="30" value=" <div class="description"> This must be a proper WikiName; cannot contain spaces or punctuation. </div> </wiki:UserProfile> <wiki:UserProfile property="exists"> <p>

<div class="description"> This is your WikiName. </div> </wiki:UserProfile> </div> <!-- Full name --> <div class="block"> <label>Full name <wiki:UserProfile property="new"> <input type="text" name="fullname" size="30" value=" <div class="description"> This is your full name. </div> </wiki:UserProfile> <wiki:UserProfile property="exists"> <p>

<div class="description"> This is your full name. </div> </wiki:UserProfile> </div> <!-- E-mail --> <div class="block"> <label>E-mail address <input type="text" name="email" size="30" value=" <div class="description"> Your e-mail address is optional. If you lose your password, you can ask to have a new, random password sent to this address. </div> </div> <div class="block"> <wiki:UserCheck status="assertionsAllowed"> <div class="instructions"> This wiki automatically remembers you using cookies, without requiring additional authentication. To use this feature, your browser must accept cookies from this website. When you click 'save profile,' the cookie will be saved by your browser. </div> </wiki:UserCheck> <wiki:UserProfile property="exists"> <div class="instructions"> Access control lists or wiki groups containing your identity should specify <strong> or <strong>. You are also a member of these roles: <strong>, and the following groups: <strong>. ACLs containing these roles and groups should work, too. </div> </wiki:UserProfile> <div class="instructions"> <wiki:UserProfile property="exists"> You created your profile on <wiki:UserProfile property="created"/>, and last saved it on <wiki:UserProfile property="modified"/> </wiki:UserProfile> Click 'save profile' to save your wiki profile. </div> <input type="submit" name="ok" value="Save profile" /> <input type="hidden" name="action" value="saveProfile" /> </div> </form> </div> </wiki:Permission> </wiki:Tab> </wiki:TabbedSection>

Other jforum examples (source code examples)

Here is a short list of links related to this jforum PreferencesContent.jsp source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.