Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes JSP and the fly likes Setting a value to a variable in jsp ..(value is passed by the servlet) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Setting a value to a variable in jsp ..(value is passed by the servlet)" Watch "Setting a value to a variable in jsp ..(value is passed by the servlet)" New topic
Author

Setting a value to a variable in jsp ..(value is passed by the servlet)

avinash narasingam
Greenhorn

Joined: May 08, 2012
Posts: 6
Hi everyone
i have a value which is setted in the servlet(request.setAttribute("firstName", details.getFirstName());using dispatcher i passed the value to the jsp
But now how to assign that value firstname to a variable in jsp?
i am using String value1=request.getAttribute("firstName"); in my jsp
but i am getting an error saying "Type mismatch: cannot convert from Object to String"
can anyone help me
thanks
sailaja koney
Greenhorn

Joined: Dec 18, 2011
Posts: 13

hi

try this
String value1=(String)request.getAttribute("firstName");


sailaja
avinash narasingam
Greenhorn

Joined: May 08, 2012
Posts: 6
yupp,,thank u..problem solved..
does anyone know how to close the window automatically without having a prompt or alert box .
if we try window.close() a alert box is displayed asking yes or no to close the window
i dont want the confirmation message.
but window should be closed
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Setting a value to a variable in jsp ..(value is passed by the servlet)