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 HttpSession management in Struts 2 using Jquery Ajax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "HttpSession management in Struts 2 using Jquery Ajax" Watch "HttpSession management in Struts 2 using Jquery Ajax" New topic
Author

HttpSession management in Struts 2 using Jquery Ajax

Stephane Vang
Greenhorn

Joined: Feb 11, 2012
Posts: 1
Hi everybody,

I am faced to a problem that is manage the Httpsession when doing an Ajax request.
I am using Struts 2 and Jquery ajax.
I can manage the HttpSession when I use struts action without ajax. I mean I can put object to my session I get it later.
When I am using $.ajax blablabla , I put object in my session but I can not get it later...

Here is my code :

JSP :

$.ajax({
type: "POST",
data: { type: google.maps.drawing.OverlayType.POLYGON, coordonnees: coordonnees },
url: "<s:url action="getDestinataireFromZone" namespace="/map" />",
dataType:"html",
success: function(data){
$("#destinataire").html("<strong>Nombre de destinataires sélectionné : </strong>" + data);
}

STRUTS 2 ACTION :

public class MapAction extends AbstractAction{
...
public String getDestinataireFromZone(){

...
getSession().put("listeDestinataire", listDestinataireFromSession);
...
inputStream = new StringBufferInputStream(String.valueOf(listDestinataireFromSession.size()));

return SUCCESS;
}

...
}

STRUTS.XML:

<action name="getDestinataireFromZone" method="getDestinataireFromZone" class="MapAction">
<result name="success" type="stream">
<param name="contentType">text/html</param>
<param name="inputName">inputStream</param>
</result>
</action>

I am stucked...

Please Help me

Best Regards

Stéphane

});
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

Please provide full details to diagnose your problem.


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HttpSession management in Struts 2 using Jquery Ajax