Hi Chris,
To get the URL, you can simply use <stripes:url beanclass="..."
var="someVar"><stripes:param .../></stripes:url>,  and then in
JavaScript, get it with "${someVar}". No need to hide the link nor
extract the href.
To get just the ID, you can have, on your action bean, public String
getEncryptedId() { return
CryptoUtil.encrypt(String.valueOf(item.getId())); } and then in
JavaScript use var encryptedId = "${actionBean.encryptedId}".
I suppose that within a form you could also try <stripes:hidden
id="itemId" name="item.id"/> and then get it with $("#itemId").val().
Hope that helps,
Freddy

On Thu, Oct 3, 2013, at 01:10 PM, Chris Cheshire wrote:

I am trying to use the encrypted validation for my object ids and it
sort of works.

stripes:link, stripes:hidden etc all encrypt/decrypt the parameter
properly and urls are built nicely. However, if I access the parameter
via jsp-el, eg ${[1]item.id}, then it gives me the unencrypted value.

I have a heavy ajax page that needs to put the encrypted item id in
urls for the ajax handler but I can't build the urls with

$.ajax({ url: 'path to whatever/' + ${[2]item.id} ... });

because the item id is not encrypted when accessed this way

What I have had to resort to is using stripes:link to build a link in
the page, hiding it, and extracting the href from it so that the
parameter is correct.

<stripes:link beanclass="..." style="display:none"
id="link"><stripes:param name="id" value="${[3]item.id}"
/></stripes:link>
then

$.ajax({ url: $('#link').attr('href') ... });

Is there a better way to do this? What about when I need the ID but not
in a link, or some other stripes controlled tag?
How do I get a parameter in its encrypted form?

Thanks
Chris

-----------------------------------------------------------------------
-------

October Webinars: Code for Performance

Free Intel webinars can help you accelerate application performance.

Explore tips for MPI, OpenMP, advanced profiling, and more. Get the
most from

the latest Intel processors and coprocessors. See abstracts and
register >

[4]http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg
.clktrk

_______________________________________________

Stripes-users mailing list

[5]Stripes-users@lists.sourceforge.net

[6]https://lists.sourceforge.net/lists/listinfo/stripes-users

References

1. http://item.id/
2. http://item.id/
3. http://item.id/
4. http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
5. mailto:Stripes-users@lists.sourceforge.net
6. https://lists.sourceforge.net/lists/listinfo/stripes-users
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to