Summary of Web application development based on struts (i)

Source: Internet
Author: User

Often write the code, after a period of time to write a number of problems, explained that their understanding of the code is not enough. Summarized as follows:


Edit a record, click on the "Edit" button, when the open is a new page (such as modal box), think of the record ID to the open page. Because the open page is not the same window as the original action page, you cannot assign the value to an open page element (such as a hidden element) when you click the Edit button to perform the action. Such as:

$ ("phone_list_id"). Value = phone_list_id//This approach is not acceptable, and cannot take $ ("phone_list_id") because the page that operates is not the same page as the page where $ ("phone_list_id") is located.

At this point, you can pass the method with the URL parameter, as follows:

JS Code

url = "/epub_web/jsp/phone_list_mgr/"+serial_num;

In the Open JSP page, use: value= "<%=request.getparameter" ("phone_list_id")%> ", as follows:

HTML code

<input type="hidden" name="PHONE_LIST_ID" id="PHONE_LIST_ID" value="<%=request.getParameter("PHONE_LIST_ID")%>"></input>

So, through the way of the URL parameter passing, can realize the parameter passing across the page, without using hidden domain to pass. This works well for cross page parameter passing, especially if it is similar to editing records.


The 1th above:

<input type= "hidden" name= "phone_list_id" id= "phone_list_id" value= "<%=request.getparameter" ("PHONE_LIST_ID") %> "></input>

This line of code I used to use

Because I am in the environment of JBoss, but when get webspheer environment but there is a hint of error, before seems to have found this situation, also do not know why, first recorded.


Because of carelessness, in the XML configuration, <action path= "" type= "" Name= "" scope= "" parameter= "" ></action> "" the attribute of the Name= "" omitted, so the program ran, The actionform on the servlet side always prompts for null, which is a bit of a time. When there is time to make a good understanding of the role of struts configuration properties.


On the servlet side, with the get and set method of struts's actionform, it is found that the foreground has no set success. Later checked for a long time to know that the front desk did not use struts with the HTML tag, such as

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: 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.