This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts with Ajax" Watch "Struts with Ajax" New topic
Author

Struts with Ajax

prem sagar bojja
Greenhorn

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

Joined: May 15, 2006
Posts: 180
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


Regards,<br />Roshani
 
 
subject: Struts with Ajax
 
Similar Threads
problem in forwarding to jsp
problem with struts1.1 please help me...
neither action class called nor jsp page displayed
servlet action is not available
How to customize mapping in struts-config.xml ?