aspose file tools*
The moose likes Struts and the fly likes why+beans+are+used? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "why+beans+are+used?" Watch "why+beans+are+used?" New topic
Author

why+beans+are+used?

anand kumarblr
Greenhorn

Joined: Oct 27, 2006
Posts: 27
hi,
we all are using beans in our struts application,but i want to know what are beans and what is the exact use of beans?A real time example for this?whether struts applications will not work without beans?briefly i want the use of struts in non programming words.
kindly post me fast
Thanks in Advance
RoshaniG Gopal
Ranch Hand

Joined: May 15, 2006
Posts: 180
Hi Amith,
"Beans" is a very generic term. But used with Struts, beans generally refers to the ActionForm. Without "this bean(ActionForm)" it is not posible to use Struts as Struts framework calls this 'Bean' from the ActionClass.
Beans are otherwise POJOs that may be used anywhere in any application.
Hope it helps you.


Regards,<br />Roshani
anand kumarblr
Greenhorn

Joined: Oct 27, 2006
Posts: 27
hi Roshini,
Thanks for the confirmation regarding beans,but i am new to struts so i want to know the difference between <bean:write> and <bean:message>?i know <bean:write> is used to get message from application properties file but where we use <bean:write>.what is the need?plese explain me with a sample example>
Anyway Thanks in Advance,you know more on struts,how many years of experience you have?if not mind.
bye ,be posting me,
AMITH
RoshaniG Gopal
Ranch Hand

Joined: May 15, 2006
Posts: 180
i know <bean:write> is used to get message from application properties file but where we use <bean:write>.what is the need?

Hi Amith,
Please note <bean:message> is used for wrtitng from the application properties file. But <bean:write> is used in conjunction with <logic resent>, <logic:iterate> to write on a JSP from a collection that is in ActionForm.
Example:<bean:message>
---------------
<bean:message key="label.search.name"/>:
<html:text property="fname"/>

this is same as:
Name:
<html:text property="fname"/>

Application Properties file
label.search.name=Name
--------------------------------
<bean:write>

<logic:iterate id="anyname" name="searchForm" property="results">
<tr>
<td><bean:write name="anyname" property="name"/></td>
<td><bean:write name="anyname" property="ssNum"/></td>
</tr>
</logic:iterate>

the ActionForm would have a collection as:

public void setResults(List results) {
this.results = results;
}

Thus it is used to write the dynamic values on the JSP..
Hope it helps..
[ November 06, 2006: Message edited by: RoshaniG Gopal ]
anand kumarblr
Greenhorn

Joined: Oct 27, 2006
Posts: 27
Thanks Roshani,
it helped me a lot.i am doing a sample application and my manager wants me to write action messages in my apllication,so please tell me what are action messages and where should i write these messages?how it displays?if possible explain this with an simple example?where it will display the messages?i think its a long question,sorry but i want to explain you all the queries.
I know you will solve my problem,Thanks in advance.
Bye and GoodMorninig.
RoshaniG Gopal
Ranch Hand

Joined: May 15, 2006
Posts: 180
Hi Amith,
It would be unfair to do spoon feeding as you would always feel uncomfortable in Struts. Please go through a basic struts tutorial and ask for specfic problem.
http://www.roseindia.net/struts/
Happy coding.
amith amith
Greenhorn

Joined: Oct 26, 2006
Posts: 7
ok,let it be,thanks for giving me good suggestions,
i will post when there is a big problem,
Thanks,Amith
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why+beans+are+used?