You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Marco Miedl <ma...@miedlnet.de> on 2003/06/02 17:24:02 UTC

Dynamic value in a Tag

Hi,

I want to initialize the fields of a Struts Form with the <html:text>-Tag.
In my request there is a bean with the getter and setter I need.
Now I tried this:

<html:text value="<bean:write name="myLink" property="URL"/>" property="URL" size="25" maxlength="256"></html:text>

and I got the following Error:

org.apache.jasper.JasperException: /linkothek/LinkChange.jsp(36,58) equal symbol expected
 at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)
 at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:428)
      ..........

When I try to use the Tag: <bean:write name="myLink" property="URL"/>  alone (not in another Tag) then I got value I should get. So I see that the bean is in my Request. But why doen't it work when I put the <bean:write> Tag into the <html:text> tag?
I think this is a problem a lot of others also have, because you often need to initalize the values of Form Elements with dynamic content.

Can somebody help me?

Greetings and THANX in advance
    Marco

Re: Dynamic value in a Tag

Posted by Dirk Markert <po...@gmx.de>.
Hello Marco,



Monday, June 2, 2003, 5:24:02 PM, you wrote:

MM> Hi,

MM> I want to initialize the fields of a Struts Form with the <html:text>-Tag.
Why don't you initialize your fields inside your action or inside the
reset method of your form?

MM> In my request there is a bean with the getter and setter I need.
MM> Now I tried this:

MM> <html:text value="<bean:write name="myLink" property="URL"/>" property="URL" size="25" maxlength="256"></html:text>

Try something like:

<bean:define id="value" type="String" name="myLink" property="URL"/>

<html:text property="URL" value="<%= value %>" ... />

MM> and I got the following Error:

MM> org.apache.jasper.JasperException: /linkothek/LinkChange.jsp(36,58) equal symbol expected
MM>  at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:94)
MM>  at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:428)
MM>       ..........

MM> When I try to use the Tag: <bean:write name="myLink" property="URL"/>  alone (not in another Tag) then I got value I should get. So I see that the bean is in my Request. But why doen't it work
MM> when I put the <bean:write> Tag into the <html:text> tag?
MM> I think this is a problem a lot of others also have, because you often need to initalize the values of Form Elements with dynamic content.

MM> Can somebody help me?

MM> Greetings and THANX in advance
MM>     Marco



-- 
Best regards,
Dirk


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org