File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Struts with Ajax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts with Ajax" Watch "Struts with Ajax" New topic

Struts with Ajax

prem sagar bojja

Joined: Dec 27, 2005
Posts: 8
Hello Friends,

I have a problem in Struts with Ajax..
In my project i have folder structure is like this..
| AcademicFeeDetails1.jsp
| tt.jsp
| /test/AcademicFeeDetails2.jsp

and i m using Ajax to populate dynamic selection box..

my Ajax code in AcademicFeeDetails.jsp is like this

xmlHttp.onreadystatechange = populateSecondbox;"GET", url , false );
and my struts-cofig.xml action mapping is like
<action path="/test" type="com.artifacts.TestAction"/>

and in my web.xml i have kept AcademicFeeDetails1.jsp as welcome file like

Now my problem is when i run AcademicFeeDetais1.jsp then i m getting response from action class and everything is going fine..

But when i run the same peice of code from AcademicFeeDetials2.jsp i m getting no respone as there can be problem in getting context path of URL..
and if i remove AcademicFeeDetails1.jsp from <welcome-file> then aslo not getting any response from action class..

Some body please help me on it..Thanks in advance..

RoshaniG Gopal
Ranch Hand

Joined: May 15, 2006
Posts: 180
1)You have an answer yourself.AcademicFeeDetails1.jsp in the jsps but AcademicFeeDetails2.jsp in not in the folder, hence the problem. Remove AcademicFeeDetails2.jsp from test folder and put it along the others. it should solve the issue.
2)I would also suggest to keep the welcome file as index.jsp and use a logic:redirect in the same to maintain industry stds.
3) By the way where is AcademicFeeDetails.jsp for which you have the ajax code ???
| AcademicFeeDetails1.jsp
| tt.jsp
| /test/AcademicFeeDetails2.jsp

Regards,<br />Roshani
I agree. Here's the link:
subject: Struts with Ajax
It's not a secret anymore!