JSP and Action pass value problem (1) EL / str label / jsp statements Key: Redirect and EL

ACTION:

1) accept the reception parameters:

action in the foreground want to accept the value of the entity class object set / get method must be implemented

(Method with reception ①input name = value variable names or objects. Attribute name ②)

Achieved after all values ​​are placed in front of the buffer entity class or an object of a user, such as a variable name in checkcode,

action must implement the set / get the method (entity object or a single variable checkcode)

2) issued to the foreground parameters

Send ①request

② implement variable set / get method, directly accept direct assignment

 

THE

1 $ {name} attribute acceptable action attribute request provided by

. 1) Action ------> JSP  √ can

action code

	private HttpServletRequest request;
	request.setAttribute("username", user.getUser_name());

jsp in

<input class="shurukuang" type="text" value="${username}">

2) JSP -------> Action     × Not

Above method not vice versa (including request.get attributes, get parameters)

supplement:

$ {Entity class object has been defined. Attribute name}

Property value may be acquired frame existing entity class object (limited, so understanding temporarily)

Correct format is $ {user.user_name}

Where $ {user.username} If the system is not being given User entity class value of this property

Note: The entity class can be more than one object, such as user1 user2, and if they have been assigned, you can call 

${user.user_name}  ${user1.user_name}

If only traditional values ​​to jsp, may not be set / get the entity class object user1 / user2

 

2.struts label 

In action for the front page of traditional values,

3.jsp pass through the request and action values

action:

	private HttpServletRequest request;
	request.setAttribute("username", user.getUser_name());

jsp:         out.print(request.getAttribute("username")); 

Guess you like

Origin blog.csdn.net/qq_41850194/article/details/85336007