struts bean-html

S

sn1022

Hello. I was wondering if anybody could answer this question: My entire
struts application works fine, except that in my JSP I have a few
textboxes that are not only for the user to input data, but are also
required to output data. In other words, <input type="text" name="box1"
value=""></input> when you input data, and once you hit submit, it
simply forwards to the same JSP and displays the relevant information ,
taken from the database, inside the same textbox. What I did was this:
<input type="text" name="box1"
value="<%=projectform.getName()%>"></input>
That was the only way that I could have data inputted into the value
segment of the textbox.

However, now since I'm doing my resultsets, it seems as if I will need
to use bean-html tags to iterate thru results for example, so I will
need to use bean tags inside the value property of the textbox. The
problem is: it doesnt work! bean-html tags do not work inside the value
property! They work everywhere else, just not inside the value property
- the place I really need it. Can anybody help me?? Is there anyway
they will work inside the value property?

Thank you very much for your help.
 
W

Wendy S

sn1022 said:
However, now since I'm doing my resultsets, it seems as if I will need
to use bean-html tags to iterate thru results for example, so I will
need to use bean tags inside the value property of the textbox. The
problem is: it doesnt work! bean-html tags do not work inside the value
property! They work everywhere else, just not inside the value property
- the place I really need it. Can anybody help me?? Is there anyway
they will work inside the value property?

No, JSP tags inside of JSP tags will never work.

The usual way to do this is to populate the form bean in the Action, then
use the Struts JSP tags. The Struts framework will *automatically* render
the correct 'value' for your <html:input> tag. (You should [almost] never
use the 'value' attribute of the Struts tags directly.)

Google for 'Struts prepopulate form' and you should turn up a bunch of
examples. Then again, I'm not sure I totally understand what you're trying
to do, so posting some of the code from the Action or JSP might be helpful.
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top