aspose file tools*
The moose likes Struts and the fly likes how to assign bean value to jsp variable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to assign bean value to jsp variable" Watch "how to assign bean value to jsp variable" New topic
Author

how to assign bean value to jsp variable

Praveen palukuri
Ranch Hand

Joined: Feb 10, 2005
Posts: 65
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.
Zhang Alan
Greenhorn

Joined: Nov 09, 2005
Posts: 22
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 ]
Manuel Sanchez Iba�ez
Greenhorn

Joined: Jul 12, 2005
Posts: 20
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?
vikhyath reddy
Greenhorn

Joined: Dec 07, 2008
Posts: 20
its simple ...

<% String s=mybeanid.getProperty();

---- your code -----

%>


~ Happy coding ~
Andy Lileston
Greenhorn

Joined: Nov 03, 2008
Posts: 10
You could also do it very easily in JSTL
Raghava Chary
Greenhorn

Joined: May 06, 2011
Posts: 6
<bean:define id="abc" name="FormName" property="Property" type="java.lang.String"/>
<%=abc%>>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to assign bean value to jsp variable