This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes how to pass value from action to jsp scriplet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to pass value from action to jsp scriplet" Watch "how to pass value from action to jsp scriplet" New topic
Author

how to pass value from action to jsp scriplet

manish krishnan
Greenhorn

Joined: May 11, 2010
Posts: 26
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

Joined: Nov 20, 2010
Posts: 109
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


For java examples,ebooks,interview questions,visit this blog
http://periodicupdates.blogspot.com/
manish krishnan
Greenhorn

Joined: May 11, 2010
Posts: 26
thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to pass value from action to jsp scriplet
 
Similar Threads
Calling Java Class method from JS
Passing a scriplet value from a page w/ a FORM
way to assign value from struts property to java variable?
Using Struts : Populate checkboxes from Database in JSP
variable in scriplet and declaration