• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

getting the value from <bean:write> tag

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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



 
Marshal
Posts: 64642
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this would sit better on our JSP forum: Moving thread.
 
Krish Yeruva
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone give me the response for the above query?
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<bean:define id="temp" name="formname" property="propertyname" type="java.lang.String"/>
<%String tmp=temp;%>
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!