• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

s:url

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Can any of you please tell me how attributes of <s:url>, the includeParams and encode, will work.

Thanks

Aneesh
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From the <s:url...> documentation:

encode: whether to encode parameters.

This determines whether or not the parameters will be URL-encoded.

includeParams: The includeParams attribute may have the value 'none', 'get' or 'all'.

This determines if the current page's parameters will be included in the generated URL. With a value of "get" only the parameters included on the current page's URL will be included. With "all" *all* of the parameters (for instance, from a POST) will be included (IIRC). With "none", none will.
[ December 11, 2008: Message edited by: David Newton ]
 
aneesh vijayakumar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks David,

I have given like this.

<s:url id="viewUrl" encode="true" includeParams="none" action="partView" namespace="../public"><s aram name="itemid" value="itemId" /></s:url>

if i am giving like this won't the itemId be passed?

Thanks
Aneesh
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, it will, if itemId has a value.

For example, if I have an action with a visible "itemId" property the following JSP works as expected:



As an aside, namespace="../public" may generate the correct URL, but seems a bit weird. If the action is defined in a package with the namespace "/public" then the appropriate usage would be namespace="/public".
[ December 11, 2008: Message edited by: David Newton ]
 
aneesh vijayakumar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Thanks David,/public will be alright for me, again thanks.


if I give the <s:url> us mentioned above, the url will look like

http://localhost:8282/Autos/pages/sell/public/partView.action?itemid=30

I have included includeParams="none", then why the itemid is being viewed in the url?

I dont want this itemid to be dispalyed in the url.
Can any one help me to hide or encrypt the itemid=30(other parameters,if any) in the url?

Thanks
Aneesh

[ December 11, 2008: Message edited by: aneesh vijayakumar ]
[ December 11, 2008: Message edited by: aneesh vijayakumar ]
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
...

It's being displayed because you're giving it a parameter.

If you don't want it *displayed* there are a few options including a POST form or JavaScript. If you want it *encrypted* you'll have to do that yourself, or search for a URL encryption library.

You could also check the Struts 2 plugins list to see if a plugin already exists; I don't recall any off the top of my head. It would be easy enough to write, though, and contribute back to the project.
 
reply
    Bookmark Topic Watch Topic
  • New Topic