In type Java Property ‘someproperty’ not found on lang.string

I received this error and I couldn't figure out what the problem might be The "userid" column is located in the database and in the bean Does anyone have an idea?

org.apache.jasper.JasperException: An exception occurred processing JSP page /user.jsp     at line 24  

21:   
22:     <form method="POST" action="AdminServlet" name="frmAddUser">  
23:         User ID : <input type="text" readonly="readonly" name="userid"  
24:             value="<c:out value="${user.userid}" />" />   
Username : <input  
25:             type="text" name="firstName"  
26:             value="<c:out value="${user.firstName}" />" />   
LastName : <input  
27:             type="text" name="lastName"  

root cause   

javax.el.PropertyNotFoundException: Property 'userid' not found on type java.lang.String

thank you.

Solution

The exception is basically telling you that ${user} is an ordinary Java lang.String. According to the Javadoc, it does not have a getuserid () method representing the userid attribute

Make sure that you set the specific user instance within the required range, not the ordinary vanilla string Since you don't show how you prepared the range variable anywhere in the question, it's impossible to give a targeted answer, but it should at least be like this:

User user = userService.find(id);
request.setAttribute("user",user); // and thus not e.g. setAttribute("user","user") or something.
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>