You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Kalaiselvan <ka...@HotPOP.com> on 2002/10/07 06:24:16 UTC

Problem when writing bean value into textbox

Hii

<html:text property="functionName" size="15"  value="<bean:write name="function" scope="request" property="functionName"/>"
/>
Its not working.  How can i write ( set ) the bean value for my textbox 

<input type="text" size="15" name="functionName" value="<bean:write name="function" scope="request" property="functionName"/>">

Its working.

May be it will be very simple.  But i couldnt get the solution yet.
Any suggestion will helpe me better.

Thanx
Kalaiselvan.

Re: Problem when writing bean value into textbox

Posted by Eddie Bush <ek...@swbell.net>.
Well, you can't "nest" tags the way your first example shows - it's 
invalid XML, I believe.  Your second example should work, but I have to 
question what you're calling "function" and "functionName".  The name 
attribute should be the name of a bean - in request scope (since you've 
stated that's where it is) - and property should only be the name of the 
property you wish to retrieve the value of -- not the name of the accessor.

Ex:  class Foo - has attribue bar (and accessors getBar() and 
setBar(String bar)) - instance in request is foo:

<bean:write name="foo" property="bar" scope="request"/>

If that doesn't help, maybe you could give a broader overview of what 
you're trying to actually do :-)  My guess is that you want to specify 
default values for a form.  There are a couple of other ways you can do 
that:

- use a Dyna*Form and specify the initial (probably String) value
- preface the call to the page with an action that will populate the 
form and then forward to your JSP

Repost if that doesn't help - explain your scenario a little better 
though, please :-)

Kalaiselvan wrote:

>Hii
>
><html:text property="functionName" size="15"  value="<bean:write name="function" scope="request" property="functionName"/>"
>/>
>Its not working.  How can i write ( set ) the bean value for my textbox 
>
><input type="text" size="15" name="functionName" value="<bean:write name="function" scope="request" property="functionName"/>">
>
>Its working.
>
>May be it will be very simple.  But i couldnt get the solution yet.
>Any suggestion will helpe me better.
>
>Thanx
>Kalaiselvan.
>
-- 
Eddie Bush




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Problem when writing bean value into textbox

Posted by Steve Vanspall <st...@crmsoftware.com.au>.
if this is in a <html:form> tag, which it would need to be

then just use <html:text property="functionName" size="15"/>

this will automatically populate the bean providing there is a
getFunctionName() method in your form

Regards
Steve
----- Original Message -----
From: "Kalaiselvan" <ka...@HotPOP.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Monday, October 07, 2002 2:24 PM
Subject: Problem when writing bean value into textbox


Hii

<html:text property="functionName" size="15"  value="<bean:write
name="function" scope="request" property="functionName"/>"
/>
Its not working.  How can i write ( set ) the bean value for my textbox

<input type="text" size="15" name="functionName" value="<bean:write
name="function" scope="request" property="functionName"/>">

Its working.

May be it will be very simple.  But i couldnt get the solution yet.
Any suggestion will helpe me better.

Thanx
Kalaiselvan.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>