bean + struts JSP

Posted on 2004-10-04
Medium Priority
Last Modified: 2008-02-01
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.
Question by:ldbkutty
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 37

Accepted Solution

zzynx earned 1600 total points
ID: 12217573

Assisted Solution

lhankins earned 400 total points
ID: 12218435
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%>"/>

Expert Comment

ID: 12219577
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)

LVL 37

Expert Comment

ID: 12246955

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question