aspose file tools*
The moose likes Servlets and the fly likes request can not be resolved Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "request can not be resolved" Watch "request can not be resolved" New topic
Author

request can not be resolved

Nirvikalp Rao
Greenhorn

Joined: Feb 14, 2012
Posts: 27

I am calling a "view.jsp" from a servlet.My doPost method which is calling "view.jsp" is here

the "view.jsp" goes here:

but i am getting the error as follows:

the target jsp is in the root directory of the application,where WEB-INF folder is also placed.
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

Hi Rao,
Since you are creating a new JSP, stop using scriplets (Everything would work fine)

Nirvikalp Rao wrote:req cannot be resolved
Did you edit the exception while posting? The exception should show "request cannot be resolved" instead of 'req'. If you didn't edit clean your server cache and try the same again.


Have Fun with Java
little,little.. little by little makes a lot..
Anurag Verma
Ranch Hand

Joined: Mar 30, 2012
Posts: 124

remove the html & body tags. it should work directly.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

Anurag Verma wrote:remove the html & body tags. it should work directly.

Huh? How will that resolve the problem? Please don't suggest things that don't address the problem.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

It is most likely that the path to the JSP is wrong. Please include the original error message (not your misspelling of it) and the location of the target JSP within the web app.
Karn Kumar
Ranch Hand

Joined: Aug 06, 2009
Posts: 143

Your Code seems correct, also the file location seems correct as it reaches the line where the request has been written . Just try Shankar's advice. Delete Work forlder and clean & build the project and restart it. Also there is minimal possibility that your jars are incorrect.
Nirvikalp Rao
Greenhorn

Joined: Feb 14, 2012
Posts: 27

Bear Bibeault wrote:It is most likely that the path to the JSP is wrong. Please include the original error message (not your misspelling of it) and the location of the target JSP within the web app.

The target Jsp "view.jsp" is in the root directory of the web application.And if i am just printing a simple message in jsp(instead of calling getAttribute() method on request object),it is working fine.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

RequestDispatcher disp=request.getRequestDispatcher("/view.jsp");

And the fact that you have Java code in your JSP is very disturbing.
Nirvikalp Rao
Greenhorn

Joined: Feb 14, 2012
Posts: 27

Bear Bibeault wrote: RequestDispatcher disp=request.getRequestDispatcher("/view.jsp")

Still getting the same error.
Omkar onky
Greenhorn

Joined: Oct 12, 2012
Posts: 11
Your code is absolutely right!
but make sure
you used the HttpServletRequest reference variable named as "request".
because in JSP used to allow the default reference variable name must be named in your servlet doGet/doPost(HttpServletRequest request, .......)
in your jsp!
<%
It must be used by the name as.....

request.getAttribute();
%>

Firstly i got the same error!
It solved!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

Omkar onky wrote:
but make sure
you used the HttpServletRequest reference variable named as "request".
because in JSP used to allow the default reference variable name must be named in your servlet doGet/doPost(HttpServletRequest request, .......)
in your jsp!

No. What the variable is named in the servlet has absolutely nothing at all to do with accessing the built-in scripting variable in the JSP.
G krishna kumar
Greenhorn

Joined: Oct 10, 2012
Posts: 14
List l=bm.getBrand(s); /// here in this line

my question did you compile your servlet.
and how you are able to assign a string to a List.
you have an
: incompatible types
found : java.lang.String
required: java.util.List

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: request can not be resolved
 
Similar Threads
Compiling result.jsp (page 89 HFSJ)
Head First BeerSelect problems
Head First Servlets and JSP simple exercise problem
Unable to compile class for JSP
request can not be resolved.