?
Solved

unidentified request object

Posted on 2003-03-16
2
Medium Priority
?
180 Views
Last Modified: 2010-04-01
Just learning to do JSP and I do the following page:

<html>
   <head>
      <title>JSP Programming Sample</title>
  </head>
  <body>
    <%! String first = request.getParameter("fname");
        String last = request.getParameter("lname");
       %>
    <p>Your first name is <%=first%> </p>
    <p>Your last name is <%=last%> </p>
   </body>
</html>

When I point my browser to the page and supplying parameter for "fname" and "lname", Tomcat 4 complains that "request" is undefined class or variable. Does it mean that I don't get the "request" object on a doGet by the browser or I've missed something here ?
0
Comment
Question by:ttung11
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 3

Expert Comment

by:allahabad
ID: 8149483
<html>
  <head>
     <title>JSP Programming Sample</title>
 </head>
 <body>
   <% String first = request.getParameter("fname");
       String last = request.getParameter("lname");
      %>
   <p>Your first name is <%=first%> </p>
   <p>Your last name is <%=last%> </p>
  </body>
</html>
0
 
LVL 3

Accepted Solution

by:
allahabad earned 200 total points
ID: 8149498
Code under <%! %> is class level variable, so it will load first for initialization, at that time request object is not available; you will get error.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What's worse than having your data encrypted by ransomware? Getting attacked by a so-called "wiper," which simply destroys the data and offers you no hope of ever seeing it again.
This month, Experts Exchange’s free Course of the Month is focused on CompTIA IT Fundamentals.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question