This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSP and the fly likes using libtags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "using libtags" Watch "using libtags" New topic
Author

using libtags

shaf maff
Ranch Hand

Joined: Sep 07, 2008
Posts: 180
Hi Guys

I have a variable in my servlet called "credit" which has a value of 100. I use requestdispatcher to forward to my JSP page. How do I print the value of credit on the JSP page ?
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874

It depends on the type of the variable "credit" ( i believe its Integer). To be very simple userequest.setAttribute() in servlet and use request.getAttribute() to get the same in jsp.

Note the setAttribute takes Object only so "1000" Stored in String/Integer. But avoid using scriplets in JSP and go for bean class and use EL instead.check this setAttrribute
shaf maff
Ranch Hand

Joined: Sep 07, 2008
Posts: 180
The value is string. What about using something like:




I havent tested it because Im still writing the code.
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874

Yup , use like this. Check the syntax.
<cut value="${credit}" />

Also , you use requestScope.credit to get values from specific scope
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: using libtags