Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

tag libraries  RSS feed

 
raghu vadranam
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do i pass the value of request.getparameter() to the attribute of a tag

<mytag:get name=" i need value from a parameter here ">
</mytag>


thank you
 
Ravisekhar Kovuru
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do this by specifying that the value of name attribute is evaluated at runtime. You can do so in the tld file as below:

<tag>
<name>get</name>
<tagclass>....something...</tagclass>
<attribute>
<name>name</name>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>

And in the JSP, use the below code:
<mytag:get name='<%=request.getParameter("paramName")%>'></mytag>

Hope this answers your question.
-Ravi
[ October 29, 2004: Message edited by: K. Ravisekhar Naidu ]
 
Bindesh Vij
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using EL you can do it like this



This simplifies the code.
 
Ravisekhar Kovuru
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI ,
what is 'EL' ?
Can we use that code in a JSP?

-Ravi
 
Bindesh Vij
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EL stands for Expression Language introduced with JSTL..
Yes we can use it with jsp... If you are new to EL the you must read out some tutorial.. probably Sun j2ee tutorial would be the best place to start on.Iam providing some links here


IBM Developerworks
Download JSP book from here
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!