bean + struts JSP

Posted on 2004-10-04
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 400 total points
ID: 12217573

Assisted Solution

lhankins earned 100 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
tomcat startup error 5 136
spring jars download 1 53
jsp login check 12 53
junit example issue 2 28
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
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…

726 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