*
The moose likes Struts and the fly likes How to  pass url to Struts1.3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to  pass url to Struts1.3" Watch "How to  pass url to Struts1.3" New topic
Author

How to pass url to Struts1.3

raj jaiswal
Ranch Hand

Joined: Nov 25, 2008
Posts: 56
Hi all,


I want to pass below url (var strURL="http://localhost:8080/SUNTYRE/customerServletAjax?value="+value;) to action class and call action class method.Currently i am passing this url to servlet but my requirement is to pass to action class .I am using struts1.3.
How to pass i dont know .
please help anybody to do this.

this is my code..




Thanks
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8836
    
    7

A URL is a URL. It doesn't matter if a Servlet or a Struts action handles it. You invoke them the same way. What's the URL of the action you wish to invoke?


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
raj jaiswal
Ranch Hand

Joined: Nov 25, 2008
Posts: 56
hi
Actually I want to call action class method and pass parameter .please tell me how to call action method and pass parameter inside ajax code.

i am passing url like that ( var strURL="test.do?method=testMethods value="+value;) inside this method (self.xmlHttpReq.open('POST', strURL, true);)



thanks
rajjaiswal
MCA SCJP1.6
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8836
    
    7

Are you getting an error?
raj jaiswal
Ranch Hand

Joined: Nov 25, 2008
Posts: 56
hi
Actually this url ( var strURL="test.do?method=testMethods value="+value;) is not calling to action class method.I thank is not correct way to call and pass value to action class method.Even its not giving any error .Please find the correct way to pass data from ajaxscript to action class method.


Thanks
Raj jaiswal
MCA SCJP1.6

vijay dadhwal
Ranch Hand

Joined: Dec 02, 2008
Posts: 47

hi,

parameter passing should be same to actions as to any servlets.

format should be



Why are you providing method name with the url parameters ?


MCA , SJCP
raj jaiswal
Ranch Hand

Joined: Nov 25, 2008
Posts: 56
hi
vijay dadhwal thank you very much for your help.I have solved it.

thanks once again all javaranch team.

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to pass url to Struts1.3
 
Similar Threads
Connection pooling using hibernate and struts1.3
Struts1.3 tiles problem
How to pass xmlresponse to another jsp in struts1.3?
[Ajax] if callback function has parameters?
pagination problem + struts1.3