Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can any body solved my problem on RequestDispatcher.

 
Chidanand Chauhan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am facing a problem with the error
org.apache.jasper.JasperException: /login.jsp(0,19) quote symbol expected


Please check my code.
I have a java file(Servlet) GuestJsp which is forwarding the ServletRequest to login.jsp.

GuesJsp.java stores in tomcat/webapps/WEB-INF/classes/com/example/ GuestJsp.java

File name: GuestJsp.java


package com.example;

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class GuestJsp extends HttpServlet {


public void doGet(HttpServletRequest req,
HttpServletResponse res)
throws ServletException, IOException
{

req.setAttribute("message", "Hello, world");

ServletContext app = getServletContext();

RequestDispatcher disp;
disp = app.getRequestDispatcher("/login.jsp");

disp.forward(req, res);
}
}


Login.jsp file stores in tomcat/webapps/Myapplication/login.jsp



 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
org.apache.jasper.JasperException: /login.jsp(0,19) quote symbol expected

Looks like the problem is in your login.jsp, not the servlet.


[klunk]
[ December 01, 2005: Message edited by: Ben Souther ]
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
org.apache.jasper.JasperException: /login.jsp(0,19) quote symbol expected
It looks like you are missing a quote symbol in your JSP, nothing to do with the RequestDispatcher.
 
Chidanand Chauhan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by David O'Meara:
org.apache.jasper.JasperException: /login.jsp(0,19) quote symbol expected
It looks like you are missing a quote symbol in your JSP, nothing to do with the RequestDispatcher.


Where is the main error in jsp i am pasting my jsp code please find it out where is the quote symbol expected.

File name :login.jsp


<%@ page language=javascript %>

<head>
<title><%= request.attribute.message %></title>
</head>

<body bgcolor='white'>
<h1><%= request.attribute.message %></h1>
</body>
 
ramprasad madathil
Ranch Hand
Posts: 489
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The same issue is being dicussed in this post. Chidanand, seeing that both Ben and Dave are giving you answers here, recommend that you stick to this post and give up on the other one.

cheers,
ram.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The other copy is now closed, please keep conversations in a single thread.

<%@ page language=javascript %> should have quotes as in [b]<%@ page language="javascript" %>[/.b]
 
Chidanand Chauhan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok i give up the other one and start concentrating on this one.

The thing is that where is the problem in my jsp. which i have already pasted over.
 
Chidanand Chauhan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
--------------------------------------------------------------------------------
The other copy is now closed, please keep conversations in a single thread.

<%@ page language=javascript %> should have quotes as in [b]<%@ page language="javascript" %>[/.b]



No the same problem is still there.

Exception

org.apache.jasper.JasperException: /login.jsp(0,0) jsp.error.language.nonjava
 
Chidanand Chauhan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by David O'Meara:
The other copy is now closed, please keep conversations in a single thread.

<%@ page language=javascript %> should have quotes as in [b]<%@ page language="javascript" %>[/.b]


After deleting the language="javascript" from the code and run the program now gives the exception


exception

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 3 in the jsp file: /login.jsp

Generated servlet error:
[javac] Compiling 1 source file

C:\Tomcat 4.1\work\Standalone\localhost\RequestDispatcherDemo\login_jsp.java:44: cannot resolve symbol
symbol : variable attribute
location: interface javax.servlet.http.HttpServletRequest
out.print( request.attribute.message );
^



An error occurred at line: 7 in the jsp file: /login.jsp

Generated servlet error:
C:\Tomcat 4.1\work\Standalone\localhost\RequestDispatcherDemo\login_jsp.java:49: cannot resolve symbol
symbol : variable attribute
location: interface javax.servlet.http.HttpServletRequest
out.print( request.attribute.message );
^
2 errors


 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, but now we're seeing the correct errors

You may be confusing scriptlets and JSTL. In scriptlets there is no request.appribute.message, if there is a "message", you gave to get it from the attribute.

<%=request.getAttribute("message") %>
 
Chidanand Chauhan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by David O'Meara:
Yes, but now we're seeing the correct errors

You may be confusing scriptlets and JSTL. In scriptlets there is no request.appribute.message, if there is a "message", you gave to get it from the attribute.

<%=request.getAttribute("message") %>



Yea Atlast i did it. Thanks Thanks Thanks David,Ram and Ben for your effort.
Really you people are great.
Thanks once again
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Excellent.
I'm glad it's working for you.

Now that you've got that under your belt, you may want to stroll over to here for some tips on making Javaranch work better for both you and the people trying to help you.

Thanks and Welcome to Javaranch.
-Ben
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic