You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by James Howe <jw...@allencreek.com> on 2001/04/18 20:35:00 UTC

Feature request

I'm using the <bean:write> tag to add parameters to a dynamically generated 
URL used by some javascript on my JSP page.  The problem with <bean:write> 
is that it doesn't URL encode the result.  In general, this is probably a 
good thing.  However, there are times when it would be nice to have the 
value encoded.  Would it be possible to add an additional optional tag to 
WriteTag which would indicate whether the result was to be URLEncoded?  The 
default would be false which would not require any changes in current 
code.  Also, if there is an alternative way to get this functionality, 
please let me know.  Unfortunately I can't use the "link" tag in this 
circumstance.

Basically I have a line in my file which looks like this:

<input type="button" ... onClick="self.location="foo.do?key='<bean:write 
...>'">

In other words, I'm building up the parameters to the location URL based on 
property values in a particular bean.

Thanks.


Re: Feature request

Posted by alex <zh...@alegria.co.jp>.
hi all. 

i wonder who can help me resolve this problem.
i am making a program based on struts.
there are some circumstances that serval pages invoke one same
action. and if some errors occured i want to show these errors in 
the previous page, but i cannot judge where the page is, cuz,
there are many pages can invoke this action.



thanks alot

redbeebird.


Re: Feature request

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Wed, 18 Apr 2001, James Howe wrote:

> I'm using the <bean:write> tag to add parameters to a dynamically generated 
> URL used by some javascript on my JSP page.  The problem with <bean:write> 
> is that it doesn't URL encode the result.  In general, this is probably a 
> good thing.  However, there are times when it would be nice to have the 
> value encoded.  Would it be possible to add an additional optional tag to 
> WriteTag which would indicate whether the result was to be URLEncoded?  The 
> default would be false which would not require any changes in current 
> code.  Also, if there is an alternative way to get this functionality, 
> please let me know.  Unfortunately I can't use the "link" tag in this 
> circumstance.
> 
> Basically I have a line in my file which looks like this:
> 
> <input type="button" ... onClick="self.location="foo.do?key='<bean:write 
> ...>'">
> 
> In other words, I'm building up the parameters to the location URL based on 
> property values in a particular bean.
> 
> Thanks.
> 
> 

Just to avoid confusion, are you talking about calling
response.encodeURL() to make sure that the session id is included for
clients that do not use cookies?  If so, doing it only on the value of the
"key" parameter (as shown in your example above) would not be sufficient
even if it was supported -- you can only call encodeURL() with the
*entire* URL you want to have encoded.

However, that doesn't mean an encode="true" option might not be
useful.  It would go along with the filter attribute (to filter out
characters sensitive in HTML) that defaults to "true".

Craig