You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Vinny <xa...@gmail.com> on 2008/02/13 19:07:59 UTC

Re: [S2] encode

I am having an issue with s:url as well
I set s:url's  encode="true"

I want to Data.asp?id=1&subId=2 to look like: Data%2Easp%3Fid%3D1%26subId%3D2

What I get instead is Data.asp?id=1&amp;subId=2
Is this the expected behavior?
Don't know if this is the problem the original poster had.

Thanks


On Jan 13, 2008 6:34 PM, Laurie Harper <la...@holoweb.net> wrote:
> GF wrote:
> > Hi all
> > I'm using Struts 2.0.6 If I try to set "encode" to true and I pass in
> > the URL get some bad characters.. such as '<', '>' it doesn't encode
> > them when it generates the URL with <s:url >
> > Is this a bug? Has been fixed in recent version?
> > Thanks
>
> s:url sets encode to true by default, but the documentation for that
> attribute says, "Whether to encode parameters." What are you passing in,
> what are you getting out, and what were you expecting to get back?
> Sample code showing how you're using the tag would also be useful.
>
> L.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
The future is here. It's just not widely distributed yet.
-William Gibson

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


Re: [S2] encode

Posted by Laurie Harper <la...@holoweb.net>.
That's the expected behaviour; s:url's encode attribute specifies that 
each parameter should be encoded, not that the entire result should be. 
If it gave what you're expecting, it wouldn't be giving back a valid URL.

What you need to do is store the url in a variable (using <s:url 
var="url"...) and then encode the result (e.g. with <s:property 
value="%{url} encode=true"...).

L.

Vinny wrote:
> I am having an issue with s:url as well
> I set s:url's  encode="true"
> 
> I want to Data.asp?id=1&subId=2 to look like: Data%2Easp%3Fid%3D1%26subId%3D2
> 
> What I get instead is Data.asp?id=1&amp;subId=2
> Is this the expected behavior?
> Don't know if this is the problem the original poster had.
> 
> Thanks
> 
> 
> On Jan 13, 2008 6:34 PM, Laurie Harper <la...@holoweb.net> wrote:
>> GF wrote:
>>> Hi all
>>> I'm using Struts 2.0.6 If I try to set "encode" to true and I pass in
>>> the URL get some bad characters.. such as '<', '>' it doesn't encode
>>> them when it generates the URL with <s:url >
>>> Is this a bug? Has been fixed in recent version?
>>> Thanks
>> s:url sets encode to true by default, but the documentation for that
>> attribute says, "Whether to encode parameters." What are you passing in,
>> what are you getting out, and what were you expecting to get back?
>> Sample code showing how you're using the tag would also be useful.
>>
>> L.
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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] : Help with annotated validation

Posted by Dave Newton <ne...@yahoo.com>.
--- "Zheng, Xiahong" <Xi...@FMR.COM> wrote:
> Followup question: If I use the same action class to handle both the
> form rendering and submission, how do I avoid validation on the
> rendering phase? I use the HTTP method to tell whether it is a form
> submission or not. My problem is validation error shows up on the
> initial form displaying. Do I have to have two actions in this scenario?

Not necessarily; you can also create an action *mapping* that specifies the
"input" method, since validation is skipped on several methods, one of which
being "input".

Dave

