Example usage for javax.servlet.jsp JspWriter print

List of usage examples for javax.servlet.jsp JspWriter print

Introduction

In this page you can find the example usage for javax.servlet.jsp JspWriter print.

Prototype


abstract public void print(Object obj) throws IOException;

Source Link

Document

Print an object.

Usage

From source file:dk.netarkivet.archive.webinterface.BitpreserveFileState.java

/**
 * Print a table row with a file name and a checkbox to request more info.
 *
 * @param out The stream to print to./*from w w  w  . j a  va 2  s  .  c  om*/
 * @param filename The name of the file.
 * @param rowCount The rowcount, used for styling rows.
 * @param locale The current locale for labels.
 * @throws IOException On trouble writing to stream.
 */
public static void printFileName(JspWriter out, String filename, int rowCount, Locale locale)
        throws IOException {
    ArgumentNotValid.checkNotNull(out, "JspWriter out");
    ArgumentNotValid.checkNotNullOrEmpty(filename, "String filename");
    ArgumentNotValid.checkNotNull(locale, "Locale locale");
    out.println("<tr class=\"" + HTMLUtils.getRowClass(rowCount) + "\">");
    out.println(HTMLUtils.makeTableElement(filename));
    out.print("<td>");
    out.print(makeCheckbox(Constants.GET_INFO_COMMAND, filename));
    out.print(I18N.getString(locale, "get.info"));
    out.println("</td>");
    out.println("</tr>");
}

From source file:org.apache.hadoop.hdfs.server.datanode.DatanodeJspHelper.java

