• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jstl with Struts Html tags

 
J Bhatt
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to get jstl tags work with struts html tags.
I am trying to do something like this, I am not able to assign the proprty of the radio butto.



Is there a way I can get the "id" variable's property out using a scriptlet?
like <html:radio property='<%=<c ut value="${id.property}"/>%>' ???

Thank you very much.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When mixing JSTL tags with Struts tags, your best bet is to use the struts-el version of the tags.

To do this, put the following line in your jsp:

<%@ taglib uri="http://jakarta.apache.org/struts/tags-html-el" prefix="html-el"%>

Also, make sure that struts-el.jar is in your WEB-INF/lib directory.

Then you can just do this:
 
J Bhatt
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much,,
I was just trying to get this thing working without using the html-el tags because we have a custom implementation of struts tags ,and html-el tags might not work well with it.
This is something that I tried to do :

I am thinking that <%=question.property%> should be able to get the property out of the question , and set it in the html radio.,like below

This doesn't seem to work either, is there a way to get this working ?
Thanks Again.
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember that anything you put between <%= %> brackets must be a java expression.

Try:

<%=((com.vo.Question)pageContext.getAttribute("question")).getProperty()%>

the <jsp:useBean> is unnecessary because the default scope for any JSTL variable is page.
 
J Bhatt
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You ,
That worked.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic