*
The moose likes Struts and the fly likes getting the value from <bean:write> tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "getting the value from <bean:write> tag" Watch "getting the value from <bean:write> tag" New topic
Author

getting the value from <bean:write> tag

Krish Yeruva
Ranch Hand

Joined: Sep 17, 2008
Posts: 58
Hi,
Can I do like this in JSP:
String str = "<bean:write name="XXX" property='XXX">"
Can you people suggest me, how can I get the value into String from <bean:write> ?

Thanks in advance




Thanks & Regards
KITTU
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39478
    
  28
I think this would sit better on our JSP forum: Moving thread.
Krish Yeruva
Ranch Hand

Joined: Sep 17, 2008
Posts: 58
Can anyone give me the response for the above query?
Stefan Evans
Bartender

Joined: Jul 06, 2005
Posts: 1018
Writing scriptlet code is discouraged. You shouldn't need to have to use a scriptlet string variable.

If you must though, here are a couple of approaches
1 - use EL rather than scriptlet code. ie the value is ${XXX.xxx}

2 - realise that the bean is an attribute in scope, get a hold of the bean in a scriptlet variable (with a <jsp:useBean> tag) and then call the get method directly.



3 - Use JSTL to store the string value as another page attribute

Khalil Salman
Greenhorn

Joined: Sep 05, 2010
Posts: 11
I solve that issue by using <html:hidden> tag:

if it is:
<bean:write name="XXX" property='YYY">

then I put:
<html:hidden name="XXX" property="YYY"/>
next to it...
Raghava Chary
Greenhorn

Joined: May 06, 2011
Posts: 6
<bean:define id="temp" name="formname" property="propertyname" type="java.lang.String"/>
<%String tmp=temp;%>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getting the value from <bean:write> tag