%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page trimDirectiveWhitespaces="true" %> <%@ page import="org.crosswire.data.DataObject" %> <%@ page import="org.crosswire.xml.XMLBlock" %> <%@ page import="org.crosswire.sword.keys.VerseKey" %> <%@ page import="org.crosswire.sword.keys.ListKey" %> <%@ page import="java.util.List" %> <% String authID = request.getParameter("authorID"); if (authID != null && authID.startsWith("a")) authID = authID.substring(1); int authorID = -1; try {authorID = Integer.parseInt(authID);} catch (Exception e){} String authorNamePartial = request.getParameter("authorNamePartial"); int limit = 20; try {limit = Integer.parseInt(request.getParameter("limit"));} catch (Exception e){} if (authorID > -1 || authorNamePartial != null) { response.setContentType("text/xml"); DataObject query = new DataObject(); String SQL = "SELECT DISTINCT AUTHORID, AUTHOR as AUTHORNAME from ntconjectures.CONJHISTORY CH "; SQL += " WHERE 1=1 "; if (authorID > -1) { SQL += " AND CH.AUTHORID = {AUTHORID}"; query.setIntValue("AUTHORID", authorID); } if (authorNamePartial != null) { SQL += " AND CH.AUTHOR like {AUTHORNAMEPARTIAL}"; query.setValue("AUTHORNAMEPARTIAL", "%"+authorNamePartial+"%"); } SQL += " ORDER BY AUTHOR"; SQL += " LIMIT " + limit; List authors = query.getDataSet(SQL); %> <% for (DataObject o : authors) { String auth = ""; out.println(auth); } %> <% return; } %> author/get Retrieve author Parameters authorIDconjecture id to query, e.g., 11713 authorNamePartialfor incremental searches of author name limit(20) limit result count
Retrieve author