> From: Zheng, Xiahong 
> Sent: Wednesday, February 13, 2008 2:55 PM
> To: Struts Users Mailing List
> Subject: RE: [S2] : Help with annotated validation
> 
> That's indeed what I am missing. Thanks for your prompt help. 
> 
> -----Original Message-----
> From: Dave Newton [mailto:newton.dave@yahoo.com] 
> Sent: Wednesday, February 13, 2008 2:48 PM
> To: Struts Users Mailing List
> Subject: Re: [S2] : Help with annotated validation
> 
> --- "Zheng, Xiahong" <Xi...@FMR.COM> wrote:
> > My annotated validation doesn't happen. The following are the code
> > snippets for action class and config files. When I leave the SSN field
> > blank and hit submit my action's execute method is called hence fails
> > instead of redisplay of the login page again with validation error
> > message. What am I missing here? 
> > [...]
> > <action name="login" class="my.pacakge.LoginAction">
> > 	<result>home</result>
> >       <result name="failed">loginError</result>
> > 	<interceptor-ref name="autowiring"/>
> >       <interceptor-ref name="params"/>
> >       <interceptor-ref name="validate"/>
> >       <interceptor-ref name="workflow"/>
> > </action>
> 
> Do you have an "input" result defined?
> 
> If you have logging turned up you should see a reference to the
> inability to
> find an "input" result, which is where the "workflow" interceptor will
> go to
> when there are validation errors.
> 
> Dave
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> ---------------------------------------------------------------------
> 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] : Help with annotated validation

Posted by "Zheng, Xiahong" <Xi...@FMR.COM>.
Followup question: If I use the same action class to handle both the
form rendering and submission, how do I avoid validation on the
rendering phase? I use the HTTP method to tell whether it is a form
submission or not. My problem is validation error shows up on the
initial form displaying. Do I have to have two actions in this scenario?


-----Original Message-----
From: Zheng, Xiahong 
Sent: Wednesday, February 13, 2008 2:55 PM
To: Struts Users Mailing List
Subject: RE: [S2] : Help with annotated validation

That's indeed what I am missing. Thanks for your prompt help. 

-----Original Message-----
From: Dave Newton [mailto:newton.dave@yahoo.com] 
Sent: Wednesday, February 13, 2008 2:48 PM
To: Struts Users Mailing List
Subject: Re: [S2] : Help with annotated validation

--- "Zheng, Xiahong" <Xi...@FMR.COM> wrote:
> My annotated validation doesn't happen. The following are the code
> snippets for action class and config files. When I leave the SSN field
> blank and hit submit my action's execute method is called hence fails
> instead of redisplay of the login page again with validation error
> message. What am I missing here? 
> [...]
> <action name="login" class="my.pacakge.LoginAction">
> 	<result>home</result>
>       <result name="failed">loginError</result>
> 	<interceptor-ref name="autowiring"/>
>       <interceptor-ref name="params"/>
>       <interceptor-ref name="validate"/>
>       <interceptor-ref name="workflow"/>
> </action>

Do you have an "input" result defined?

If you have logging turned up you should see a reference to the
inability to
find an "input" result, which is where the "workflow" interceptor will
go to
when there are validation errors.

Dave


---------------------------------------------------------------------
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


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


RE: Logic tag library

Posted by Dave Newton <ne...@yahoo.com>.
--- "Allen, Daniel" <Da...@kbcfp.com> wrote:
> Keeping <logic:> tags actually renders perfectly well for me right now
> (no exceptions, no apparent problems with the resulting page), but with
> peculiar results for the actual logic it's supposed to be doing, so I
> wasn't sure whether that was a configuration issue making it not
> evaluate correctly, or a Struts1 configuration relic making it still
> quasi-functional. I suppose the latter, then.

Well, I suppose if you're using EL then the S2 request wrapper will still
look in the value stack for whatever the EL evaluates to... I sure wouldn't
rely on it working, though, and it seems kind of counter-intuitive since S1
and S2 are *completely* different.

Dave



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


RE: Logic tag library

Posted by "Allen, Daniel" <Da...@kbcfp.com>.
Keeping <logic:> tags actually renders perfectly well for me right now
(no exceptions, no apparent problems with the resulting page), but with
peculiar results for the actual logic it's supposed to be doing, so I
wasn't sure whether that was a configuration issue making it not
evaluate correctly, or a Struts1 configuration relic making it still
quasi-functional. I suppose the latter, then.

