Win a copy of Spark in Action this week in the Open Source Projects forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Strange JSP error - Invalid Standard Action

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am building a JSP page that needs to read the parameters that it was called with, so that it can prepare them to be passed back through the form that its displaying to
the user. Right now, it is dirt simple, I started with the simple jsp template from eclipse. I want to slurp all of the parameters into a map, and then iterate through the parameters. My current thought is to copy the map into a TreeMap, so that I can remove certain parameters (to be used elsewhere in the code).

Code is below. So far, it works fine if I remove the line:
TreeMap<String,String[]> pm = new TreeMap<String,String[]>(request.getParameterMap());

The only complaint that I see is that the conversion is unchecked since getParameterMap() doesn't seem to define a type for the map. However, it doesn't work as a raw type either.

Any ideas? I have tried several permutations (including just Map pm = request.getParameterMap(); ) and so far, nothing works.

Here is my current JSP:
<%@page import="java.util.*" %>
<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"; version="2.0">
<jsp:directive.page language="java"
contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" />
<jsp:text>
<![CDATA[ <?xml version="1.0" encoding="UTF-8" ?> ]]>
</jsp:text>
<jsp:text>
<![CDATA[ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">; ]]>
</jsp:text>
<html xmlns="http://www.w3.org/1999/xhtml">;
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Login</title>
</head>
<body>
<%
TreeMap<String,String[]> pm = new TreeMap<String,String[]>(request.getParameterMap());
%>
<form method="POST" action="">

Username : <input type="text" size="15" maxlength="25" name="loginUserName" /><br />
Password : <input type="password" size="15" maxlength="25" name="loginPassword" /><br />
<input value="Login" type="submit" /><input value="Clear" type="reset" />
</form>
</body>
</html>
</jsp:root>

Here is the error traceback:
org.apache.jasper.JasperException: /login.jsp(6,5) Invalid standard action
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
org.apache.jasper.compiler.Parser.parseStandardAction(Parser.java:1172)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1461)
org.apache.jasper.compiler.Parser.parse(Parser.java:137)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:170)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
spectre.idServer.IDProvider.doProcess(IDProvider.java:68)
spectre.idServer.IDProvider.doGet(IDProvider.java:37)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 
Marshal
Posts: 67413
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why on earth are you using the JSP XML document format? That's not intended for hand coding and you are going to end up with all sorts of markup errors like this, and end up with a completely unreadable JSP.

Just use "normal" JSP.
 
Babak Shimir
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Why on earth are you using the JSP XML document format? That's not intended for hand coding and you are going to end up with all sorts of markup errors like this, and end up with a completely unreadable JSP.

Just use "normal" JSP.



I just picked a template and went with it. I didn't find much guidance as to which template was most useful for what. I will give that a try. Also... I am pretty green when it comes to jsp and java in general.
 
Bear Bibeault
Marshal
Posts: 67413
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Grab a good book or tutorial on JSP and keep it simple. The XML document format is not what you should be using!
 
Babak Shimir
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Grab a good book or tutorial on JSP and keep it simple. The XML document format is not what you should be using!



Thanks! You guys are absolutely correct. I changed templates, copied in my body, and it worked like a charm!

 
Well THAT's new! Comfort me, reliable tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic