This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes jsp &  getRequestURI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "jsp &  getRequestURI" Watch "jsp &  getRequestURI" New topic
Author

jsp & getRequestURI

Karina Jensen
Greenhorn

Joined: Jun 04, 2001
Posts: 6
Hello
I'm new to jsp... and I thing this is a easy question, but I'm stok...
I'm trying to request the URL, and assign the value to a variable, but i get errors...
When I write it like this:
<%= request.getRequestURI() %>
it is ok, and it print out:
"/gaard_portal/index.jsp"
But i don't want to print to the screen, i want it in a variable, and work whit it there....
When I write it like this:
<%! String sideNavn = request.getRequestURI(); %>
i get the following error:
Undefined variable or class name: request
probably occurred due to an error in /gaard_portal/top4.jsp line 13:
<%! String sideNavn = request.getRequestURI(); %>

Does enyone have a sulution? -and maybe an explatination?
regards karina
... hope my spelling is readable
Cynthia Yao
Ranch Hand

Joined: Nov 06, 2000
Posts: 92
<%! String sideNavn = request.getRequestURI(); %>
just remove !
everything in between <% %> are regular java code
Karina Jensen
Greenhorn

Joined: Jun 04, 2001
Posts: 6
thanks many times
-think all that time for just a littel "!". !!! :O)
 
jQuery in Action, 2nd edition
 
subject: jsp & getRequestURI
 
Similar Threads
need help on jsp and xml
Servlet problem getNamedDispatcher lead to a null pointer error
Losing Info after an &...
How to get the JSP page name
help on jsp and xml