Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to pass value from action to jsp scriplet

 
manish krishnan
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

i m facing a big problem.. please help me.

i have an action which contains a variable that contains value from database. now i want to assign the action variable value to a jsp page local variable initialized in scriplet.

for ex

action.java


result.jsp


i want to how value of 'a' can be assigned to 'b'

Thanking
Manish
 
sri ramvaithiyanathan
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

int a=10;
String setValue = Integer.toString(a);
set the converted value into request.setAttribute("dummyName",setValue);
In jsp page you can get the value by calling the request.getAttribute("dummyName");

I'm not sure whether integer can be used to set in request.setAttribute so that i converted int into String.

Regards,
Sriram.V
 
manish krishnan
Greenhorn
Posts: 26
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic