*** original_JSPCompiler.java Sat Jul 3 11:32:28 1999 --- JSPCompiler.java Sat Jul 3 21:03:10 1999 *************** *** 318,323 **** --- 318,330 ---- runatServer = true; } } + } else if((srcPos < src.length()-10) && // TODO change the 10 + // to something sensible + srcEqualsAt("jsp:",srcPos + 1)) { + // one of those " + jspFile.getPath() + ":" + lineNr + ": Unknown jsp action"); + } + } + + + /** + * Parses the jsp:forward tag. + * Ignores illegal parameters.
+ * Relative URL's will probably not work, as request.sendRedirect is used + */ + private void parseActionForward() throws StringIndexOutOfBoundsException, JSPException { + String page = (String)(parseParameters().get("page")); + if(page == null) { + throw new JSPException("" + jspFile.getPath() + ":" + lineNr + ": jsp:forward requires a \"page\" parameter"); + } + recordFileAndLineNr(scriptletsCode); + scriptletsCode.append("\t\t\tresponse.sendRedirect(request.encodeRedirectURL(\"" + page + "\"));").append(lineSeparator); + } + + + private void parseActionGetProperty() throws StringIndexOutOfBoundsException, JSPException { + Hashtable params = parseParameters(); + } + + + /** + * Parses the jsp:include tag. + * Ignores illegal parameters. + */ + private void parseActionInclude() throws StringIndexOutOfBoundsException, JSPException { + String page = (String)(parseParameters().get("page")); + if(page == null) { + throw new JSPException("" + jspFile.getPath() + ":" + lineNr + ": jsp:include requires a \"page\" parameter"); + } + } + + + private void parseActionPlugin() throws StringIndexOutOfBoundsException, JSPException { + Hashtable params = parseParameters(); + } + + + private void parseActionSetProperty() throws StringIndexOutOfBoundsException, JSPException { + Hashtable params = parseParameters(); + } + + + private void parseActionUseBean() throws StringIndexOutOfBoundsException, JSPException { + Hashtable params = parseParameters(); + } + + + /** + * Reads all the parameters of a tag and returns them in a Hashtable. + */ + private Hashtable parseParameters() throws StringIndexOutOfBoundsException, JSPException { + Hashtable result = new Hashtable(); + for(;;) { + // check for end of tag + if((src.charAt(srcPos) == '/') + &&(src.charAt(srcPos + 1) == '>')) { + srcPos++; + break; + } else if(src.charAt(srcPos) == '>') { + break; + } + String[] keyAndValue = parseKeyAndValue(); + result.put(keyAndValue[0], keyAndValue[1]); + } + return result; + } + + private void parseBean() throws StringIndexOutOfBoundsException, JSPException { Properties beanAttributes; Hashtable beanDefaultProperties; *************** *** 655,660 **** --- 761,776 ---- } finally { lineNr = endLineNr; } + } + + + private boolean srcEqualsAt(String string) { + return srcEqualsAt(string,srcPos); + } + + + private boolean srcEqualsAt(String string, int pos) { + return src.substring(pos, pos + string.length()).equals(string); } private String[] parseKeyAndValue() throws StringIndexOutOfBoundsException {