[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1739
  • Last Modified:

bean + struts JSP

how can i assign a bean value to my JSP variable.

somtheing like:
<% String test = "<bean:write name=\"currentDate\" property=\"dateFormatted\" />"; %>

Ofcourse my syntax is wrong, but just to demonstrated you.
0
ldbkutty
Asked:
ldbkutty
  • 2
  • 2
2 Solutions
 
zzynxSoftware engineerCommented:
0
 
lhankinsCommented:
If you want to define a new scriptlet variable based off one of your available beans, you can use the <bean:define> tag.  For example, the following will assign the value of someBean.getSomeProperty() to the scriptlet variable "somevar"

   <bean:define id="someVar" name="someBean" property="someProperty"/>
   <input type="hidden" name="bleh" value="<%=someVar%>"/>
0
 
lhankinsCommented:
BTW - the second line  above (the <input> tag) is just an example of how to reference the scriptlet variable (it has no meaning other than that)

0
 
zzynxSoftware engineerCommented:
Thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now