• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

how to assign bean value to jsp variable

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
I've a doubt that how can i assign a bean value to jsp variable. i'd tried the below code:

<% String status = "<bean:write name='usersearch' property='userStatus'/>"; %>

But it's giving an error. If any one knows please help me.

Regards,
Praveen.
 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Praveen palukuri:
hi,
I've a doubt that how can i assign a bean value to jsp variable. i'd tried the below code:

<% String status = "<bean:write name='usersearch' property='userStatus'/>"; %>

But it's giving an error. If any one knows please help me.

Regards,
Praveen.




Hi.

I think you can do it like this:

<bean: define id="status" name="usersearch" property="userStatus"/>

The space between "bean:" and "define" is written because ":" and "d" is change to when there isn't a space...
[ November 10, 2005: Message edited by: Zhang Alan ]
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, i have a similar problem. I use a session object for display information in ArrayList. Each element in ArrayList is a class like:

private String nombre;
private int tiempofila;


I need divide one number between "tiempofila" but i only can show this value. I can recover and show this value in 3 ways:

<logic resent name="tabladatos">

<logic:iterate id="inf2" name="tabladatos">

<bean efine id="por2" name="inf2" property="tiempofila"/>
<bean:write name="por2"/>%<br/>

<jsp:getProperty name="inf2" property="tiempofila"/>%<br/>

<bean:write name="inf2" property="tiempofila"/>%<br/>

---<br/>
</logic:iterate>
......

This code work fine but i don�t need show this value, i need work with it:

<%int value = <bean:write name="inf2" property="tiempofila"/> %>

My goal is calculate one percentaje:

<%int percentaje = 33 * 100 / value %>

�Is possible assign this?
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
its simple ...

<% String s=mybeanid.getProperty();

---- your code -----

%>
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could also do it very easily in JSTL
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<bean:define id="abc" name="FormName" property="Property" type="java.lang.String"/>
<%=abc%>>
 
straws are for suckers. tiny ads are for attractive people.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic