Simplified spring (4)-view layer

Source: Internet
Author: User

Life is like a stage. Please let us go.
Similarly, freemarker and velocity fans should skip this article. Freemarker is the same as abandoning webwork and using the spring MVC Controller Interface.
This is a good thing. It also supports JSP taglib across borders and is fully supported by webwork. However, for its non-standardization, the number of users and the lack of IDE, at the view layer, we still useConservative but usable by everyone. ide-friendly jsp2.0 works with jstl.


For enterprise application software with B/S structure, there are two basic types of pages, one is to fill in form, the other is to manage the DataGrid data list, and then with some CSS, the effect of JS and Ajax is what the view layer should pay attention.

1. Replace El of JSP 2.0 with <C: Out>

Jsp2.0 can directly write El in the HTML part without using the <C: Out> node. To be honest, the page effects of jsp2.0 + jstl are no different from those of velocity.

<
P
>
{Goods. name}
</
P
>
 
Replace

<
P
> <
C: Out
Value
= "{Goods. name }"
/> </
P
>

(Except El, goods functions cannot be called. Sun insisted that jstl can only be used for data display and cannot perform data operations. Therefore, bean get/set methods cannot be called)

 2. the lazy form data binding

Spring has few poor tags, which are basically chicken ribs. Simple Form in spring development
The tag has not been released yet. The spring tag is mainly used to bind the VO value to the input box. However, like struts, You need to bind input boxes one by one, and the syntax is extremely redundant.
Long, the Select box needs to be processed by yourself... the typical spring Sample Page makes people feel dizzy.

While jodd's form tag
To
The lazy method, as long as the <form> two ends use <jodd: Form
Bean = "myvo"> </jodd: Form>. All input boxes, select boxes, and checkbox are automatically
I don't understand why struts and spring don't need to be bound to such a simple thing. Is it necessary for unnecessary flexibility?

<
Form
>


<
Jodd: Form
Bean
= "Human"
>


<
Input
Type
= "Text"
Name
= "Name"
>


<
Input
Type
= "Radiobox"
Name
= "Sex"
Value
= "Man"
>


<
Select
Name
= "Age"
>


<
Option
Value
= "20"
>
20
</
Option
>


<
Option
Value
= "30"
>
30
</
Option
>


</
Select
>


</
Jodd: Form
>


</
Form
>
 

 

However, a fatal weakness of jodd is that it cannot bind values of embedded objects. For example, if the order object contains a customer object, jodd cannot be bound with the following syntax like struts and spring:

<
Input
Name
= "Customer. customerno"
>

This is because its beanutils is weaker than jakata common and uses a wrong idea. Use beanutils to modify the source code. You can download the modified source code here.
.

3. DataGrid data list

Both displaytag and ValueList belong to the tag library in this form. However, the recent extreme table
Killer is a real killer. It has powerful functions, and he has been thinking about how to let others carry out expansion and overloading from the very beginning. For example, the extend attributes mechanism is displaytag, which makes it not reserved for everyone.

4. CSS, JavaScript, Ajax

There is nothing special about the recommended products. Buffalo
, DWR, scriptaculous, prototype, ajaxtags, ajaxanywhere, Rico, dojo, JSON-RPC, it's a headache to look at the name.

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.