0

Good afternoon in my timezone.

I have a few little doubts regarding the use of this tag library and the actionForm. I want to put a inputText in my page , but this input text will be read only.So i did not put any thing in the actionForm object because this is a readOnly text(just to display data). I put the information in the request scope (request.setAttribute("readOnly","data")). In my jsp i have

<html:form action="action1">
    <html:text name="actionForm" property="inputText1"/>
    <html:text name="actionForm" property="inputText2"/>
    <html:text property="readOnly" readonly="true"/>
<html:form>

This is not working(if i remove the last field everything works fine), so i put the following questions ? Is it possible using <html:text> to access attributes in any scope,regardless the actionForm bean ?The documentation provide us with two properties to define the bean from where we want to retrieve the values (name=name of the bean and property=name of the property inside the bean).But it does not say anything about scopes(requst,scope). So can i use this taglibrary or i have to go by another way ?

Thanks in advance

tt0686
  • 1,771
  • 6
  • 31
  • 60

1 Answers1

0

The property attribute, used alone, is assumed to refer to an ActionForm property.

In general, an ActionForm property is the preferred way to send form elements to the view layer. If you're not using the normal mechanism, you need to provide the name attribute to explicitly dis-associate the input form element from the ActionForm in scope.

You may also use a plain HTML tag and use JSP EL to provide the value, or not use an input tag at all and simply display the value.

Dave Newton
  • 158,873
  • 26
  • 254
  • 302