how can i get parameter from post method in gwt - gwt

I have a html page and i am sending some parameter using post method.
now i want to get these parameter on gwt client.
is there any method in gwt to get post parameter on client.?
i use following code
<html>
<body>
<form action="http://localhost:8080/popnnn/js.html" method="post">
<input type="text" id="foo" name="foo">
<input type="submit" value="Send" name="submit" id="submit">
</form>
</body>
</html>
and in my gwt code
TextBox text=new TextBox();
text.setText(Window.Location.getParameter("foo"));
this is perfectly woking with get method but not with post
please help......

Steps to follow:
Just convert the file js.html to js.jsp.
Get the post parameter from the request parameter.
Set the value in hidden div in JSP and access it in JAVA.
Change the action attribute of form tag as shown below:
<form action="http://localhost:8080/popnnn/js.jsp" method="post">
Try any one:
JSP Scriplets
<div id="fooParameter" style="visibility: hidden;">
<%=request.getParameter("foo") %>
</div>
JSP Standard Tag Library
<%# taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<div id="fooParameter" style="visibility: hidden;">
<c:out value="${param.foo}" />
</div>
Access value from hosted HTML/JSP to JAVA code
String foo = RootPanel.get("fooParameter").getElement().getInnerHTML();
TextBox text=new TextBox();
text.setText(foo);
Find a sample code here about Acces value between two jsp with jstl

Related

Submit basic HTML form using Postman

I am trying to log into this website using Postman.
There is no username and this is what the HTML look like:
<body>
<div class="container">
<div class="loginbox">
<img id="logo" src="../gfx/logo.png" alt="" />
<form action="" method="POST">
Password: <input type="password" name="password" id="password" />
<button type="submit" name="submit" id="submit">Submit</button>
</form>
<p id="message">
</p>
</div>
</div>
</body>
This my POST request on Postman and I am not getting any "Wrong password." html back so I guess I am not doing the correct thing. How can I make a POST request to login using Postman?
The form includes two values, password and submit. The latter has no value associated with it, but the key is still being posted to the server.
It seems that the server-side code is using the submit key to trigger its logic. Just include that in your form data with no value.
Giving a "submit" key as empty in addition to the password field is needed . Please refer the sample request image given.

Netlify does not recognize form in nuxt app

