Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt on the usage of jsp:usBean

 
XiuQing Lin
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

When we use jsp:useBean to newly declare a variable with the name identified by "id", for eg in the following: the new variable called connection.
<jsp:useBean id="connection" class="com.myco.myapp.Connection" />

My doubt is can we use this variable elsewhere besides in standard action tags? (like in an EL expression or JSTL tag)

Thanks for reading.
 
Biba Basnetti
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes

<jsp:useBean id="xBean" class="com.xBean"/>

now you can use xBean in

${xBean.y}

or

<%= xBean.getY() %>
 
XiuQing Lin
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.

Does that mean if we want to use xBean as as identifer in the following, is it Compulsory to declare it using <jsp:useBean> first?

EL
${xBean.y}
${xBean["y"]}

JSTL
<c:set var="xBean" value="value"/>


Thanks for reading.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic