Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

jsp & getRequestURI

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<%! String sideNavn = request.getRequestURI(); %>
just remove !
everything in between <% %> are regular java code
 
Karina Jensen
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks many times
-think all that time for just a littel "!". !!! :O)
 
Forget Steve. Look at this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic