aspose file tools*
The moose likes Struts and the fly likes Jstl with Struts Html tags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Jstl with Struts Html tags" Watch "Jstl with Struts Html tags" New topic
Author

Jstl with Struts Html tags

J Bhatt
Greenhorn

Joined: Jun 15, 2005
Posts: 20
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

Joined: Feb 15, 2005
Posts: 4864
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:


Merrill
Consultant, Sima Solutions
J Bhatt
Greenhorn

Joined: Jun 15, 2005
Posts: 20
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

Joined: Feb 15, 2005
Posts: 4864
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

Joined: Jun 15, 2005
Posts: 20
Thank You ,
That worked.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jstl with Struts Html tags