Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Surprising Problem in simple code

 
Nitin Dubey
Ranch Hand
Posts: 126
Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello frns,
I have a servlet ViewServlet.java where I take a request dispatcher object and try to forward the request to another page hello.jsp that has absolutely nothing except a hello message. Even though I am getting a strange error like the following in Jboss app server. I have not configured jsps in web.xml file as they can be used still.
"20:33:50,029 ERROR [Engine] ApplicationDispatcher[/multirecordview] Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /hello.jsp(0,36) equal symbol expected
"
after a few stack trace it gives
"at component.ViewServlet.doPost(ViewServlet.java:64)"
and my line no 64 is a System.out.println() just after forward. When I print the exception I get..
"org.apache.jasper.JasperException: /hello.jsp(0,36) equal symbol expected"
ViewServlet.java
================
62 : RequestDispatcher requestDispatcher = getServletContext().getRequestDispatcher("/hello.jsp");
63 : requestDispatcher.forward(request, response);
hello.jsp
=========
<%@ page language="java" contentType"text/html" %>
<html>
hello
</html
I hope I have made the things clear. Can anyone put some light on this ..
Waiting for replies,

nitin
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64985
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

/hello.jsp(0,36) equal symbol expected
<%@ page language="java" contentType"text/html" %>

Not to be a jerk, but did you even try to figure this one out? I mean, it even gave the character position where it expects an equals sign.
 
Nitin Dubey
Ranch Hand
Posts: 126
Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes I did bang my head for the problem. but since I got the error for the first time I was confused. anyways I got the problem. what was just a simple typing mistake that ate some of our valuable time..
nitin
 
Garrett Smith
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
LOL

<%@ page language="java" contentType"text/html" %>

Look closely.
 
danny liu
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is good to test your jsp files separately and then test them together.
 
lali virdi
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi the problem is in the first line
<%@ page language="java" contentType"text/html" %>
<%@ page language="java" contentType = "text/html" %>
the = sign is missing ;
i hope it will definately help you
ok by
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64985
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch "lali lali"!
You'll find this forum a great place to seek help on JSP pages, and there aren't many rules you'll have to worry about, but one is that proper names are required. Please take a look at the JavaRanch Naming Policy and change your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.
Thanks!
bear
JSP Forum Bartender
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic