• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts with Ajax

 
prem sagar bojja
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends,

I have a problem in Struts with Ajax..
In my project i have folder structure is like this..
webroot
|
|--css/
|--jsps/
| 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

url="./test.do?country="+firstbox;
if(xmlHttp){
xmlHttp.onreadystatechange = populateSecondbox;
xmlHttp.open("GET", url , false );
xmlHttp.send();
}
and my struts-cofig.xml action mapping is like
<action-mappings>
<action path="/test" type="com.artifacts.TestAction"/>
</action-mappings>

and in my web.xml i have kept AcademicFeeDetails1.jsp as welcome file like
<welcome-file-list>
<welcome-file>/jsps/AcademicFeeDetails1.jsp</welcome-file>
</welcome-file-list>

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..

regards,
Prem
 
RoshaniG Gopal
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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 ???
webroot
|
|--css/
|--jsps/
| AcademicFeeDetails1.jsp
| tt.jsp
| /test/AcademicFeeDetails2.jsp
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic