You can either add the support in your tag to handle the OGNL yourself (it's
not too hard, but then again it ain't easy either).  Or you can use the
"var" (or "id") attribute support that most of the struts tags have to move
the value from the OGNL stack to the page scope where the JSTL EL tags can
see it, then use the ${} notation to pass the values into your tags.

If you decide to go the first route, let me know and I may be able to point
you in a workable direction (I can't say for sure that it's the right
direction, but it works well for me)
  (*Chris*)

On Thu, Sep 11, 2008 at 9:22 PM, Haulyn R. Jason <[EMAIL PROTECTED]>wrote:

> Hi,all
> I design a tag, it's very common and it's a jsp tag, the code is like:
>
> -------------------------------------------------------------------------------------------------------------------
> public class NewsCommentTag extends TagSupport {
>
> /**
> *
> */
> private static final long serialVersionUID = 2335725745314009551L;
>
> @Override
> public int doStartTag() throws JspException {
>
> -------------------------------------------------------------------------------------------------------------------
> Nothing special. Then I use it in jsp page like:
> <newscomment:comment news="%{news.title}" category="%{news.category}">
>
> </newscomment>
>
> But I can not retrieve anything in my tag class using set and get methods.
>
> Then I write: <s:property value="%{news.title}"></s:property>,
> the page could print the correct result.
>
> Can't I use OGNL expression in user-defined jsp tag? or there are other
> roles?
>
>
> I use struts2.0.12.
>
> Thanks!
>
> --
>
> Thanks!
>
> Mobile: +086-15864011231
> Website:http://www.openmotel.cn
>        http://www.vvthumb.com
> GTalk:[EMAIL PROTECTED] <[EMAIL PROTECTED]>
> Skype:saharabear
>
>
> Haulyn Runner Jason
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to