I have to navigate between my components and I use a custom button like this:
button.addClickListener(click -> {
UI.getCurrent().navigate(ClassToNavigate.class);
});
The url does refresh in the search bar but it only shows a black page, I've to hit F5 to see the component in my parent layout.
My only fix is to add:
UI.getCurrent().getPage().reload();
...which reloads the page after navigating to the URL, and that breaks the UX in my opinion, however... when using a BeforeEnterEvent on a class and using the method:
forwardTo(ClassToNavigate.class);
redirects perfectly... although I can't have BeforeEnterEvent for every menu button I have, I can't see why forwardTo() works perfectly and navigate() doesn't.
Is there a way to navigate without having to reload the page? And without using RouterLink which I can't because I'm already using a custom component.
Thanks in advance!
Related
I am using a controller to get the form values from the html. And doing some kind of validations. If validation fails i want to reload that popup by throwing the validation message and the popup page view name to reload the popup page. Like
If i have a page A, in that page A there is a button B.
Now if i click the button B, there will be open a popup window C.
Here in the page C, if i click the form submit. It will goes to the controller.
Here in the controller i do some validations, if validation fails i just want to reload that popup page C with the error message.
Any body can help to overcome the issues.
It will be easy if you use jQuery UI Modal.
Just go through this link
Is this what you want to do here It can be achieved by basic JQuery, CSS, js. Explorer some. if you have to validate it from data base and than show use <f:ajax /> this is whole work do some effort
i m developing a web page, where i want to show vertical menu. when any clicks on menu its content should open on same page inside a box, and on clicking next menu new content should open in same place . I m using java ,JSP,JSF, java script.. can any one help me on.....
jQuery(document).ready(function(){
$("#myLink").click(function() {
$(this).fancybox({href : 'temp.jsp'});
});
});
Open ajax content
I have tried this but i need to design lots of jsps.
use primefaces menu, it has all the fancy you need
You could also try RichFaces - rich:dropDownMenu and rich:popupPanel
rich:dropDownMenu - RichFaces Showcase
rich:popupPanel - RichFaces Showcase
My main goal: When i click the link, a new browser window should be opened and displays the content of entire log file. And the window should not have an address bar and navigation buttons (Back, Forward).
Is there any approach to do this in Spring-MVC project?
Here is what i am doing now:
When i click the link, the controller will be called with a parameter logName.
Now the controller have access to get any kind of details of the log file like content, path, etc... I am setting all these details to an object and sending back to JSP.
Here i am not sure how to open a new window and display the content of the log file in that window.
Please suggest me an approach on this!!
It would be very helpful for me if you can share me with some examples...
Spring or JSP have nothing to do with it, the only way to force user's browser to open a link in a new tab is to use client-side Javascript. window.open() allows configuring the popup to hide certain interface elements (see all options in the documentation)
Your code would look something like:
<input type="button" value="Show Log" onclick="showLog(logName)">
function showLog(logName) {
var url = "/path-to-your-controller.html?logName=" + logName;
window.open(url, "LogPage", "toolbar=no,location=no,menubar=no");
}
However, I don't think using a customised browser popup is a good solution; it's been disappearing from the web for a reason. It would be more elegant to fetch raw data using AJAX and display it in a JS popup: it wouldn't interfere with user's page navigation (you tagged the question with jQuery, you could use jQuery UI for that).
What is more, I wouldn't be surprised if window.open wasn't supported by all browsers in the same way† - something to keep in mind if you're targeting a wider audience.
† seems that Chrome ignores location=no, for instance
I have a button which opens a pop-up window and an Ajax update panel. Inside that window I have another button.
What code do I have to run if I want that update panel to be refreshed, when I press the button from the parent page, without refreshing the whole page?
I sow this code on a web which refreshes the page:
<div id="Container" onclick="__doPostBack('UpdatePanel1', '');">
I am such a good friend with Java.
You need to utilize window.opener object.
window.opener.document.getElementById('Container').onclick();
I'd suggest using jQuery to ensure cross-browser compatibility. And also adding some null-checks of course.
Use Jquery :
If the DIV ID remains static :
$("#Container").click(function() {
// REFRESH CONTAINER HERE
});
If the Div ID is dynamic then make use of class instead of ID:
$(".Container").click(function() {
// REFRESH CONTAINER HERE
});
I have a page with a link. On clicking the link a page opens up in a separate window. This new page has a form. On submitting this form, some operation takes place at the server. The result of which needs to be redirected to the same page. However after the operation on using the following:
return new ModelAndView("newUser");
//This view "newUser" actually maps to the popped up window.
A similar new window again pops up and the message gets displayed on this new page.
Any ideas as to why this behavior or how to go about this?
If you open a popup window with a form in it, any submits from here to the server will be handled in the same location, so you will get your response (and any subsequent request-responses) in that popup window.
If I understand this right, you have a page X which opens the popup, you submit in the popup and as a result you want again the content of page X, but in the popup?
If that is the case I thing the behavior is not from Spring but from what you have in the X page. Maybe a JavaScript which gets triggered on load and opens a new popup? Can't really tell without seeing more code.