static void generateDirectoryStructure(JspWriter out, HttpServletRequest req, HttpServletResponse resp,
        Configuration conf) throws IOException, InterruptedException {
    final String dir = JspHelper.validatePath(StringEscapeUtils.unescapeHtml(req.getParameter("dir")));
    if (dir == null) {
        out.print("Invalid input");
        return;/* w  w  w .  j a va 2s.c  o  m*/
    }
    String tokenString = req.getParameter(JspHelper.DELEGATION_PARAMETER_NAME);
    UserGroupInformation ugi = JspHelper.getUGI(req, conf);
    String namenodeInfoPortStr = req.getParameter("namenodeInfoPort");
    int namenodeInfoPort = -1;
    if (namenodeInfoPortStr != null)
        namenodeInfoPort = Integer.parseInt(namenodeInfoPortStr);
    final String nnAddr = req.getParameter(JspHelper.NAMENODE_ADDRESS);
    if (nnAddr == null) {
        out.print(JspHelper.NAMENODE_ADDRESS + " url param is null");
        return;
    }

    DFSClient dfs = getDFSClient(ugi, nnAddr, conf);
    String target = dir;
    final HdfsFileStatus targetStatus = dfs.getFileInfo(target);
    if (targetStatus == null) { // not exists
        out.print("<h3>File or directory : " + StringEscapeUtils.escapeHtml(target) + " does not exist</h3>");
        JspHelper.printGotoForm(out, namenodeInfoPort, tokenString, target, nnAddr);
    } else {
        if (!targetStatus.isDir()) { // a file
            List<LocatedBlock> blocks = dfs.getNamenode().getBlockLocations(dir, 0, 1).getLocatedBlocks();

            LocatedBlock firstBlock = null;
            DatanodeInfo[] locations = null;
            if (blocks.size() > 0) {
                firstBlock = blocks.get(0);
                locations = firstBlock.getLocations();
            }
            if (locations == null || locations.length == 0) {
                out.print("Empty file");
            } else {
                DatanodeInfo chosenNode = JspHelper.bestNode(firstBlock, conf);
                int datanodePort = chosenNode.getXferPort();
                String redirectLocation = JspHelper.Url.url(req.getScheme(), chosenNode)
                        + "/browseBlock.jsp?blockId=" + firstBlock.getBlock().getBlockId() + "&blockSize="
                        + firstBlock.getBlock().getNumBytes() + "&genstamp="
                        + firstBlock.getBlock().getGenerationStamp() + "&filename="
                        + URLEncoder.encode(dir, "UTF-8") + "&datanodePort=" + datanodePort
                        + "&namenodeInfoPort=" + namenodeInfoPort
                        + JspHelper.getDelegationTokenUrlParam(tokenString)
                        + JspHelper.getUrlParam(JspHelper.NAMENODE_ADDRESS, nnAddr);
                resp.sendRedirect(redirectLocation);
            }
            return;
        }
        // directory
        // generate a table and dump the info
        String[] headings = { "Name", "Type", "Size", "Replication", "Block Size", "Modification Time",
                "Permission", "Owner", "Group" };
        out.print("<h3>Contents of directory ");
        JspHelper.printPathWithLinks(dir, out, namenodeInfoPort, tokenString, nnAddr);
        out.print("</h3><hr>");
        JspHelper.printGotoForm(out, namenodeInfoPort, tokenString, dir, nnAddr);
        out.print("<hr>");

        File f = new File(dir);
        String parent;
        if ((parent = f.getParent()) != null)
            out.print("<a href=\"" + req.getRequestURL() + "?dir=" + parent + "&namenodeInfoPort="
                    + namenodeInfoPort + JspHelper.getDelegationTokenUrlParam(tokenString)
                    + JspHelper.getUrlParam(JspHelper.NAMENODE_ADDRESS, nnAddr)
                    + "\">Go to parent directory</a><br>");

        DirectoryListing thisListing = dfs.listPaths(target, HdfsFileStatus.EMPTY_NAME);
        if (thisListing == null || thisListing.getPartialListing().length == 0) {
            out.print("Empty directory");
        } else {
            JspHelper.addTableHeader(out);
            int row = 0;
            JspHelper.addTableRow(out, headings, row++);
            String cols[] = new String[headings.length];
            do {
                HdfsFileStatus[] files = thisListing.getPartialListing();
                for (int i = 0; i < files.length; i++) {
                    String localFileName = files[i].getLocalName();
                    // Get the location of the first block of the file
                    if (!files[i].isDir()) {
                        cols[1] = "file";
                        cols[2] = StringUtils.byteDesc(files[i].getLen());
                        cols[3] = Short.toString(files[i].getReplication());
                        cols[4] = StringUtils.byteDesc(files[i].getBlockSize());
                    } else {
                        cols[1] = "dir";
                        cols[2] = "";
                        cols[3] = "";
                        cols[4] = "";
                    }
                    String datanodeUrl = req.getRequestURL() + "?dir="
                            + URLEncoder.encode(files[i].getFullName(target), "UTF-8") + "&namenodeInfoPort="
                            + namenodeInfoPort + JspHelper.getDelegationTokenUrlParam(tokenString)
                            + JspHelper.getUrlParam(JspHelper.NAMENODE_ADDRESS, nnAddr);
                    cols[0] = "<a href=\"" + datanodeUrl + "\">" + HtmlQuoting.quoteHtmlChars(localFileName)
                            + "</a>";
                    cols[5] = new SimpleDateFormat("yyyy-MM-dd HH:mm")
                            .format(new Date((files[i].getModificationTime())));
                    cols[6] = files[i].getPermission().toString();
                    cols[7] = files[i].getOwner();
                    cols[8] = files[i].getGroup();
                    JspHelper.addTableRow(out, cols, row++);
                }
                if (!thisListing.hasMore()) {
                    break;
                }
                thisListing = dfs.listPaths(target, thisListing.getLastName());
            } while (thisListing != null);
            JspHelper.addTableFooter(out);
        }
    }
    out.print("<br><a href=\"///" + JspHelper.canonicalize(nnAddr) + ":" + namenodeInfoPort
            + "/dfshealth.jsp\">Go back to DFS home</a>");
    dfs.close();
}