I didn't see the previous answer about MessagesPresent, but sometimes we
have brief e-mail outages here, so thanks for bearing with me (whether
that's our IT or just my fault).
~Dan



-----Original Message-----
From: Dave Newton [mailto:newton.dave@yahoo.com] 
Sent: Wednesday, February 13, 2008 3:36 PM
To: Struts Users Mailing List
Subject: Re: Logic tag library

--- "Allen, Daniel" <Da...@kbcfp.com> wrote:
> Is there any reason we shouldn't use the Logic tab library
> (http://struts.apache.org/tags-logic) with Struts 2? 

Because it won't work.

> If so, is there any subsitute?
> I'm looking specifically for <logic:redirect> and
> <logic:messagesPresent> (along with the old <html: messages>)

I thought I already answered the <logic:messagesPresent.../> question:
expose
ActionSupport's ValidationAware stuff related to whether or not there
are
messages. AFAIK there is pre-built tag support for this, but it's a
simple
<s:if...> with exposed ValidationAware booleans.

W.r.t. <html:messages/> see the <s:actionerror.../> and
<s:actionmessage.../>
tags [1, 2]. The tag reference page [3] may also be of interest.

Not sure why the rest of the hijacked thread is still here; is it
related
somehow?

Dave

[1] http://struts.apache.org/2.x/docs/actionerror.html
[2] http://struts.apache.org/2.x/docs/actionmessage.html
[3] http://struts.apache.org/2.x/docs/tag-reference.html

-- 
This message may contain confidential, proprietary, or legally privileged information. No confidentiality or privilege is waived by any transmission to an unintended recipient. If you are not an intended recipient, please notify the sender and delete this message immediately. Any views expressed in this message are those of the sender, not those of any entity within the KBC Financial Products group of companies (together referred to as "KBC FP"). 

This message does not create any obligation, contractual or otherwise, on the part of KBC FP. It is not an offer (or solicitation of an offer) of, or a recommendation to buy or sell, any financial product. Any prices or other values included in this message are indicative only, and do not necessarily represent current market prices, prices at which KBC FP would enter into a transaction, or prices at which similar transactions may be carried on KBC FP's own books. The information contained in this message is provided "as is", without representations or warranties, express or implied, of any kind. Past performance is not indicative of future returns.


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


Re: Logic tag library

Posted by Dave Newton <ne...@yahoo.com>.
--- "Allen, Daniel" <Da...@kbcfp.com> wrote:
> Is there any reason we shouldn't use the Logic tab library
> (http://struts.apache.org/tags-logic) with Struts 2? 

Because it won't work.

> If so, is there any subsitute?
> I'm looking specifically for <logic:redirect> and
> <logic:messagesPresent> (along with the old <html: messages>)

I thought I already answered the <logic:messagesPresent.../> question: expose
ActionSupport's ValidationAware stuff related to whether or not there are
messages. AFAIK there is pre-built tag support for this, but it's a simple
<s:if...> with exposed ValidationAware booleans.

W.r.t. <html:messages/> see the <s:actionerror.../> and <s:actionmessage.../>
tags [1, 2]. The tag reference page [3] may also be of interest.

Not sure why the rest of the hijacked thread is still here; is it related
somehow?

Dave

[1] http://struts.apache.org/2.x/docs/actionerror.html
[2] http://struts.apache.org/2.x/docs/actionmessage.html
[3] http://struts.apache.org/2.x/docs/tag-reference.html

> From: Zheng, Xiahong [mailto:Xiahong.Zheng@FMR.COM] 
> Sent: Wednesday, February 13, 2008 2:55 PM
> To: Struts Users Mailing List
> Subject: RE: [S2] : Help with annotated validation
> 
> That's indeed what I am missing. Thanks for your prompt help. 
> 
> -----Original Message-----
> From: Dave Newton [mailto:newton.dave@yahoo.com] 
> Sent: Wednesday, February 13, 2008 2:48 PM
> To: Struts Users Mailing List
> Subject: Re: [S2] : Help with annotated validation
> 
> --- "Zheng, Xiahong" <Xi...@FMR.COM> wrote:
> > My annotated validation doesn't happen. The following are the code
> > snippets for action class and config files. When I leave the SSN field
> > blank and hit submit my action's execute method is called hence fails
> > instead of redisplay of the login page again with validation error
> > message. What am I missing here? 
> > [...]
> > <action name="login" class="my.pacakge.LoginAction">
> > 	<result>home</result>
> >       <result name="failed">loginError</result>
> > 	<interceptor-ref name="autowiring"/>
> >       <interceptor-ref name="params"/>
> >       <interceptor-ref name="validate"/>
> >       <interceptor-ref name="workflow"/>
> > </action>
> 
> Do you have an "input" result defined?
> 
> If you have logging turned up you should see a reference to the
> inability to
> find an "input" result, which is where the "workflow" interceptor will
> go to
> when there are validation errors.
> 
> Dave
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 
> -- 
> This message may contain confidential, proprietary, or legally privileged
> information. No confidentiality or privilege is waived by any transmission
> to an unintended recipient. If you are not an intended recipient, please
> notify the sender and delete this message immediately. Any views expressed
> in this message are those of the sender, not those of any entity within the
> KBC Financial Products group of companies (together referred to as "KBC
> FP"). 
> 
> This message does not create any obligation, contractual or otherwise, on
> the part of KBC FP. It is not an offer (or solicitation of an offer) of, or
> a recommendation to buy or sell, any financial product. Any prices or other
> values included in this message are indicative only, and do not necessarily
> represent current market prices, prices at which KBC FP would enter into a
> transaction, or prices at which similar transactions may be carried on KBC
> FP's own books. The information contained in this message is provided "as
> is", without representations or warranties, express or implied, of any
> kind. Past performance is not indicative of future returns.
> 
> 
> ---------------------------------------------------------------------
> 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


Logic tag library

Posted by "Allen, Daniel" <Da...@kbcfp.com>.
Is there any reason we shouldn't use the Logic tab library
(http://struts.apache.org/tags-logic) with Struts 2? If so, is there any
subsitute? I'm looking specifically for <logic:redirect> and
<logic:messagesPresent> (along with the old <html: messages>)

~Dan Allen

-----Original Message-----
From: Zheng, Xiahong [mailto:Xiahong.Zheng@FMR.COM] 
Sent: Wednesday, February 13, 2008 2:55 PM
To: Struts Users Mailing List
Subject: RE: [S2] : Help with annotated validation

That's indeed what I am missing. Thanks for your prompt help. 

-----Original Message-----
From: Dave Newton [mailto:newton.dave@yahoo.com] 
Sent: Wednesday, February 13, 2008 2:48 PM
To: Struts Users Mailing List
Subject: Re: [S2] : Help with annotated validation

--- "Zheng, Xiahong" <Xi...@FMR.COM> wrote:
> My annotated validation doesn't happen. The following are the code
> snippets for action class and config files. When I leave the SSN field
> blank and hit submit my action's execute method is called hence fails
> instead of redisplay of the login page again with validation error
> message. What am I missing here? 
> [...]
> <action name="login" class="my.pacakge.LoginAction">
> 	<result>home</result>
>       <result name="failed">loginError</result>
> 	<interceptor-ref name="autowiring"/>
>       <interceptor-ref name="params"/>
>       <interceptor-ref name="validate"/>
>       <interceptor-ref name="workflow"/>
> </action>

Do you have an "input" result defined?

If you have logging turned up you should see a reference to the
inability to
find an "input" result, which is where the "workflow" interceptor will
go to
when there are validation errors.

Dave


---------------------------------------------------------------------
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


-- 
This message may contain confidential, proprietary, or legally privileged information. No confidentiality or privilege is waived by any transmission to an unintended recipient. If you are not an intended recipient, please notify the sender and delete this message immediately. Any views expressed in this message are those of the sender, not those of any entity within the KBC Financial Products group of companies (together referred to as "KBC FP"). 

This message does not create any obligation, contractual or otherwise, on the part of KBC FP. It is not an offer (or solicitation of an offer) of, or a recommendation to buy or sell, any financial product. Any prices or other values included in this message are indicative only, and do not necessarily represent current market prices, prices at which KBC FP would enter into a transaction, or prices at which similar transactions may be carried on KBC FP's own books. The information contained in this message is provided "as is", without representations or warranties, express or implied, of any kind. Past performance is not indicative of future returns.


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


RE: [S2] : Help with annotated validation

Posted by "Zheng, Xiahong" <Xi...@FMR.COM>.
That's indeed what I am missing. Thanks for your prompt help. 

-----Original Message-----
From: Dave Newton [mailto:newton.dave@yahoo.com] 
Sent: Wednesday, February 13, 2008 2:48 PM
To: Struts Users Mailing List
Subject: Re: [S2] : Help with annotated validation

--- "Zheng, Xiahong" <Xi...@FMR.COM> wrote:
> My annotated validation doesn't happen. The following are the code
> snippets for action class and config files. When I leave the SSN field
> blank and hit submit my action's execute method is called hence fails
> instead of redisplay of the login page again with validation error
> message. What am I missing here? 
> [...]
> <action name="login" class="my.pacakge.LoginAction">
> 	<result>home</result>
>       <result name="failed">loginError</result>
> 	<interceptor-ref name="autowiring"/>
>       <interceptor-ref name="params"/>
>       <interceptor-ref name="validate"/>
>       <interceptor-ref name="workflow"/>
> </action>

Do you have an "input" result defined?

If you have logging turned up you should see a reference to the
inability to
find an "input" result, which is where the "workflow" interceptor will
go to
when there are validation errors.

Dave


---------------------------------------------------------------------
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] : Help with annotated validation

Posted by Dave Newton <ne...@yahoo.com>.
--- "Zheng, Xiahong" <Xi...@FMR.COM> wrote:
> My annotated validation doesn't happen. The following are the code
> snippets for action class and config files. When I leave the SSN field
> blank and hit submit my action's execute method is called hence fails
> instead of redisplay of the login page again with validation error
> message. What am I missing here? 
> [...]
> <action name="login" class="my.pacakge.LoginAction">
> 	<result>home</result>
>       <result name="failed">loginError</result>
> 	<interceptor-ref name="autowiring"/>
>       <interceptor-ref name="params"/>
>       <interceptor-ref name="validate"/>
>       <interceptor-ref name="workflow"/>
> </action>

Do you have an "input" result defined?

If you have logging turned up you should see a reference to the inability to
find an "input" result, which is where the "workflow" interceptor will go to
when there are validation errors.

Dave


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


[S2] : Help with annotated validation

Posted by "Zheng, Xiahong" <Xi...@FMR.COM>.
My annotated validation doesn't happen. The following are the code
snippets for action class and config files. When I leave the SSN field
blank and hit submit my action's execute method is called hence fails
instead of redisplay of the login page again with validation error
message. What am I missing here? 

LoginAction.java

Import my.package.actions

@Valiation()
Public class LoginAction extends ActionSupport {

//

@RequiredStringValidator(message="Please enter SSN")
Public void setSsn(String ssn){
	this.ssn = ssn;
}

//

Public String execute() throws Exception {
	// authenticate user here
}

}

Web.xml

Added filter init param

<init-param>
   <param-name>actionPackages</param-name>
   <param-value>my.package.actions</param-value>
</init-param>


Struts.xml

<action name="login" class="my.pacakge.LoginAction">
	<result>home</result>
      <result name="failed">loginError</result>
	<interceptor-ref name="autowiring"/>
      <interceptor-ref name="params"/>
      <interceptor-ref name="validate"/>
      <interceptor-ref name="workflow"/>
</action>

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