Steps to follow:
- Just convert the file
js.html
tojs.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:
-
<div id="fooParameter" style="visibility: hidden;"> <%=request.getParameter("foo") %> </div>
-
<%@ 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