Jstl error ye:javax.el.PropertyNotFoundException:Property ' name ' not found on type Java.lang.String__js

Source: Internet
Author: User

The main reason to write this article is: Because, today's group of a small partner asked a question, and then we guessed for a long time, the data has problems, attributes have problems and so on. Finally found is a small error caused by the Internet, and looked up the relevant data found that we are in the group did not guess right of those problems. So I decided to record it.

Console output:

Javax.el.PropertyNotFoundException:Property ' name ' not found on type java.lang.String

Page output:

Org.apache.jasper.JasperException:An exception occurred processing JSP page/web-inf/jsp/user/findall.jsp at line 30

This mistake believe that everyone in the write El expression when all met, and on the data problem, attribute problems and so on I do not write, on the record of today's group of small partners to ask questions

Entity classes:

public class Users {

	private Long ID;
	private String name;	
	Private String pwd;

	Public Long GetId () {return
		ID;
	}
	public void SetId (Long id) {
		this.id = ID;
	}

	Public String GetName () {return
		name;
	}
	public void SetName (String name) {
		this.name = name;
	}

	Public String getpwd () {return
		pwd;
	}
	public void SetPwd (String pwd) {
		this.pwd = pwd;
	}
	
}
Action class:
@RequestMapping (value = "/find.do", method=requestmethod.get) public
Modelandview FindAll () {
	list< users> FindAll = Usersservice.findall ();
	Modelandview mv = new Modelandview ();  
	Mv.addobject ("list", FindAll);  
	Mv.setviewname ("User/findall");  
	return MV;  
}
JSP page:
<c:foreach items= "list" var= "C" >
    	<tr>
		<td>${c.name}</td>
	    	<td>${ C.pwd}</td>
	</tr>
</c:forEach>
See here, have you found any problems?

The correct JSP page:

<c:foreach items= "${list}" var= "C" >
    	<tr>
		<td>${c.name}</td>-<td>${
	        C.pwd}</td>
	</tr>
</c:forEach>

Believe this problem many people will choose sex skip. So the last group of small partners are ashamed of.
If you haven't found the problem yet ... Items=${list}



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.