You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jeromy Evans <je...@blueskyminds.com.au> on 2008/04/23 14:51:56 UTC

Re: S2
Stefan Gebhardt wrote:
> Hi s2 users!
> I like to render a html button element.
>
>   <s:submit type="button" title="new" value="%{getText('common.themes.'+#attr.THEME+'.editing.new')}"
>         cssClass="${pageScope.divClass}" id="btn_new"/>
>
> Most of the times <s:submit does not render the title attribute. what i get on the page is
> <button id="btn_new" class="localTooltipSensitiv create" value="New" type="submit">New</button>
> sometimes i get
> <button id="btn_new" class="localTooltipSensitiv create" title="" value="New" type="submit">New</button>
>
> Both result are not correct. Is it a bug? Did i make a mistake? Can you give me hint, please?
>
> greets
> stefan gebhardt
>   
Congratulations, you've managed to hit three struts issues in one go:
 1. OGNL is confusing
 2. Struts2 doens't provide enough developer feedback
 3. struts2 submit tag of type button doesn't support the title attribute

Explanation:
1. Like most attributes of Struts 2 tags, the title attribute is 
evaluated as an OGNL expression.  By coincidence, you've used the 
reserved word 'new'.

I think the first issue may be that 'new' is an invalid expression 
and/or causes conflicts.  First, force it to a string to avoid that risk:

<s:submit type="button" title="%{'new'}" ...

2. You may not be getting any useful feedback about it (such as invalid 
expression or invalid property) because you're not using a recent 
version of Struts2.  This is evident by this line:

 cssClass="${pageScope.divClass}" id="btn_new"/>

which has not been supported since 2.0.10.  I have tried it in Struts 
2.1.1 though and it still evaluates title="new" to the literal string 
"new" without any warnings.

3. The template for the submit tag is indeed missing the title 
attribute. The tag supports it but not the template. You'll have to 
create a custom template to enable it.  Feel free to raise an issue in 
JIRA if there isn't one already there for this.

Creating a custom template is straight-forward. Copy the submit.ftl 
template out of the struts2-core jar and modify it as described here:
http://struts.apache.org/2.0.11.1/docs/extending-themes.html
You need to add 3 lines to the template which you'll see there already 
for type=submit

Hope that helps,
Jeromy Evans




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: S2 Posted by Martin Gainty <mg...@hotmail.com>.
submit.ftl<#if parameters.title?exists>
 title="${parameters.title?html}"<#rt/>
</#if>
----- Original Message -----
From: "Stefan Gebhardt" <st...@abas.de>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Wednesday, April 23, 2008 8:59 AM
Subject: Re: S2 <s:submit not reliable?


