Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • 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%>>
 
reply
    Bookmark Topic Watch Topic
  • New Topic