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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published 28m ago in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

7 views 0 2
Read article

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