File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
 
Similar Threads
form field validation
Table per hierarchy update
servlet and javascript
How to use getText() in JSP
Persistent connection