> On Wednesday 23 April 2008 14:51:56 Jeromy Evans wrote:
> > Stefan Gebhardt wrote:
> > > Hi s2 users!
> > > I like to render a html button element.
> > >
> > >   <s:submit type="button" title="new"
value="%{getText('common.themes.'+#attr.THEME+'.editing.new')}"
> > >         cssClass="${pageScope.divClass}" id="btn_new"/>
> > >
> > > Most of the times <s:submit does not render the title attribute. what
i get on the page is
> > > <button id="btn_new" class="localTooltipSensitiv create" value="New"
type="submit">New</button>
> > > sometimes i get
> > > <button id="btn_new" class="localTooltipSensitiv create" title=""
value="New" type="submit">New</button>
> > >
> > > Both result are not correct. Is it a bug? Did i make a mistake? Can
you give me hint, please?
> > >
> > > greets
> > > stefan gebhardt
> > >
> > Congratulations, you've managed to hit three struts issues in one go:
> >  1. OGNL is confusing
> >  2. Struts2 doens't provide enough developer feedback
> >  3. struts2 submit tag of type button doesn't support the title
attribute
> >
> > Explanation:
> > 1. Like most attributes of Struts 2 tags, the title attribute is
> > evaluated as an OGNL expression.  By coincidence, you've used the
> > reserved word 'new'.
> >
> > I think the first issue may be that 'new' is an invalid expression
> > and/or causes conflicts.  First, force it to a string to avoid that
risk:
> >
> > <s:submit type="button" title="%{'new'}" ...
> >
> > 2. You may not be getting any useful feedback about it (such as invalid
> > expression or invalid property) because you're not using a recent
> > version of Struts2.  This is evident by this line:
> >
> >  cssClass="${pageScope.divClass}" id="btn_new"/>
> >
> > which has not been supported since 2.0.10.  I have tried it in Struts
> > 2.1.1 though and it still evaluates title="new" to the literal string
> > "new" without any warnings.
> >
> > 3. The template for the submit tag is indeed missing the title
> > attribute. The tag supports it but not the template. You'll have to
> > create a custom template to enable it.  Feel free to raise an issue in
> > JIRA if there isn't one already there for this.
> >
> > Creating a custom template is straight-forward. Copy the submit.ftl
> > template out of the struts2-core jar and modify it as described here:
> > http://struts.apache.org/2.0.11.1/docs/extending-themes.html
> > You need to add 3 lines to the template which you'll see there already
> > for type=submit
> >
> > Hope that helps,
> > Jeromy Evans
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
>
> Hey Hey great answer! Thank you a lot.
>
> it helped
> stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: S2 Posted by Stefan Gebhardt <st...@abas.de>.
On Wednesday 23 April 2008 14:51:56 Jeromy Evans wrote:
> Stefan Gebhardt wrote:
> > Hi s2 users!
> > I like to render a html button element.
> >
> >   <s:submit type="button" title="new" value="%{getText('common.themes.'+#attr.THEME+'.editing.new')}"
> >         cssClass="${pageScope.divClass}" id="btn_new"/>
> >
> > Most of the times <s:submit does not render the title attribute. what i get on the page is
> > <button id="btn_new" class="localTooltipSensitiv create" value="New" type="submit">New</button>
> > sometimes i get
> > <button id="btn_new" class="localTooltipSensitiv create" title="" value="New" type="submit">New</button>
> >
> > Both result are not correct. Is it a bug? Did i make a mistake? Can you give me hint, please?
> >
> > greets
> > stefan gebhardt
> >   
> Congratulations, you've managed to hit three struts issues in one go:
>  1. OGNL is confusing
>  2. Struts2 doens't provide enough developer feedback
>  3. struts2 submit tag of type button doesn't support the title attribute
> 
> Explanation:
> 1. Like most attributes of Struts 2 tags, the title attribute is 
> evaluated as an OGNL expression.  By coincidence, you've used the 
> reserved word 'new'.
> 
> I think the first issue may be that 'new' is an invalid expression 
> and/or causes conflicts.  First, force it to a string to avoid that risk:
> 
> <s:submit type="button" title="%{'new'}" ...
> 
> 2. You may not be getting any useful feedback about it (such as invalid 
> expression or invalid property) because you're not using a recent 
> version of Struts2.  This is evident by this line:
> 
>  cssClass="${pageScope.divClass}" id="btn_new"/>
> 
> which has not been supported since 2.0.10.  I have tried it in Struts 
> 2.1.1 though and it still evaluates title="new" to the literal string 
> "new" without any warnings.
> 
> 3. The template for the submit tag is indeed missing the title 
> attribute. The tag supports it but not the template. You'll have to 
> create a custom template to enable it.  Feel free to raise an issue in 
> JIRA if there isn't one already there for this.
> 
> Creating a custom template is straight-forward. Copy the submit.ftl 
> template out of the struts2-core jar and modify it as described here:
> http://struts.apache.org/2.0.11.1/docs/extending-themes.html
> You need to add 3 lines to the template which you'll see there already 
> for type=submit
> 
> Hope that helps,
> Jeromy Evans
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

Hey Hey great answer! Thank you a lot. 

it helped
stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org