Primefaces Ajax components issue - primefaces

FrameWork: Primefaces 3.4.2
Issue:
My code has one Non-ajax command button and two Ajax command buttons. When I submit the form through the Non-ajax button, once the page is loaded again ( Came to same page with updating some other data). Now If I click on the Ajax buttons they are not working.

Probably you have forgot about the update="" attribute, but it is hard to tell if you don't attach your code.

Related

Spring redirect to another page on button click

I'm new to the Spring framework. At the moment I've got two HTML pages and when a button is clicked on the first one I want to redirect to the second page.
At the moment I'm doing this in a really hacky way.
The first page is just a log in page and depending on the user logged I'm redirection to a specific page. On the login page I've got two hidden <a> like these
Login as tutor
Login as student
Then using JavaScript I'm triggering this <a> to be clicked when the Login button is clicked. That way I'm successfully redirecting to the admin.html or student.html pages. The problem is that once I'm redirected to these pages the page is not rendered correctly (the js is not loaded correctly) so I need to refresh the page to see the proper content of the page. I assume that the reason for is because I'm redirecting in such a hacky way. So my question is - having a button like this (ignore the JQuery Mobile)
<input type="button" id="btnLogin" class="btnLogin" value="Sigh in" data-theme="b"/>
how to redirect properly in the Spring framework?
PS I'm coming from ASP.NET background so I was thinking of some sort of button click event handler in the back end, and then doing something like Response.Redirect("newpage");
Not sure if I understood your question correctly, but basically handling links and buttons is pure client-side task and has nothing to do with any server-side implementations, no matter if it's Java+Spring, or ASP.NET.
But if you really want to know how to redirect in Spring, the easiest way is to just return redirect:path from your action:
#Controller
class MyController
{
#RequestMapping(...)
public String myAction()
{
/* your logic here */
return 'redirect:student';
}
}

Prevent page load on refresh

I have a simple html form which submits to the database on submit click.
It's working fine till here but after that when I refresh the page or page loads again,the values resubmit.How to rectify that?
After u submit the page and data get stored in the database successfully reload the same page
using
echo "<script>window.location='yourpagename.php'</script>";
After the form has been submitted, redirect to another page. Then refreshes will not matter.
See Post/Redirect/Get on Wikipedia for details on this pattern.

"Login" button doesn't respond to clicks

I'm building a Joomla website (here, still under construction) and I'm adding in facebook support. I've downloaded and installed the Joomla Facebook SDK, and now I'm trying to add login and registration with Facebook.
I made a Custom HTML module in the top-a position, and dropped in the following code:
<div id="fb-root"></div>
<script src="https://connect.facebook.net/en_US/all.js#appId=MY_APP_ID&xfbml=1" type="text/javascript"></script>
<fb:login-button registration-url="https://REGISTRATION_URL"></fb:login-button>​
where the registration url points to a page with the registration button on it (is that right?)
The Login button appears with the word "Login" but does not respond to clicks. The Chrome console doesn't register any errors, and neither does Firebug.
This may be a very simple problem since I'm relatively new to this kind of coding, and not very comfortable with javascript.
Joomla filters content by default and removes Javascript. Use plugins like these to allow you to enter custom code [JS, PHP etc...], and these for FB login

form post in Chrome extension popup not doing anything

I am making a chrome extension and I have a popup.html page that contains a form with method post, it does not do anything when opened using the popup button however if the page is opened as an options page or just a normal html page, the form posts fine and the new page is loaded.
so something in the popup is preventing the form from working.
I cannot figure out why, anyone know how to fix/work around this ?
You need to do an AJAX POST request. A quick Google search brought up this post.
Maybe an answer duplicate of Paypal Button For Google Chrome Extension.
Just in case that somebody arrives here, try adding a simple target="_blank" to your tag (Works with Paypal donate buttons, for example)

How to open ASP page in a new tab/window?

I know that the HTML anchor tag has an attribute called target, which will open a new page in a new window/tab if we set target='_blank'. It should work well with static HTML pages.
However, when we submitting a form by clicking the submit button on an ASP page, I find that the result page normally will be loaded into the same tab/window.
So my question is: are we able to load page into a new tab/window when user clicks submit button?
Thanks.
EDIT:
Looks like <form target='blank'> is the answer although its said to be deprecated according to w3schools website. :)
Just like a link:
<form target='_blank'>
No need to do anything on the ASP side of things. Of course, as with all pop-ups, this is subject to browser settings.
Form's target shold work.
<form target="_blank" ...></form>
From here (have you searched?)
Try this out..
Response.Redirect to new window
You have two methods for redirecting the page to new tab in asp
1) Make an onclientclick event of Button and on code behind of Button
Click write the following code:-
button.OnClientClick = "aspnetForm.target='_blank'"; Response.Redirect("yourpage.aspx");
2)You can also use javascript
button.Attributes.Add("onclick", "window.open('yourpage.aspx');return false;");
Both the method will redirect your page to new tab on clicking the button.