You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by thomas2004 <th...@yahoo.de> on 2008/05/28 12:15:29 UTC

A form without summit?

Simply to say, I have a bean class looks as follow:

public class Address{
  private street;
  
  public Address(){
     setStreet("Broadway");
  }
       
  public void setStreet(String street){
    this.street = street;
  }

  public String getStreet(){
    return this.street;
  }
}

Now in the "myaddress.jsp", I just want to show the address as one invoke
this page, without clicking any submit button:
...
  <bean:write name="address" property="street" />
...

How can I define the mappings in "struts-config.xml"?
-- 
View this message in context: http://www.nabble.com/A-form-without-summit--tp17509426p17509426.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: A form without summit?

Posted by thomas2004 <th...@yahoo.de>.

Alexis Pigeon wrote:
> 
> On 28/05/2008, Martin <mg...@hotmail.com> wrote:
>> You can accomplish autocomplete with the autocompleter Struts Tag
>> http://struts.apache.org/2.0.6/struts2-core/apidocs/org/apache/struts2/components/Autocompleter.html
>>  Take note of theme="ajax"
>>  http://struts.apache.org/2.0.11.1/docs/autocompleter.html
>>
>>  HTH
>>  Martin
>>  ----- Original Message ----- From: "thomas2004" <th...@yahoo.de>
> 
> [snip]
> 
>> > How can I define the mappings in "struts-config.xml"?
> 
> I fear the OP is using Struts1, and Struts2 documentation won't be of
> nay help...
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

I fear the methods you above told are from struts2, right? I am using
struts1.

-- 
View this message in context: http://www.nabble.com/A-form-without-summit--tp17509426p17516152.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: A form without summit?

Posted by Alexis Pigeon <pi...@gmail.com>.
On 28/05/2008, Martin <mg...@hotmail.com> wrote:
> You can accomplish autocomplete with the autocompleter Struts Tag
> http://struts.apache.org/2.0.6/struts2-core/apidocs/org/apache/struts2/components/Autocompleter.html
>  Take note of theme="ajax"
>  http://struts.apache.org/2.0.11.1/docs/autocompleter.html
>
>  HTH
>  Martin
>  ----- Original Message ----- From: "thomas2004" <th...@yahoo.de>

[snip]

> > How can I define the mappings in "struts-config.xml"?

I fear the OP is using Struts1, and Struts2 documentation won't be of
nay help...

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


Re: A form without summit?

Posted by Martin <mg...@hotmail.com>.
You can accomplish autocomplete with the autocompleter Struts Tag
http://struts.apache.org/2.0.6/struts2-core/apidocs/org/apache/struts2/components/Autocompleter.html
Take note of theme="ajax"
http://struts.apache.org/2.0.11.1/docs/autocompleter.html

HTH
Martin
----- Original Message ----- 
From: "thomas2004" <th...@yahoo.de>
To: <us...@struts.apache.org>
Sent: Wednesday, May 28, 2008 6:15 AM
Subject: A form without summit?


>
> Simply to say, I have a bean class looks as follow:
>
> public class Address{
>  private street;
>
>  public Address(){
>     setStreet("Broadway");
>  }
>
>  public void setStreet(String street){
>    this.street = street;
>  }
>
>  public String getStreet(){
>    return this.street;
>  }
> }
>
> Now in the "myaddress.jsp", I just want to show the address as one invoke
> this page, without clicking any submit button:
> ...
>  <bean:write name="address" property="street" />
> ...
>
> How can I define the mappings in "struts-config.xml"?
> -- 
> View this message in context: 
> http://www.nabble.com/A-form-without-summit--tp17509426p17509426.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
> 


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


Re: A form without summit?

Posted by Jim Kiley <jh...@summa-tech.com>.
I would make this bean a member of your action class -- so that you have

public class MyAction {
  private Address address;
// plus getter and setter for the address
}

And then, on the rendered jsp, you can use it by doing things like
<s:property value="address.street"/>

There's no special struts config for this, beyond associating MyAction with
your action. In struts.xml you simply need to do something like this:

<action name="myAction" class="com.foo.MyAction">
    <result name="success">/myJsp.jsp</result>
</action>

On Wed, May 28, 2008 at 6:15 AM, thomas2004 <th...@yahoo.de> wrote:

>
> Simply to say, I have a bean class looks as follow:
>
> public class Address{
>  private street;
>
>  public Address(){
>     setStreet("Broadway");
>  }
>
>  public void setStreet(String street){
>    this.street = street;
>  }
>
>  public String getStreet(){
>    return this.street;
>  }
> }
>
> Now in the "myaddress.jsp", I just want to show the address as one invoke
> this page, without clicking any submit button:
> ...
>  <bean:write name="address" property="street" />
> ...
>
> How can I define the mappings in "struts-config.xml"?
> --
> View this message in context:
> http://www.nabble.com/A-form-without-summit--tp17509426p17509426.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Jim Kiley
Technical Consultant | Summa
[p] 412.258.3346 [m] 412.445.1729
http://www.summa-tech.com

Re: A form without summit?

Posted by Laurie Harper <la...@holoweb.net>.
thomas2004 wrote:
> Simply to say, I have a bean class looks as follow:
> 
> public class Address{
>   private street;
>   
>   public Address(){
>      setStreet("Broadway");
>   }
>        
>   public void setStreet(String street){
>     this.street = street;
>   }
> 
>   public String getStreet(){
>     return this.street;
>   }
> }
> 
> Now in the "myaddress.jsp", I just want to show the address as one invoke
> this page, without clicking any submit button:
> ....
>   <bean:write name="address" property="street" />
> ....
> 
> How can I define the mappings in "struts-config.xml"?

To simply display the value, you just need to make an Address object 
available in some scope, e.g. by calling request.setAttribute("address", 
someAddress) in your action. That wont give you a form (with or without 
a submit button), but will allow you to show the address. Is that 
sufficient?

L.


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