File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes jstl and jsp question - edited and reposted Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply locked New topic
Author

jstl and jsp question - edited and reposted

nirali shah
Greenhorn

Joined: Apr 16, 2009
Posts: 24
This question has been reposted for easier reading.
following code I have taken from an example



we are using bean instead of putting logic in the jsp page.

But, we should first create the 'player ' bean with all the attributes and getter & setter methods, as shown.



How is the values of parameters a, b and c is passed to the setName(String a), setPlace(String b) and setGame(String c) from the form without {param.text} ? If the values are passed from the form using {param.text} , then why not use that directly in the jsp page rathet than calling it through bean ? What is the use of bean in such a situation ?



Whats the need of getter methods, when all the variables are public and can be called directly ?

In this demo2.jsp, we collect the data and then display the data entered by the user. Question is, how is data sent to the bean from the form ?

Note that instead of {param.text1}, we are using {bean1.name}. We should carefully name the html form controls with the corresponding attribute names given in the bean. We cannot name the controls as 'text1' etc, now! Question is, we can use {bean1.name} in the jsp page and collect data from bean1 in the jsp page. But how does bean1 get parameters from the form ?



why use ${bean1.name} ? We can directly get parameters from form as ${param.text} ? Whats the point in using bean in this situation ?

thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60057
    
  65

Please do not repost in the future -- rather, edit your original post. I have closed this topic, please continue in the original whihc already has replies and discussion.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jstl and jsp question - edited and reposted
 
Similar Threads
encountering problem in importing java bean
Geting an SQL Exception while passing the resultset to a bean
using logic:iterate tag to access ActionForm elements
jsp:useBean tag query.
bean and jstl question