Mark E Hansen wrote:You really don't want to generate the HTML markup in your server component (I assume post() is called from your Action object). This isn't just a Struts 2 issue, but an MVC issue (Model View Controller). Instead, you should have a JSP page that generates the desired HTML response page. You can use JSTL in the JSP page to create any dynamic content needed on the page. Then, just have the Struts 2 action object forward to the view page when it's done with its processing.
Yahya Elyasse wrote:Ok it seems i didn't yet found the right solution. i'm not sure what JSTL could do ? could it generate a html form with hidden fields? and then tell jsp to redirect user to url?
I'm not yet able to think of a good solution to the problem i described. i wonder how a java programmer from a jsp page or struts action could redirect user to a url with some POST hidden fields dynamically embedded to this redirect request?
Mark E Hansen wrote:
Yahya Elyasse wrote:Ok it seems i didn't yet found the right solution. i'm not sure what JSTL could do ? could it generate a html form with hidden fields? and then tell jsp to redirect user to url?
I'm not yet able to think of a good solution to the problem i described. i wonder how a java programmer from a jsp page or struts action could redirect user to a url with some POST hidden fields dynamically embedded to this redirect request?
I think you're over thinking this. Do you know how to create an HTML page which includes a hidden field? It's just a <input type="hidden" ...> element in the HTML markup. Create the HTML page that you want to see, and you have the JSP page - because except for some additional markup, that's all a JSP page is.
Once you have the JSP page, then look for areas where you want dynamic content and use JSTL (or something else) to generate the content.
I think you'll have a much easier time of this if you took a look through some Servlets and JSP tutorials.
Also, have a look at the book Core Servlets and JavaServer Pages. The book's web site provides the chapters for free as PDF downloads here: http://pdf.coreservlets.com
You'll then want to do the same thing for JSTL. I don't know of any free books, but the book I used is called JSTL in Action and it was excellent. I'm sure you'll be able to find some free tutorials though, if you Google a little.
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |