I have webpage with a form like this:
<html>
<head>
...
</head>
<body>
<form id="form4" name="form4" method="post" action="Receive.jsp">
<input name="inputField1" type="text"/>
...
<input type="submit" value="Send"/>
</form>
</body>
</html>
Then in my Receive.jsp I use:
<jsp:useBean id="form4" class="control.FormBean4" scope="session"/>
<jsp:setProperty name="form4" property="*"/>
To get all the input data from the form into a Bean, then I do some stuff with it. Now, what I want to do is to redirect the data from the Bean into another JSP with another form in it and fill out the input fields of that form with the properties from my Bean. My question is if there is some way to automatically fill the form like <jsp:setProperty name="form4" property="*"/> but backwards?
I already tried <jsp:getProperty name="form4" property="*"/>, but it obviously didn’t work (I read somewhere in the JSP reference that this is not valid), so I’m wondering if you know some way to do this, because I have more than just one form each one with a bunch of fields and I’d like to save all the work of setting the values one by one.
I’m still a newbie in JSP and don’t really know much about the JSTL or any frameworks like Struts, any help would be greatly appreciated.
No. You’d need to either do it yourself, or to head to a JSP/Servlet based MVC framework like JSF, Struts, Spring-MVC, etc.
To do it yourself:
To do it with for example JSF:
(which in turn also immediately minimizes the
<jsp:useBean>and all Servlet code boilerplate)