File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes how to encode the url in strut2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to encode the url in strut2" Watch "how to encode the url in strut2" New topic
Author

how to encode the url in strut2

pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 300
Hi,

How to encode the url in strut2
as i have this url.
inscreenlist!show.action?candidate_id=<s:property value="candidate_id" />

Please help me.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

What are you actually trying to accomplish? Do you really want to encode the string "<s:property..." or do you want the value of the candidate ID?

If the latter, it depends on how you're trying to generate the URL, so without more info, it's tough to help.

If the former, why?!>
pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 300
i want to encode this .

<s:property value="candidate_id" />
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

...

Do you want the tag itself in the URL, or do you want the candidate's ID in the URL (like as a parameter)?

I wrote: If the latter, ***it depends on how you're trying to generate the URL***, so without more info, it's tough to help.

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Rather than going back and forth several more times, I'll just throw out some random answers, and maybe one of them will be the one you need.That's assuming candidate_id is an action property or accessible in the stack.
pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 300
but how it will encode the url.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

http://struts.apache.org/2.1.6/docs/url.html

Look at the "encode" and "escapeAmp" attributes.

Have you even *tried* it to just *SEE* how the URL is encoded?!
pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 300
hi use like this

<s:url id="theUrl" action="jobapply" method="add" encode="true" escapeAmp="true" >
<s:param name="jobCode" value="jobCode" />
<s:param name="jobId" value="jobCode"/>
</s:url>
<a href="<s:property value="#theUrl"/>">Apply Online</a>

and i am getting url like this.

http://localhost:8080/cyberq/jobapply!add.action?jobCode=101&jobId=101

Still it not encoded my url values.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to encode the url in strut2
 
Similar Threads
Strut2 training material
session in Strut2
Downlaod in Strut2
how to iterate map in strut2
Include action in strut2