Struts, adding parameters to a request

B

boanator

Let's say I have a web page called /emailForm.jsp with a form and a
submit button. Let's also say that /emailForm.jsp receives some
request parameters. When the user clicks the submit button on the
emailForm.jsp page, an http request is sent to /submitEmailForm.do.

I want the request parameters that were sent to /emailForm.jsp to be
added to the http request that is sent to /submitEmailForm.do. Is this
possible? Is there a way to use the jstl core tag library to append
those request parameters to the next request? Is there a way to add
those request parameters to the application or session using a tag
library?

Thanks in advance for any advice...
 
B

Bryce

Let's say I have a web page called /emailForm.jsp with a form and a
submit button. Let's also say that /emailForm.jsp receives some
request parameters. When the user clicks the submit button on the
emailForm.jsp page, an http request is sent to /submitEmailForm.do.

I want the request parameters that were sent to /emailForm.jsp to be
added to the http request that is sent to /submitEmailForm.do. Is this
possible? Is there a way to use the jstl core tag library to append
those request parameters to the next request? Is there a way to add
those request parameters to the application or session using a tag
library?

Yes, just add them as a hidden field, (or visible if you want).
 
B

boanator

Thanks for the advice, it works just fine. However, I create my form
on my jsp page using the tag:
<html:form>
....
</html:form>

In order to add these hidden fields, I need to add the regular html
input field inside my form. For example:
<html:form method="POST" action="/submitEmailForm">
...
<html:text property="from"/>
<html:text property="to"/>
...
<input type="hidden" name="comments" value="<%=
request.getParameter("comments") %>"/>
</html:form>

Since the parameters I would like to pass on are not part of the form
bean, I cannot use the tag:
<html:hidden property="comments"/>

So I must use the regular html tag:
<input type="hidden" name="comments" ... />

Is this a wise thing to do? Could this possibly cause any errors with
my struts application?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top