jsp: useBean.. and c: coding

I am trying to understand this coding.
1. What does the <jsp: useBean .. class="coreservlets.ShoppingCart"> mean? Are we bringing in the content of the ShoppingCart class?
If we use <% import="coreserlets.*"> at the top of JSP, wouldn't this work to apply all the class in the application?
2.What is the <c:> coding? I have never seen this before (I am pretty new with Java). Is this new version of Java?
Thanks.
Here is coding sample.
<jsp:useBean id="cart" class="coreservlets.ShoppingCart" scope="session"/>
<c:choose>
  <c:when test="${empty cart.itemsOrdered}">
    <h2><i>No items in your cart...</i></h2>
  </c:when>
  <c:otherwise>
    <table border=1 align="center">
    <tr bgcolor="#FFAD00">
      <th>Item ID</th>
      <th>Description</th>
      <th>Unit Cost</th>
      <th>Number</th>
      <th>Total Cost</th>
    </tr>
    <c:forEach var="item" items="${cart.itemsOrdered}">
       <tr>
         <td><c:out value="${item.itemID}"/></td>
         <td><c:out value="${item.shortDescription}"/></td>
         <td><fmt:formatNumber value="${item.unitCost}" type="currency"/>        
       </tr>
    </c:forEach>
    </table>
  </c:otherwise>
</c:choose>

I am trying to understand this coding.
1. What does the <jsp: useBean ..
class="coreservlets.ShoppingCart"> mean? Are we
bringing in the content of the ShoppingCart class?You're telling the JVM that you're going to use an instance of that class.
>
If we use <% import="coreserlets.*"> at the top of
JSP, wouldn't this work to apply all the class in the
application?No, that's not what import does.
2.What is the <c:> coding? I have never seen this
before (I am pretty new with Java). Is this new
version of Java?It's the JSP Standard Tag Library, or JSTL. It has core tags <c>, xml tags <xml>, formatting tags <format>, and SQL tags <sql>
<jsp:useBean id="cart"
class="coreservlets.ShoppingCart" scope="session"/>Looks like there's a ShoppingCart object in session scope.
>
Check to see if the shopping cart has items.
c:choose>If no items, say so.
>
<c:when test="${empty cart.itemsOrdered}">
<h2><i>No items in your cart...</i></h2>
/c:when>If there are items, display them in a table.
>
<c:otherwise>
<table border=1 align="center">
<tr bgcolor="#FFAD00">
<th>Item ID</th>
<th>Description</th>
<th>Unit Cost</th>
<th>Number</th>
<th>Total Cost</th>
/tr>
<c:forEach var="item"
items="${cart.itemsOrdered}">
<tr>
<td><c:out value="${item.itemID}"/></td>
<td><c:out
value="${item.shortDescription}"/></td>
<td><fmt:formatNumber
value="${item.unitCost}" type="currency"/>
</tr>
c:forEach>
</table>
c:otherwise>
</c:choose>
If you're new to Java, best to learn the base language before tackling JSPs.
%

