On the way to componentization (iii) -- the advantages of JSF forget http

Source: Internet
Author: User

Now let's start with the advantages of JSF. One by one, we should sort out the primary and secondary items at last. Now we will focus on the above issues first.

1. URL to action method


In JSF, we write a button to send a request and execute an action in a way like this:

<H: form>
<H: inputText value = "# {someAction. text1}"/>
<H: commandButton value = "execute" action = "# {someAction. method1}"/>
</H: form>


Execute the method1 method of someAction when you click the button. We do not need to care about the URL to which the form is submitted and how to call SomeAction. method1. You may be surprised to look at another example:

<H: form>
<! -- Loop the users set in someAction -->
<Ui: repeat value = "# {userAction. users}" var = "u">
<H: commandButton value = "delete" action = "# {userAction. remove (u)}"/> <! -- Are you surprised to see this method call? -->
</Ui: repeat>
</H: form>


The bean implementation class userAction contains a remove method that receives a User-type parameter. On the page, during the loop process, we directly ask the button's action = "# {userAction. remove (u)} ", so when you click the button, the background action object can correctly receive the User object you want to delete. How are the frontend and backend parameters transmitted? Where is the User object stored? We don't need to worry about it. As you can see, the above Code has almost no content related to HTTP details.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.