We implemented a simple nuxt app with a basic form and deployed it to netlify.
When pressing the "Submit" Button of the Form, we receive a 404.
Here you can find the link to the deployed netlify app:
EDIT -> Removed Link
After looking through the troubleshoot guide, they listed that the added "netlify" or "data-netlify="true" attributes should not be visible if netlify recognized your form, but they are.
Plus the form can't be found in the "form" configuration tab of the netlify backend.
Nuxt config:
SPA
Tailwind
We tried to add the necessary attributes for netlify:
netlify or
data-netlify="true" & netlify-honeypot="bot-field"
We also added a "pre-render" library called prerender-spa-plugin.
Here you can find the contact.vue page content.
Simple form with "name" attributes set according to netlify documentation.
<template>
<div>
<form name="contact" method="POST" data-netlify="true" netlify-honeypot="bot-field">
<p class="hidden">
<label
>Don’t fill this out if you're human: <input name="bot-field"
/></label>
</p>
<p>
<label
>Name
<input
type="text"
name="name"
class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 mb-3 leading-tight focus:outline-none focus:bg-white;"
/></label>
</p>
<p>
<label
>Email
<input
type="email"
name="email"
class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 mb-3 leading-tight focus:outline-none focus:bg-white;"
/></label>
</p>
<p>
<button
type="submit"
name="submit"
class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline"
>
Send
</button>
</p>
</form>
</div>
</template>
<script>
export default {};
</script>
<style>
.hidden {
display: none;
}
</style>
It would be great if we can manage to fix this, so that netlify finally recognizes our form.
Netlify comes with built-in form handling. Our build bots do it by parsing your HTML files directly at deploy time, so there’s no need for you to make an API call or include extra JavaScript on your site.
The form is required to be in the rendered files at deploy time. The problem with SPA mode is that none of your pages are actually rendered as HTML. You can check this by right clicking the page, and clicking "View Page Source". You won't be able to find the form.
Netlify addresses this problem here in their docs.
They have a specific post for fixing this for a Vue app here
A little more digging on the the issue and we find a Nuxt solution here:
Place the following in static/form-dummy/index.html:
<form name="MYFORM" action="/form/success" netlify>
<!-- form controls here -->
</form>
Place the following in pages/form/index.vue (Or whenever you've named your Vue file)
<form name="MYFORM" action="/form/success" method="post">
<input type="hidden" name="form-name" value="MYFORM" />
<!-- form controls here -->
</form>
From the post:
You just need to make sure you add that hidden in the Vue component so that Netlify recognises the form submission as associated with the form called MYFORM. I think you also need to ensure all the inputs you want to receive data for are on both forms.

Template overlay using Sightly

I am pretty new to AEM. I am following this tutorial from the official documentation. I already did it from top to bottom, but now I am trying to do it again but using Eclipse, Maven and Sightly instead of JSP.
I've been following until the step "Using your own scripts". As I am trying to use Sightly instead of JSP I've ended up with the following files:
contentpage.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<div data-sly-include="head.jsp" data-sly-unwrap></div>
<div data-sly-include="body.jsp" data-sly-unwrap></div>
</html>
body.jsp
<%#include file="/libs/foundation/global.jsp"%>
<%
%><body>
<div id="CQ">
<div class="topnav">topnav</div>
<div class="content">
<cq:include script="left.html" />
<cq:include script="center.html" />
<cq:include script="right.html" />
</div>
<div class="footer">
<div class="toolbar">toolbar</div>
</div>
</div>
</body>
left.html
<div class="left">
<div>logo</div>
<div>newslist</div>
<div>search</div>
</div>
center.html
<div class="center">
<div>trail</div>
<div>title</div>
<div>parsys</div>
</div>
right.html
<div class="right">
<div>iparsys</div>
</div>
In addition, the node apps/myproject/components/contentpage has an attribute sling:resourceSuperType="foundation/components/page" so it is inheriting from the page component provided.
Everything works as expected, but as I said before, I am trying to use only Sightly, but at the moment I've got the file body.jsp, which I think I need it to be JSP so it has the same name as /libs/foundation/components/page/body.jsp.
Is there a way to get rid of the body.jsp and use a sightly script instead? I suspect that maybe there is a components/page/body.html somewhere, but no idea where to look for it (in case it really exists).
Thanks.
As commented by rakhi4110, and as I suspected, there is a sightly version of the page component. It is located in wcm/foundation/components/page so the only thing to do is inherit from it instead of foundation/components/page.
This is a link to an article that put me on track, in case is useful for somebody else: http://scottwestover.blogspot.co.uk/2015/04/aem-tutorial-on-building-sightly-page.html

post form to an iframe on another form (is it possible)

I'm using ASP.NET web forms and i need to post data to an iframe, the problem is that in web forms I have the main form tag(form1), so i need another form tag(form2), to post data to the iframe that is in the main form1.
Basically i have this:
<form method="post" id="form2" action="http://localhost:58903/WebForm1.aspx" target="webApp">
<input type="hidden" name="ValidationUserName" value="david" />
<input type="hidden" name="ValidationTokenId" value="13123132132" />
<button type="submit">Send info to inner iframe</button>
</form>
<form id="form1" runat="server">
<iframe id="webApp" name="webApp" src="http://localhost:58903/WebForm1.aspx" style="width: 800px; height: 800px;"></iframe>
</form>
With this approach in open a new tab, if i put the iframe outside it works ok, but if i do this the layout is changed and i don't want this.
Is this possible?
If all the forms are in the same domain you should not work with iframes.
What exactly are you trying to get here? didn't realize completely
Done it, it was missing the "name" attribute in the <form> tags.

Why is JBoss Post Form sending parameters in URL?

Our JBoss form is posting the parameters in the URL instead of in the request despite being a POST form. I have confirmed that the form is post in the actual page using Firebug. Note that this is within a portlet.
We are submitting the form using javascript like:
function submitForm(action, time)
{
document.getElementById("pageActionInputID").value = time;
document.getElementById("timeSpanFormInputID").value = action;
document.getElementById("formID").submit();
}
<form action="<portlet:actionURL></portlet:actionURL>" method="POST" id="formID">
<input type="hidden" name="pageAction" id="pageActionInputID" />
<input type="hidden" name="timeSpan" id="timeSpanFormInputID" />
</form>
where 'portlet' is from
<%# taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
Any ideas why we are getting the inputs in the URL?
Here is what the resulting markup looks like:
<form id="formID" method="post" action="/portal/auth/portal/myTab?action=1">
<input id="pageActionInputID" type="hidden" name="pageAction"/>
<input id="timeSpanFormInputID" type="hidden" name="timeSpan"/>
</form>
Though it would be great if someone could confirm it. I think the JBoss Portlet throws out post/get and uses action URLs instead.
A descriptive article about render and action URLs