Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JSP
Search Coderanch
Advance search
Google search
Register / Login
Forums
Register
Login
Java
»
JSP
JSP & Servlet interaction
Erick Heberling
,
Greenhorn
Sep 07, 2005 13:04:00
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
Is it possible to get a
String
"in a servlet" by calling it in the
JSP
?
For example in the
servlet
I have:
String e_num = ""; e_num = strUserName; String address = "/ContentFile.jsp"; RequestDispatcher dispatcher = request.getRequestDispatcher(address); dispatcher.forward(request, response);
I have set e_num equal to strUserName in the servlet. The part I am having trouble with is using a jsp expression to reference e_num.
Thanks for any advice.
Ben Souther
,
Sheriff
staff
Sep 07, 2005 14:02:00
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
You would do this by binding the string to a particular scope.
In your servlet:
String myValue = "asdf"; request.setAttribute("myValue", myValue)
In your JSP:
${requestScope.myValue}
Erick Heberling
,
Greenhorn
Sep 08, 2005 05:29:00
(0 cow)
(0 skulls)
+Pie
Number of slices to send:
Send
That worked. Thank you.
Post by:
autobot
Let nothing stop you! Not even this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
reply
This thread has been viewed 588 times.
Similar Threads
Browser Path Not Refreshing
request.getAttribute(param)
sql error
Calling JNDI from JSP
how to get the selected value from a drop down to action
More...
All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 20:22:30
.