How to redirect from servlet to project tab panel

I call servlet from project tab panel (using AJAX ) update database from servlet.

now i want to come back on project tab panel

i use

resp.sendRedirect(req.getContextPath() + "browse/TEST?selectedTab=com.jira.example.example_ao:wbs-project-tab-panel");

but its not working i want project tab panel page get refreshed

1 answer

1 accepted

This widget could not be displayed.

Hi Sachin,

I have a query : if you are doing AJAX call then why you are doing page refresh (which is similar to form submission).

you should understand the AJAX & Form submission concept first.

Again , can you elaborate your problem in detail ?

Hi Dipti

I have project tab panel in that i display AO table.from this project tab panel i called servlet throgh ajax on event. in servlet i make changes on AO table that changes should be reflecated on project tab panel from which i called servlet

database get modified but that changes is not shown on project ab panel After refreshing that page it show modified changes

<script>
 var data;
		var baseURL=document.getElementById("baseURL").value;
		$("#issuetable tbody").sortable(
		 {
			stop: function( event, ui ) {
				var draggedItem = $(ui.item).find('td').eq(1).text();
				var destinationDI=$(ui.item).prev().find('td').eq(1).text();				
		
				jQuery.ajax({
				  url: "${baseurl}/plugins/servlet/WBS_DNDUpdate",
				  type: "GET",
					data: { source: draggedItem, destination: destinationDI },
				    dataType: "json",
				});
				
				
			}	
			
		});
		
</script>

this is Ajax script which call WBS_DNDUpdate.java servlet after event

on servlet
String url = ComponentAccessor.getApplicationProperties().getString(APKeys.JIRA_BASEURL)+"/browse/TEST";
		System.out.println("==url=="+ url);
		resp.sendRedirect(url);

use this code for redirecting to project tab panel . the class of panel get executed after redirecting but updated data is not able to send to .vm file of that panel

so that updated data is not show on tab panel .

after manually refreshing page it shows.


Hi @Sachin,

The problem here is the ajax call you are making .

a) Just do a direct form submission with form tag , which in turn will refresh the complete page.

b) please see $.get() in the link if it can be helpful : http://api.jquery.com/jquery.get/

@sachin,

Use this ,

var vBrowser = window.open('${req.contextPath}/secure/AddProject.jspa?projectstr='+selectedProjectStr,"_self");

vBrowser.opener=self;

vBrowser.focus();

instead of jQuery.ajax()

Hi Dipti

Thanx for u r help. http://api.jquery.com/jquery.get/ this link very helpful

jQuery.ajax({
                  url: "${baseurl}/plugins/servlet/WBS_DNDUpdate",
                  type: "GET",
                    data: { source: draggedItem, destination: destinationDI },
                    success:  function() {location.reload();},
                    dataType: "json",
                });

success: used for calling function after successfull request.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

75 views 0 1
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you