From source file:dk.netarkivet.common.webinterface.HTMLUtils.java

/**
 * Writes out footer information to close the page.
 *
 * @param out the writer to which the information is written
 * @throws IOException if the output cannot be written
 *//* ww  w .j a  v a2s  . com*/
public static void generateFooter(JspWriter out) throws IOException {
    ArgumentNotValid.checkNotNull(out, "out");
    // Close the element containing the page content
    out.print("</td>\n");
    // Close the single row in the table
    out.print("</tr>\n");
    // Close the table
    out.print("</table>\n");
    // Add information about the running system
    out.print("<div class='systeminfo'>");
    out.print("NetarchiveSuite " + Constants.getVersionString() + ", "
            + Settings.get(CommonSettings.ENVIRONMENT_NAME));
    out.print("</div>");
    // Close the page
    out.print("</body></html>");

}

From source file:org.apache.hadoop.hdfs.server.datanode.DatanodeJspHelper.java

static void generateFileDetails(JspWriter out, HttpServletRequest req, Configuration conf)
        throws IOException, InterruptedException {

    long startOffset = 0;
    int datanodePort;

    final Long blockId = JspHelper.validateLong(req.getParameter("blockId"));
    if (blockId == null) {
        out.print("Invalid input (blockId absent)");
        return;/*  w  w  w  .  ja  v  a 2s  .  c  o  m*/
    }
    String tokenString = req.getParameter(JspHelper.DELEGATION_PARAMETER_NAME);
    UserGroupInformation ugi = JspHelper.getUGI(req, conf);

    String datanodePortStr = req.getParameter("datanodePort");
    if (datanodePortStr == null) {
        out.print("Invalid input (datanodePort absent)");
        return;
    }
    datanodePort = Integer.parseInt(datanodePortStr);

    final Long genStamp = JspHelper.validateLong(req.getParameter("genstamp"));
    if (genStamp == null) {
        out.print("Invalid input (genstamp absent)");
        return;
    }
    String namenodeInfoPortStr = req.getParameter("namenodeInfoPort");
    int namenodeInfoPort = -1;
    if (namenodeInfoPortStr != null)
        namenodeInfoPort = Integer.parseInt(namenodeInfoPortStr);
    final String nnAddr = StringEscapeUtils.escapeHtml(req.getParameter(JspHelper.NAMENODE_ADDRESS));
    if (nnAddr == null) {
        out.print(JspHelper.NAMENODE_ADDRESS + " url param is null");
        return;
    }

    final int chunkSizeToView = JspHelper.string2ChunkSizeToView(req.getParameter("chunkSizeToView"),
            getDefaultChunkSize(conf));

    String startOffsetStr = req.getParameter("startOffset");
    if (startOffsetStr == null || Long.parseLong(startOffsetStr) < 0)
        startOffset = 0;
    else
        startOffset = Long.parseLong(startOffsetStr);

    String path = StringEscapeUtils.unescapeHtml(req.getParameter("filename"));
    if (path == null) {
        path = req.getPathInfo() == null ? "/" : req.getPathInfo();
    }
    final String filename = JspHelper.validatePath(path);
    if (filename == null) {
        out.print("Invalid input");
        return;
    }

    final String blockSizeStr = req.getParameter("blockSize");
    if (blockSizeStr == null || blockSizeStr.length() == 0) {
        out.print("Invalid input");
        return;
    }
    long blockSize = Long.parseLong(blockSizeStr);

    final DFSClient dfs = getDFSClient(ugi, nnAddr, conf);
    List<LocatedBlock> blocks = dfs.getNamenode().getBlockLocations(filename, 0, Long.MAX_VALUE)
            .getLocatedBlocks();
    // Add the various links for looking at the file contents
    // URL for downloading the full file
    String downloadUrl = "/streamFile" + ServletUtil.encodePath(filename)
            + JspHelper.getUrlParam(JspHelper.NAMENODE_ADDRESS, nnAddr, true)
            + JspHelper.getDelegationTokenUrlParam(tokenString);
    out.print("<a name=\"viewOptions\"></a>");
    out.print("<a href=\"" + downloadUrl + "\">Download this file</a><br>");

    DatanodeInfo chosenNode;
    // URL for TAIL
    LocatedBlock lastBlk = blocks.get(blocks.size() - 1);
    try {
        chosenNode = JspHelper.bestNode(lastBlk, conf);
    } catch (IOException e) {
        out.print(e.toString());
        dfs.close();
        return;
    }

    String tailUrl = "///" + JspHelper.Url.authority(req.getScheme(), chosenNode) + "/tail.jsp?filename="
            + URLEncoder.encode(filename, "UTF-8") + "&namenodeInfoPort=" + namenodeInfoPort
            + "&chunkSizeToView=" + chunkSizeToView + JspHelper.getDelegationTokenUrlParam(tokenString)
            + JspHelper.getUrlParam(JspHelper.NAMENODE_ADDRESS, nnAddr) + "&referrer="
            + URLEncoder.encode(req.getRequestURL() + "?" + req.getQueryString(), "UTF-8");
    out.print("<a href=\"" + tailUrl + "\">Tail this file</a><br>");

    out.print("<form action=\"/browseBlock.jsp\" method=GET>");
    out.print("<b>Chunk size to view (in bytes, up to file's DFS block size): </b>");
    out.print("<input type=\"hidden\" name=\"blockId\" value=\"" + blockId + "\">");
    out.print("<input type=\"hidden\" name=\"blockSize\" value=\"" + blockSize + "\">");
    out.print("<input type=\"hidden\" name=\"startOffset\" value=\"" + startOffset + "\">");
    out.print("<input type=\"hidden\" name=\"filename\" value=\"" + filename + "\">");
    out.print("<input type=\"hidden\" name=\"genstamp\" value=\"" + genStamp + "\">");
    out.print("<input type=\"hidden\" name=\"datanodePort\" value=\"" + datanodePort + "\">");
    out.print("<input type=\"hidden\" name=\"namenodeInfoPort\" value=\"" + namenodeInfoPort + "\">");
    out.print("<input type=\"hidden\" name=\"" + JspHelper.NAMENODE_ADDRESS + "\" value=\"" + nnAddr + "\">");
    out.print("<input type=\"text\" name=\"chunkSizeToView\" value=" + chunkSizeToView
            + " size=10 maxlength=10>");
    out.print("&nbsp;&nbsp;<input type=\"submit\" name=\"submit\" value=\"Refresh\">");
    out.print("</form>");
    out.print("<hr>");
    out.print("<a name=\"blockDetails\"></a>");
    out.print("<B>Total number of blocks: " + blocks.size() + "</B><br>");
    // generate a table and dump the info
    out.println("\n<table>");

    String nnCanonicalName = JspHelper.canonicalize(nnAddr);
    for (LocatedBlock cur : blocks) {
        out.print("<tr>");
        final String blockidstring = Long.toString(cur.getBlock().getBlockId());
        blockSize = cur.getBlock().getNumBytes();
        out.print("<td>" + blockidstring + ":</td>");
        DatanodeInfo[] locs = cur.getLocations();
        for (int j = 0; j < locs.length; j++) {
            String datanodeAddr = locs[j].getXferAddr();
            datanodePort = locs[j].getXferPort();
            String blockUrl = "///" + JspHelper.Url.authority(req.getScheme(), locs[j])
                    + "/browseBlock.jsp?blockId=" + blockidstring + "&blockSize=" + blockSize + "&filename="
                    + URLEncoder.encode(filename, "UTF-8") + "&datanodePort=" + datanodePort + "&genstamp="
                    + cur.getBlock().getGenerationStamp() + "&namenodeInfoPort=" + namenodeInfoPort
                    + "&chunkSizeToView=" + chunkSizeToView + JspHelper.getDelegationTokenUrlParam(tokenString)
                    + JspHelper.getUrlParam(JspHelper.NAMENODE_ADDRESS, nnAddr);

            String blockInfoUrl = "///" + nnCanonicalName + ":" + namenodeInfoPort
                    + "/block_info_xml.jsp?blockId=" + blockidstring;
            out.print("<td>&nbsp</td><td><a href=\"" + blockUrl + "\">" + datanodeAddr + "</a></td><td>"
                    + "<a href=\"" + blockInfoUrl + "\">View Block Info</a></td>");
        }
        out.println("</tr>");
    }
    out.println("</table>");
    out.print("<hr>");
    out.print("<br><a href=\"///" + nnCanonicalName + ":" + namenodeInfoPort
            + "/dfshealth.jsp\">Go back to DFS home</a>");
    dfs.close();
}

