if you use the struts-el tag libraries you can try this:
<html-el:text name="someForm" property="someProperty" value="${otherForm.map.yourProp"/>


I've heard that it's best to avoid putting scriptlet/java code in my jsp pages.
It is, but you're specific problem isn't pertaining to scriptlet vs. non-scriplet. That is solved with expression language.

It'd probably be easier if you combined these 2 forms. Remember, you don't need to have different forms for every page. You can even have one big form for the entire application.

-Ben

From: Adam Bickford <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Struts text field 'value' attribute set from another ActionForm?
Date: Thu, 29 Jan 2004 09:54:56 -0500

I have a web form such as:

<strutshtml:form action="/someAction" enctype="multipart/form-data">
<strutshtml:text name="someForm" property="someProperty" size="10" value="???"/>
</strutshtml:form>


How can I set a default value for the text field, where the value I want is in a different session scoped ActionForm than the one named in the <strutshtml:text> tag? The only way I've been able to do it is saving a value as a session attribute and retrieving it with a scriptlet, like this:

<strutshtml:text name="someForm" property="someProperty" size="10" value="<%= (String)session.getAttribute("sessionAttributeValue") %>"/>

This approach works, but should I need to use a scriptlet and sessionAttributes to do this? I've heard that it's best to avoid putting scriptlet/java code in my jsp pages. What I'd like to do is reference the value in the existing session scoped ActionForm, such as:

<strutshtml:text name="someForm" property="someProperty" size="10" value=otherSessionScopedForm.someProperty/>

Can something like this be done?



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


_________________________________________________________________
Rethink your business approach for the new year with the helpful tips here. http://special.msn.com/bcentral/prep04.armx



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



Reply via email to