Perhaps you would like to use the html-el tags (which also come with the Struts dist), like this:

<html-el:hidden property="${myBean.myField}"/>

But there is nothing wrong with using the standard html hidden input as far as I know (but you give up some Struts luxuries).

Using Session scope is one way, but not the only way, to solve your problem. (Don't be afraid of it though). This is not an easy problem despite the simplicity of the concept of "scope". Keep reading!

Erik



Sebastian Ho wrote:

Why didnt I use html:hidden?

Whenever I use that I have parsing error and exception thrown which I
think is because of the <bean:write> within <html:hidden>. Using <input>
didn't cause any problem.

If html:hidden will not cause the problem and I am doing it the wrong
way. Pls advise.

Ok..now I understand the scope implication. I guess the only way to
resolve this is to put everyting into session instead of request.

Sebastian


On Mon, 2004-09-20 at 15:38, Erik Weber wrote:


First I would ask, why aren't you using the Struts tags (such as html:hidden)? I assume that you are using them to render your other inputs (such as those of type "text").

But, to answer your question, it's a matter of scope. When the page containing the form is first rendered, the hidden variable is set to some value that lives in request scope. When the form is submitted (and validation errors occur), a new request exists, the original request no longer exists, and so that value is no longer in scope when the page is rendered for the second time.

See if this helps:

http://www.reumann.net/struts/articles/request_lists.jsp


Erik



Sebastian Ho wrote:



hi

i have the following codes in my JSP :

<input type="hidden" name="userID" value="<bean:write name="user"
property="userID" scope="request"/>"/>

which converts into <input type="hidden" name="userID" value="1"/>.

If validation is used and there are errors, the input page is displayed.
Now the above value became :

<input type="hidden" name="userID" value=""/>

The valus is missing..

Can anyone explain why this is happening and how to resolve it?

sebastian


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to