From source file:org.openmrs.web.taglib.UserWidgetTag.java

public int doStartTag() {
    User user = Context.getUserService().getUser(userId);

    try {/*from   w w  w.  j a va  2 s  .  c  om*/
        JspWriter w = pageContext.getOut();
        w.print(user.getPersonName());
        if ("full".equals(size)) {
            w.print(" <i>(" + user.getUsername() + ")</i>");
        }
    } catch (IOException ex) {
        log.error("Error while starting userWidget tag", ex);
    }
    return SKIP_BODY;
}

From source file:com.edgenius.wiki.webapp.taglib.SystemTitleTag.java

@Override
public int doStartTag() throws JspException {
    JspWriter writer = pageContext.getOut();
    try {/* www .  j  a  v a 2 s. c  o m*/
        writer.print((StringUtils.isBlank(Global.SystemTitle) ? "" : Global.SystemTitle + "|")
                + WikiConstants.APP_NAME);
    } catch (IOException e) {
        log.error("Write system title failed.", e);
    }
    return TagSupport.SKIP_BODY;
}

From source file:org.apache.hadoop.hdfs.server.datanode.DatanodeJspHelper.java

static void generateFileChunks(JspWriter out, HttpServletRequest req, Configuration conf)
        throws IOException, InterruptedException {
    long startOffset = 0;
    int datanodePort = 0;

    final String namenodeInfoPortStr = req.getParameter("namenodeInfoPort");
    final String nnAddr = req.getParameter(JspHelper.NAMENODE_ADDRESS);
    if (nnAddr == null) {
        out.print(JspHelper.NAMENODE_ADDRESS + " url param is null");
        return;//from  ww w . j  av  a 2 s.c  o m
    }
    final String tokenString = req.getParameter(JspHelper.DELEGATION_PARAMETER_NAME);
    UserGroupInformation ugi = JspHelper.getUGI(req, conf);
    int namenodeInfoPort = -1;
    if (namenodeInfoPortStr != null)
        namenodeInfoPort = Integer.parseInt(namenodeInfoPortStr);

    final String filename = JspHelper
            .validatePath(StringEscapeUtils.unescapeHtml(req.getParameter("filename")));
    if (filename == null) {
        out.print("Invalid input (filename absent)");
        return;
    }

    final Long blockId = JspHelper.validateLong(req.getParameter("blockId"));
    if (blockId == null) {
        out.print("Invalid input (blockId absent)");
        return;
    }

    final DFSClient dfs = getDFSClient(ugi, nnAddr, conf);

    String bpid = null;
    Token<BlockTokenIdentifier> blockToken = BlockTokenSecretManager.DUMMY_TOKEN;
    List<LocatedBlock> blks = dfs.getNamenode().getBlockLocations(filename, 0, Long.MAX_VALUE)
            .getLocatedBlocks();
    if (blks == null || blks.size() == 0) {
        out.print("Can't locate file blocks");
        dfs.close();
        return;
    }

    boolean needBlockToken = conf.getBoolean(DFSConfigKeys.DFS_BLOCK_ACCESS_TOKEN_ENABLE_KEY,
            DFSConfigKeys.DFS_BLOCK_ACCESS_TOKEN_ENABLE_DEFAULT);

    for (int i = 0; i < blks.size(); i++) {
        if (blks.get(i).getBlock().getBlockId() == blockId) {
            bpid = blks.get(i).getBlock().getBlockPoolId();
            if (needBlockToken) {
                blockToken = blks.get(i).getBlockToken();
            }
            break;
        }
    }

    final Long genStamp = JspHelper.validateLong(req.getParameter("genstamp"));
    if (genStamp == null) {
        out.print("Invalid input (genstamp absent)");
        return;
    }

    long blockSize = 0;
    final String blockSizeStr = req.getParameter("blockSize");
    if (blockSizeStr == null) {
        out.print("Invalid input (blockSize absent)");
        return;
    }
    blockSize = Long.parseLong(blockSizeStr);

    final int chunkSizeToView = JspHelper.string2ChunkSizeToView(req.getParameter("chunkSizeToView"),
            getDefaultChunkSize(conf));

    String startOffsetStr = req.getParameter("startOffset");
    if (startOffsetStr == null || Long.parseLong(startOffsetStr) < 0)
        startOffset = 0;
    else
        startOffset = Long.parseLong(startOffsetStr);

    String datanodePortStr = req.getParameter("datanodePort");
    if (datanodePortStr == null) {
        out.print("Invalid input (datanodePort absent)");
        return;
    }
    datanodePort = Integer.parseInt(datanodePortStr);
    out.print("<h3>File: ");
    JspHelper.printPathWithLinks(filename, out, namenodeInfoPort, tokenString, nnAddr);
    out.print("</h3><hr>");
    String parent = new File(filename).getParent();
    JspHelper.printGotoForm(out, namenodeInfoPort, tokenString, parent, nnAddr);
    out.print("<hr>");
    out.print("<a href=\"/browseDirectory.jsp?dir=" + URLEncoder.encode(parent, "UTF-8") + "&namenodeInfoPort="
            + namenodeInfoPort + JspHelper.getDelegationTokenUrlParam(tokenString)
            + JspHelper.getUrlParam(JspHelper.NAMENODE_ADDRESS, nnAddr)
            + "\"><i>Go back to dir listing</i></a><br>");
    out.print("<a href=\"#viewOptions\">Advanced view/download options</a><br>");
    out.print("<hr>");

    String authority = req.getServerName() + ":" + req.getServerPort();
    String nextUrl = generateLinksForAdjacentBlock(NEXT_BLOCK, authority, datanodePort, startOffset,
            chunkSizeToView, blockSize, blockId, genStamp, dfs, filename, conf, req.getScheme(), tokenString,
            namenodeInfoPort, nnAddr);
    if (nextUrl != null) {
        out.print("<a href=\"" + nextUrl + "\">View Next chunk</a>&nbsp;&nbsp;");
    }

    String prevUrl = generateLinksForAdjacentBlock(PREV_BLOCK, authority, datanodePort, startOffset,
            chunkSizeToView, blockSize, blockId, genStamp, dfs, filename, conf, req.getScheme(), tokenString,
            namenodeInfoPort, nnAddr);
    if (prevUrl != null) {
        out.print("<a href=\"" + prevUrl + "\">View Prev chunk</a>&nbsp;&nbsp;");
    }

    out.print("<hr>");
    out.print("<textarea cols=\"100\" rows=\"25\" wrap=\"virtual\" style=\"width:100%\" READONLY>");
    try {
        JspHelper.streamBlockInAscii(new InetSocketAddress(req.getServerName(), datanodePort), bpid, blockId,
                blockToken, genStamp, blockSize, startOffset, chunkSizeToView, out, conf, dfs.getConf(), dfs,
                getSaslDataTransferClient(req));
    } catch (Exception e) {
        out.print(e);
    }
    out.print("</textarea>");
    dfs.close();
}

From source file:cn.vlabs.umt.ui.tags.ConfigTag.java

public int doStartTag() {
    JspWriter out = this.pageContext.getOut();
    try {/*from w w  w. j  a  v a 2 s. co  m*/
        out.print(getConfig().getStringProp(key, ""));
    } catch (IOException e) {
        LOGGER.error(e.getMessage(), e);
    }
    return SKIP_BODY;
}

From source file:ams.fwk.customtag.AmsExcelExportTag.java

/**
 * @return int/*from  w  w  w . j av a2s.co m*/
 * @throws JspException
 */
public int doEndTag() throws JspException {
    try {
        JspWriter out = pageContext.getOut();
        out.print(listOpen);
        StringBuffer sb = new StringBuffer();
        sb.append(StringUtils.replace(excelTxTag, "$transactionId$", transactionId));
        sb.append(excelResTag);
        sb.append(StringUtils.replace(exportFileInfoTag, "$exportFileName$", exportFileName));

        out.print(sb.toString());

        out.print(listClose);

        return EVAL_PAGE;
    } catch (IOException e) {
        throw new JspException(e);
    } finally {

    }
}

From source file:dk.netarkivet.archive.webinterface.BatchGUI.java

/**
 * Method for creating the page for a batchjob. It contains the following informations:
 * <p>//from  w ww.  j av a2  s.  c  om
 * <br/>
 * - Creates a line with the name of the batchjob.<br/>
 * - Write the description if the batchjob has a metadata resource annotation description of the batchjob class.<br/>
 * - The last run information, date and size of the error and output files. <br/>
 * - The arguments of the batchjob, with information if they have been defined in the resource annotations of the
 * class.<br/>
 * - Radio buttons for choosing the replica.<br/>
 * - Input box for regular expression for filenames to match.<br/>
 * - Execution button.<br/>
 *
 * @param context The context of the page. Must contains a class name of the batchjob.
 * @throws UnknownID If the class cannot be found.
 * @throws ArgumentNotValid If the context is null.
 * @throws IllegalState If the class is not an instance of FileBatchJob.
 * @throws ForwardedToErrorPage If the context does not contain the required information.
 * @throws IOFailure If there is problems with the JspWriter.
 */
@SuppressWarnings("rawtypes")
public static void getPageForClass(PageContext context)
        throws UnknownID, ArgumentNotValid, IllegalState, ForwardedToErrorPage, IOFailure {
    ArgumentNotValid.checkNotNull(context, "PageContext context");

    HTMLUtils.forwardOnEmptyParameter(context, Constants.BATCHJOB_PARAMETER);

    try {
        // Retrieve variables
        Locale locale = context.getResponse().getLocale();
        ServletRequest request = context.getRequest();
        String className = request.getParameter(Constants.BATCHJOB_PARAMETER);
        JspWriter out = context.getOut();

        // retrieve the batch class and the constructor.
        Class c = getBatchClass(className);

        out.print(I18N.getString(locale, "batchpage;Name.of.batchjob", new Object[] {}) + ": <b>" + c.getName()
                + "</b><br/>\n");
        out.print(getClassDescription(c, locale));
        out.print(getPreviousRuns(c.getName(), locale));

        // begin form
        out.println("<form method=\"post\" action=\"" + Constants.URL_BATCHJOB_EXECUTE + "?"
                + Constants.BATCHJOB_PARAMETER + "=" + className + "\">");

        out.print(getHTMLarguments(c, locale));
        out.print(getReplicaRadioButtons(locale));
        out.print(getRegularExpressionInputBox(locale));
        out.print(getSubmitButton(locale));

        // end form
        out.print("</form>");
    } catch (IOException e) {
        String errMsg = "Could not create page with batchjobs.";
        log.warn(errMsg, e);
        throw new IOFailure(errMsg, e);
    }
}