Similar Messages

  • Jsp:useBean and assigning a value to that bean

    Hello,
    I have a type called Country and I have declared a bean using the "jsp:useBean" syntax.
    I then try to assign a value to that bean in a scriptlet. Eventually I try to retrieve the values using "jsp:getProperty". The problem is that it appears to null.
    Here is the code of the jsp
    <%@ page language="java" %>
    <%@ page import="com.parispano.latinamericaguide.*" %>
    <%
    /* We retrieve the Countries object from the servlet context. */
    ServletContext sc = getServletContext();
    Countries cs = (Countries)sc.getAttribute("countries");
    %>
    <jsp:useBean id="country" class="com.parispano.latinamericaguide.Country"/>
    <%
    /* If the request contains a country id, then we set the variable. */
    country = cs.getCountryFromId(Integer.parseInt(request.getParameter("countryID")));
    %>
    <html>
    <head>
    <title>Country details</title>
    </head>
    <body>
    <table>
    <tr><td>Name</td><td><jsp:getProperty name="country" property="name"/><!-- This is not working--></td></tr>
    <table>
    <%
    out.println(country.getName());//This is working
    %>
    </body>
    </html>This is the code for the bean
    package com.parispano.latinamericaguide;
    * @author Julien Martin
    * Represents a country.
    public class Country implements Comparable {
         private int id;
         private String name;
         private int landArea;
         private String capital;
         private String currency;
         private String flag;
         private String internet_domain;
         private String dialling_code;
         private float literacy;
         private float male_life_expectancy;
         private float female_life_expectancy;
         private String map;
         private int population;
         private int population_year;
         private float birth_rate;
         private int birth_rate_year;
         private float death_rate;
         private int death_rate_year;
         private int gdp;
         private int gdp_per_head;
         private int gdp_year;
         private float unemployment_rate;
         private int unemployment_rate_year;
         public Country() {
         public Country(
              int id,
              String name,
              int landArea,
              String capital,
              String currency,
              String flag,
              String internet_domain,
              String dialling_code,
              float literacy,
              float male_life_expectancy,
              float female_life_expectancy,
              String map,
              int population,
              int population_year,
              float birth_rate,
              int birth_rate_year,
              float death_rate,
              int death_year_rate,
              int gdp,
              int gdp_year,
              float unemployment_rate,
              int unemployment_rate_year) {
              this.id = id;
              this.name = name;
              this.landArea = landArea;
              this.capital = capital;
              this.currency = currency;
              this.flag = flag;
              this.internet_domain = internet_domain;
              this.dialling_code = dialling_code;
              this.literacy = literacy;
              this.male_life_expectancy = male_life_expectancy;
              this.female_life_expectancy = female_life_expectancy;
              this.map = map;
              this.population = population;
              this.population_year = population_year;
              this.birth_rate = birth_rate;
              this.birth_rate_year = birth_rate_year;
              this.death_rate = death_rate;
              this.death_rate_year = death_year_rate;
              this.gdp = gdp;
              this.gdp_year = gdp_year;
              this.unemployment_rate = unemployment_rate;
              this.unemployment_rate_year = unemployment_rate_year;
         public float getBirth_rate() {
              return birth_rate;
         public int getBirth_rate_year() {
              return birth_rate_year;
         public String getCapital() {
              return capital;
         public String getCurrency() {
              return currency;
         public float getDeath_rate() {
              return death_rate;
         public int getDeath_rate_year() {
              return death_rate_year;
         public String getDialling_code() {
              return dialling_code;
         public float getFemale_life_expectancy() {
              return female_life_expectancy;
         public String getFlag() {
              return flag;
         public int getGdp() {
              return gdp;
         public int getGdp_per_head() {
              return gdp / population;
         public int getGdp_year() {
              return gdp_year;
         public int getId() {
              return id;
         public String getInternet_domain() {
              return internet_domain;
         public float getLiteracy() {
              return literacy;
         public float getMale_life_expectancy() {
              return male_life_expectancy;
         public String getMap() {
              return map;
         public String getName() {
              return name;
         public int getPopulation() {
              return population;
         public int getPopulation_year() {
              return population_year;
         public int getLandArea() {
              return landArea;
         public float getUnemployment_rate() {
              return unemployment_rate;
         public int getUnemployment_rate_year() {
              return unemployment_rate_year;
         public void setBirth_rate(float f) {
              birth_rate = f;
         public void setBirth_rate_year(int i) {
              birth_rate_year = i;
         public void setCapital(String string) {
              capital = string;
         public void setCurrency(String string) {
              currency = string;
         public void setDeath_rate(float f) {
              death_rate = f;
         public void setDeath_rate_year(int i) {
              death_rate_year = i;
         public void setDialling_code(String string) {
              dialling_code = string;
         public void setFemale_life_expectancy(float f) {
              female_life_expectancy = f;
         public void setFlag(String string) {
              flag = string;
         public void setGdp(int i) {
              gdp = i;
         public void setGdp_per_head(int i) {
              gdp_per_head = gdp/population;
         public void setGdp_year(int i) {
              gdp_year = i;
         public void setId(int i) {
              id = i;
         public void setInternet_domain(String string) {
              internet_domain = string;
         public void setLiteracy(float f) {
              literacy = f;
         public void setMale_life_expectancy(float f) {
              male_life_expectancy = f;
         public void setMap(String string) {
              map = string;
         public void setName(String string) {
              name = string;
         public void setPopulation(int i) {
              population = i;
         public void setPopulation_year(int i) {
              population_year = i;
         public void setlandArea(int i) {
              landArea = i;
         public void setUnemployement_rate(float f) {
              unemployment_rate = f;
         public void setUnemployment_rate_year(int i) {
              unemployment_rate_year = i;
         public String toString() {
              return name;
         public int compareTo(Object o) {
              Country c = (Country)o;
              int cmp = name.compareTo(c.name);
              System.out.println(cmp);
              return cmp;
    }Can anyone please help?
    Thanks in advance,
    Julien.

    Thanks,
    I have added scope="application". It still show "null" indicating that the bean is not initialized with the properties. I would like a quicker way to initialize a bean property than invoking the setProperty tag for each property.
    Here is a simple example that demonstrates the problem:
    <%@ page language="java" %>
    <%@ page import="com.tests.*" %>
    <jsp:useBean id="monBean" class="com.tests.MonBean" scope="application"/>
    <%
    MonBean mb = new MonBean();
    mb.setName("toto");
    monBean= mb;
    %>
    <html>
    <head>
    <title>Lomboz JSP</title>
    </head>
    <body bgcolor="#FFFFFF">
    <jsp:getProperty name="monBean" property="name"/>
    </body>
    </html>And the bean
    package com.tests;
    public class MonBean {
    private String name;
    public String getName() {
         return name;
    public void setName(String name) {
         this.name = name;
    }This show "null".
    Any other idea why this is not working?
    Thanks,
    Julien

  • Jsp:useBean and definition of bean inside jsp:declaration

    I use the following code where I define a bean in jsp:declaration
    Its name is localBean. the problem is that jsp:useBean causes
    a crash and my page is not working without understanding why.
    When I replace the localBean in the jsp:useBean with another Bean
    which is an actual class that resides in the system I have not a problem.
    Any suggestions???
    <HTML>
         <jsp:declaration>          
              static public class localBean {
                   private String value;
                   public String getValue() {
                        return value;
                   public void setValue(String value) {
                        this.value = value;
         </jsp:declaration>
         <jsp:useBean id="localBean" scope="page" class="localBean">
              <jsp:setProperty name="localBean" property="value" value="World"/>
         </jsp:useBean>
         <%-- Whatever HTTP parameters we have, try to set
              an analogous bean property -- %>          
         <jsp:setProperty name="localBean" property="*"/>
         <head>
              <title>Hello World JavaBean</title>
         </head>
         <body>
              <center>
                   <p><h1>
                        Hello
                        <jsp:getProperty name="localBean" property="value"/>
                   </h1></p>
                   <form method="post">
                        Enter a name to be greeted:
                        <input type="text" size="32" name="value"
                        value="<jsp:getProperty name='localBean' property='value'/>">
                        <br>
                        <input type="submit" value="submit"/>
                   </form>
              </center>
         </body>
    </html>          

    Thanks,
    I have added scope="application". It still show "null" indicating that the bean is not initialized with the properties. I would like a quicker way to initialize a bean property than invoking the setProperty tag for each property.
    Here is a simple example that demonstrates the problem:
    <%@ page language="java" %>
    <%@ page import="com.tests.*" %>
    <jsp:useBean id="monBean" class="com.tests.MonBean" scope="application"/>
    <%
    MonBean mb = new MonBean();
    mb.setName("toto");
    monBean= mb;
    %>
    <html>
    <head>
    <title>Lomboz JSP</title>
    </head>
    <body bgcolor="#FFFFFF">
    <jsp:getProperty name="monBean" property="name"/>
    </body>
    </html>And the bean
    package com.tests;
    public class MonBean {
    private String name;
    public String getName() {
         return name;
    public void setName(String name) {
         this.name = name;
    }This show "null".
    Any other idea why this is not working?
    Thanks,
    Julien

  • Jsp:useBean and Tomcat

    Hi!
    I have installed Tomcat as localhost and succeed in running scriplets. But now I want to try using jsp:useBean
    I have compiled a simple class, test1.class and placed it under webapps/root together with the jsp-file.
    When I use �
    <jsp:useBean id="test1" scope="page" class="test1"/>
    to start test1, Tomcat tries to find it in org.apache.jsp
    Then I tried to add - package myFolder; - in test1 but it won�t work.
    So! These are my questions.
    Is it possible for Tomcat to find a class placed in the webapps/root folder?
    Where can I find org/apache/jsp, is it in a .jar-file somewhere? I can�t fint it when I use - search files/folders.
    Where should I place test1.class and how do I write the useBean-tag to make it work?
    Thanks for any answer
    Regards Peter

    your beans should always be under /web-inf/classes
    so if you want to put it in the root directory it should look like this
    tomcat-path/webapps/root/web-inf/classes
    in your jsp file, don't forget to import the bean i.e
    <%@ page import="package_name.mybeans.*" %>
    then use the jsb:useBean the way you did
    <jsp:useBean id="test1" class="test1" scope="page" />
    it should then work fine,
    regards

  • Is there any difference between "jsp:useBean" and "scriptlet" ?

    A few days ago, I asked similar question. But I didn't get the answer I wanted.
    I want to know the differnce between <jsp:useBean../> and <% .. %>(scriptlet).
    I tested in three environments(Oracle Jserv, OC4J, and Apache Tomcat).
    In Oracle Jserv and OC4J, a problem occured. But, Apache Tomcat does not occur a problem.
    For example,
    1) TestClass.java (Bean)
    public class TestClass {
    private String txt;
    public class TestClass {
    txt = "Test"; ----- (g
    public String getTxt() {
    return txt;
    2) test.jsp
    <html><body>
    <% TestClass test = new TestClass(); %> ---(h
    <%= test.getTxt() %>
    </body></html>
    Assume that I visit "http://localhost:8888/test.jsp".
    In Tomcat, if I change "Test"(number(g) to "Test1" and compile the browser shows the change.
    But Oracle Jserv and OC4J does not do that. They also show the old String.
    So, I changed <% TestClass test = new TestClass(); %>(number(h) to <jsp:useBean id="test" class="TestClass" />. That is, I changed "Scriptlet" to "JSP useBean Tag".
    Then, Oracle Jserv and OC4J also show the changes.
    To conclude, is there any difference between "JSP useBean Tag" and "Scriptlet"?
    Can't I use a scriptlet (to make a class) in Oracle Servlet Engine?
    Thanks.

    It could be as simple as the JSP not recompiling between java recompiles - ie, it compiles in the link to the old class.
    Try changing the JSP file (add and delete a space) after you change the java code, and then see what happens.
    Jonny
    null

  • JSP useBean and Tomcat NoClassDefFoundError

    Hi,
    I have a webapp on tomcat whose structure is like this
    /tomcat
    --/webapps
    ----/mywebappname
    ------/WEB-INF
    --------/classes
    ----------MyBean.java
    When I use useBean class="MyBean" I get a NoClassDefFoundError for this particular class.
    I suspect this is some kind of classpath issue but do not know how to fix it. Help appreciated.

    place u'r class file in <tomcat-root>/classes folder.
    if there's no such folder ,u'll have to create it.

  • How to assign the class value dynamically  in jsp:useBean ?its urgent

    Hi
    I want to set the class value of <jsp:useBean> dynamically
    when i am trying to this way
    <jsp:useBean id="<%=id %>" class="<%=beanclass %>" scope="request">
    <jsp:setProperty name="<%=id %>" property="*"/>
    </jsp:useBean>
    where beanclass is .class file that is to be used by the usebean tag
    i am getting following error
    The value for the useBean class attribute <%=beanclass %> is invalid.
    please help as soon as possible
    regards,
    Rameshwari

    You can not do that.The jsp:useBean and jsp:setProperty are action tags and not custom tags. Action tags get translated into Java code in the translation unit and are then compiled. Custom tag are backed by classes and the tag get translated into a method call of the class.

  • Jsp:useBean giving error while compiling JSP's in JDeveloper

    Hello,
    I am having another problem with JSP's in JDeveloper 10.1.3. jsp:useBean and jsp:setProperty are all giving problems. I am not sure what I need to do to get rid of this error
    Thanks,
    Lakshmisri

    Your original post mentions issues with jsp:useBean and jsp:setProperty, now you're talking about tag libraries and directives. Can you be more specific about what you're trying to do? Are you having problems getting JDev to recognize a tag library or are you having problems with the tag library when running the app? What directive are you trying to use that causes the termination error?

  • jsp:useBean  class="  expression "   .......

    I need to put the class value of the <jsp:useBean> and take it from a java class on the server.
    I use a method with this signature:
    public String getClassname(...){
    return newclass.toString();
    and put it in the jsp element like:
    <jsp:useBean id="bean1" scope="session" class="<%=utility.getClassName()%>" />
    It does not work while had never problems with a forward element instead like this:
    <jsp:forward page="<%=util.getPage()%>" />
    Did somebody suceed or any suggestions?
    best regards
    Joan

    thanks gray man.
    the
    beanName="=<% classfactory.getHandler()%>"
    inserted in a usebean tag compiles
    but when i call a
    <jsp:setProperty name="bean" property="*"/>
    on this bean I find that all the values are set empty
    like if it is the parent class that gets called and not
    the real subclass that I am casting to with the dynamic
    beanName="=<% classfactory.getHandler()%>" .
    Not found a solution yet wether casting to an interface
    or to a superclass.

  • Use classes in JSP without jsp:useBean

    hi
    i want to instantiate my own classes within a jsp.
    the classes are in web-inf/classes/chat/
    there is one main class which is used all over the app, so i use it with the jsp:useBean and scope on application.
    The messages are saved in objects of the class Message. now i want to use this class in my JSP without useBean.
    Is this possible without extra setting the classpath?!
    I get the error because the interpreter searchs in a package from tomcat itself..
    Thanks a lot and rgds
    Ruven

    I think you can use any class in your jsp file without the <jsp:useBean>, this implies that you have to declare your class in the ordinary way i.e
    <% MyClass c = new MyClass() ;
    //other code
    %>
    the important thing is to use the page directive's import attribute i.e include this line in your jsp page
    <%@ page import="mypackage.inner.MyClass" %> the web containers when sees this line will assume that you have the following directory structure in your web application ( /mywebapps/web-inf/classes/mypackage.inner/* )
    I hope this helps
    Regards

  • Struts, JSP 1.1 spec and WLS 5.1 - issue with useBean and getProperty

    Hi there, I am attempting to compile a JSP page using Struts tag libraries and Weblogic 5.1 with Service Pack 9.I have defined the bean using <jsp:UseBean id="myBean" ... > and then attempt to access its methods using <jsp:getProperty name="myBean" ... > This fails with a 'myBean is not defined as bean' error. When I replace the <jsp:getProperty ...> with a scriptlet e.g. <%= myBean.getCustomerName()%> it compiles and runs just fine.I have read that the WLS server may be enforcing a strict implementation of JSP spec 1.1 which the Struts tags may not be adhering to (?).Oddly, when I start WLS without invoking the Service Pack, the error disappears and the <jsp:getProperty> works as expected!Any official reason for this strange behaviour? ... I'd like to avoid using scriptlets if possible.Thanks in advance,Rash
              

    Hi.
    The following link shows supported versions of apache:
    http://edocs.bea.com/wls/platforms/index.html#apach
    In short, WLS 5.1 does not support Apache 1.3.20. The latest supported version is
    1.3.19.
    Regards,
    Michael
    Mauricio Guerra wrote:
    Hello, i've read all the online documentation regarding the apache plug in for
    weblogic, and i haven't
    found an answer to my question:
    Does weblogic 5.1 sp8 works ok with apache 1.3.20/SSL?
    All the documentation talks mention apache 1.3.12 only...
    thanks,
    Mauricio--
    Michael Young
    Developer Relations Engineer
    BEA Support

  • Jsp:usebean How to get value of an object from a bean

    I am new to JSP and am struggling from past few days to solve a problem. Consider the below scenario
    Class Book{
    private String author;
    public void setAuthor(String author)
    public String getAuthor(){
    return author; }
    Class Rack{
    private Book []books;
    public []Book getbooks()
    return books;
    public void setbooks([]Book val){....}
    Suppose Books gets populated only using Rack and I have Rack populate in my session, using jsp:usebean or any other tag how can I get value of author? Does using tag handle null value check of books, if books are not set by any chance?
    Regards,
    Dhyan

    I got a way out to access the attribute, i feel it is
    <jsp:usebean id="myRack" class="settings.Rack"/>
    <c:foreach var="book" item="myRack.books">
    </c:foreach>
    I am not able to check if this is correct or not because myRack.books is not having any value set by me in the request scope. How do i get instance of Rack class set by another page in the current request? I can get the value if i use scriptlet but i dont want to use scriptlet.
    I am continiously trying, if I get an answer, I shall post, else pls somebody guide.

  • Which one better to use - jsp:useBean or import statement

    Hi,
    I just want to know that which one is better to use jsp:useBean or import statement .
    I can instantiate and call method of myclass -
    1) by importing the class through import tag in jsp as <%@page import="myclass"%. or
    2). by using <jsp:useBean tag....
    i have these two option to do the same thing. i know that basically useBean is used to call setter and getter method of bean class and but it can be used to call a normal java file that have some logic .
    so what should i used , which one is better and why?
    useBean provides scope and object instance so no need to create object by new operator. and with import you have to create an instance .
    but which tag should i use in my jsp?
    i am confused???

    ok, means i can use jsp:useBean tag for all my
    classes that are not actually bean. so it will be
    instantiated at run time and provide efficiency .No. Jsp:useBean is used for java bean components.
    >
    but when should i use import statement in my jsp and
    it happen at translation time so will it create any
    type of burden for my code if i import multiple
    classes.For non-java beans, you need to import the classes, period.
    It's not a burden, it's a necessity.

  • Why do we need jsp:useBean???

    Hi All,
    I am going over both the J2EE tutorial and JSP1.2 spec.
    As far as I read, it seems to me that "jsp:useBean" is a way of creating a bean object.
    <jsp:useBean id="local" scope="application" class="Mylocales">
    If I put the class file in the import statement, can I create the object in the scriptlet
    <% Mylocales local = new Mylocales(); %>
    and set/get properties by calling
    local.setName(); // assume these methods are in the class
    local.getName();
    without using "jsp:setProperty" and "jsp:getProperty".In this way, isn't it a redundancy to have "jsp:useBean" in JSP spec? We can always create any kind of objects in the scriptlets.
    Since "jsp:useBean" has been there for years, I believe something must be wrong with my rationale. However, both the spec and the tutorial couldn't answer this question. Can anyone clear it up to me?
    Thx in advance.
    Kevin

    There's nothing wrong with your rationale; useBean IS a redundant tag, but it does provide some compact functionality without having to write extra code.
    http://java.sun.com/products/jsp/tags/11/syntaxref1115.html covers the syntax of this tag; one advantage of using this tag is the 'scope' attribute, that allows you to define, at object creation, just how long the object will be around. You can limit an object's scope to the page that declared it, or allow it to be accessed by any page that shares the same session, or request, or application.
    I do believe that the main point of this tag comes in at the design level; one of the strongest reasons to use JSPs at all is to separate out the application logic from the page presentation. This means that anyone who can use HTML should be able to maintain the JSP pages in the application. Instead of having to teach a non-programmer a little bit of code, just demonstrate the use of a single tag that can be reused throughout the application. The logical extension of this idea is the tag library.
    Myself, I mix and match as needed, but there are never more than a few lines of scriptlet code in my JSP pages. If there's more code than HTML in my JSP page, I'll go ahead and use a servlet instead.
    Anyway, I guess my point is that JSP pages are flexible, you can pick the functionality that you want to use, and the useBean tag isn't quite superfluous.

  • Jsp:useBean

    I really shouldn't be trying to use JSP any more ...
    I have been having problems using JavaBeans in JSP pages now - every time a problem is solved, that other little thing that always wanted a go at annoying me arrives ...
    The code is:
    <jsp:useBean id="pollResult" scope="application" class="com.ora.jsp.beans.poll.PollBean" />Because another JSP page I created (using JavaBeans) worked, using a JavaBean from the directory com.ora.jsp.beans.userinfo.UserInfoBean, I assumed that THIS would work - but it didn't! The error was:
    org.apache.jasper.JasperException: /calculate.jsp(11,2) According to TLD or attribute directive in tag file, attribute test does not accept any expressionsAnother problem, is there a solution?
    Sincerely, I'm sorry to plague everyone out there with all my problems - maybe I should give up and become a potato farmer instead ...

    Hi
    My Calculate.jsp looks like this:
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <jsp:useBean id="pollResult" scope="application"
      class="com.ora.jsp.beans.poll.PollBean" />
    <jsp:useBean id="answer" class="com.ora.jsp.beans.poll.AnswerBean" >
      <jsp:setProperty name="answer" property="*" />
    </jsp:useBean>
    <c:choose>
      <c:when test="${answer.valid}" >
        <c:set target="${pollResult}" property="answer"
          value="${answer}" />
        <jsp:forward page="result.jsp" />
      </c:when>
      <c:otherwise>
        <jsp:forward page="poll.jsp" />
      </c:otherwise>
    </c:choose>I am using JSTL 1.1.

Maybe you are looking for