First, Struts uses tips (Mainly from "struts in action)

xiaoxiao2021-03-20  218

First, Struts uses tips (Mainly from "struts in action)

1. Use Array in ActionForm to match repetitive variables. For example, when using MultiBox, the Array can be defined in the Form. 2. Use to display the total number of records of Collection. EG: . If ResultList has two records, 2.3 is displayed. Display cycle number tag: < / Logic: Itereate> 4. Use to check if the object exists. Check if the properties exist in . 5. Relatively stable drop-down list data sets use scope = "application". (This method has always been used, but it is still not clear that it will be used directly when the system is logged in, and it can be used directly). 6. Use the to set the path to the CSS and JS files. (This does not see any difference with direct use). 7. JavaScript and FORM value interaction: This is very frequent useful EG:

Six: JSP page Display strings array:

7: How to define your JSP file issued path (Practice in Windows2000 Environment):

Open the server.xml file under the CONF folder under the Tomcat directory, find the tab

After the tag, add your own publishing path, as follows:

Restart Tomcat, visit: / localhost: 8080 / mybwebapps /, ok!

8: How to solve the problem of remote words:

Use the big character set to set all the JSP page character sets as follows: <% @ page contenttype = "text / html; charSet = GBK"%> Note: GBK must be capitalized.

Nine: Page refresh data Repeated submission issues:

The method of solving is to use redirection. The same as the second solution:

1. Set the Redirect property in struts-config.xml to TRUE.

2. If it is a jump with parameters:

ActionForward Forward = mapping.forward ("Success");

StringBuffer bf = new stringbuffer (forward.getpath ());

bf.append ("? id = 1"); // parameter

Return New ActionForward (bf.tostring (), true);

Ten: Others:

Programming specification suggestion:

Database interface class named: * Dao.Java

Logical class named: * bo.java

Action naming: * action.java

Actionform Named: * form.java

Then a function module is placed in a packet.

They are some of the comparison of primary questions, but I hope to help you learn from the beginning of Struts, and I hope to give pointers to the questions in the text, :). First, Struts uses tips (Mainly from "struts in action)

1. Use Array in ActionForm to match repetitive variables. For example, when using MultiBox, the Array can be defined in the Form. 2. Use to display the total number of records of Collection. EG: . If ResultList has two records, 2.3 is displayed. Display cycle number tag: < / Logic: Itereate> 4. Use to check if the object exists. Check if the properties exist in . 5. Relatively stable drop-down list data sets use scope = "application". (This method has always been used, but it is still not clear that it will be used directly when the system is logged in, and it can be used directly). 6. Use the to set the path to the CSS and JS files. (This does not see any difference with direct use). 7. JavaScript and FORM value interaction: This is very frequent useful EG:

Six: JSP page Display strings array:

7: How to define your JSP file issued path (Practice in Windows2000 Environment):

Open the server.xml file under the CONF folder under the Tomcat directory, find the tab

After the tag, add your own publishing path, as follows:

Restart Tomcat, visit: / localhost: 8080 / mybwebapps /, ok!

8: How to solve the problem of remote words:

Use the big character set to set all the JSP page character sets as follows: <% @ page contenttype = "text / html; charSet = GBK"%> Note: GBK must be capitalized.

Nine: Page refresh data Repeated submission issues:

The method of solving is to use redirection. The same as the second solution:

1. Set the Redirect property in struts-config.xml to TRUE.

2. If it is a jump with parameters:

ActionForward Forward = mapping.forward ("Success");

StringBuffer bf = new stringbuffer (forward.getpath ());

bf.append ("? id = 1"); // parameter

Return New ActionForward (bf.tostring (), true);

Ten: Others:

Programming specification suggestion:

Database interface class named: * Dao.Java

Logical class named: * bo.java

Action naming: * action.java

Actionform Named: * form.java

Then a function module is placed in a packet.


New Post(0)