|
jforum example source code file (Delete.jsp)
The jforum Delete.jsp source code<%@ page import="org.apache.log4j.*" %> <%@ page import="com.ecyrd.jspwiki.*" %> <%@ page import="java.util.*" %> <%@ page errorPage="/Error.jsp" %> <%@ taglib uri="/WEB-INF/jspwiki.tld" prefix="wiki" %> <%! public void jspInit() { wiki = WikiEngine.getInstance( getServletConfig() ); } Logger log = Logger.getLogger("JSPWiki"); WikiEngine wiki; %> <% // Create wiki context and check for authorization WikiContext wikiContext = wiki.createContext( request, WikiContext.DELETE ); if(!wikiContext.hasAccess( response )) return; String pagereq = wikiContext.getName(); WikiPage wikipage = wikiContext.getPage(); WikiPage latestversion = wiki.getPage( pagereq ); String delete = request.getParameter( "delete" ); String deleteall = request.getParameter( "delete-all" ); if( latestversion == null ) { latestversion = wikiContext.getPage(); } if( deleteall != null ) { log.info("Deleting page "+pagereq+". User="+request.getRemoteUser()+", host="+request.getRemoteAddr() ); wiki.deletePage( pagereq ); response.sendRedirect(wiki.getViewURL(pagereq)); return; } else if( delete != null ) { log.info("Deleting a range of pages from "+pagereq); for( Enumeration params = request.getParameterNames(); params.hasMoreElements(); ) { String paramName = (String)params.nextElement(); if( paramName.startsWith("delver") ) { int version = Integer.parseInt( paramName.substring(7) ); WikiPage p = wiki.getPage( pagereq, version ); log.debug("Deleting version "+version); wiki.deleteVersion( p ); } } response.sendRedirect(wiki.getURL( WikiContext.INFO, pagereq, null, false )); return; } // Set the content type and include the response content // FIXME: not so. response.setContentType("text/html; charset="+wiki.getContentEncoding() ); String contentPage = wiki.getTemplateManager().findJSP( pageContext, wikiContext.getTemplate(), "EditTemplate.jsp" ); %><wiki:Include page="<%=contentPage%>" /> Other jforum examples (source code examples)Here is a short list of links related to this jforum Delete.jsp source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
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.