Showing posts with label method. Show all posts
Showing posts with label method. Show all posts
Sunday, September 24, 2017
sudo timestamp too far in the future fixing method
sudo timestamp too far in the future fixing method
If you ever see this error which telling you the line below:-
"sudo: timestamp too far in the future"
Then run a simple command in Terminal found on Accessories menu
sudo -k
You have to enter password to solve . It is a bug on time settings (time-stamp issue) on your machine. After running the command above change the time as your desire. This command will work on various debian based Linux Operating System. Check it out by yourself.
download file now
Sunday, August 6, 2017
Struts Error Exception No getter method available for property name for bean under name
Struts Error Exception No getter method available for property name for bean under name
Recently I was using Struts v1.x and I needed to display a select list. The information about how to use the html:optionsCollection tag was sketchy. I was able to get the tag working this way:
On the JSP page, I added this inside the html:form tag:
<html:select property="selectedEquipment"> <html:optionsCollection property="equipment" label="name" value="id"/> </html:select>
Then I create a Java class called SelectOption like this:
package com.codebits.struts; public class SelectOption { String id; String name; SelectOption() { } SelectOption(final String _id, final String _name) { setId(_id); setName(_name); } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } } Next I created an ActionForm bean:
package com.codebits.struts; public class AddForm extends ActionForm { private Integer selectedEquipment = null; private List equipment = new ArrayList(); public Integer getSelectedEquipment() { return selectedEquipment; } public void setSelectedEquipment(Integer selectedEquipment) { this.selectedEquipment = selectedEquipment; } public List getEquipment() { return equipment; } public void addEquipment(final String equipmentId, final String emtEquipmentId) { this.equipment.add(new SelectOption(equipmentId, emtEquipmentId)); } public void setEquipment(List equipment) { this.equipment = equipment; } } And finally, in my action class, I prepopulated the ActionForm bean:
AddForm addForm = (AddForm)form; addForm.addEquipment("1", "AAA"); addForm.addEquipment("2", "BBBB"); download file now
Subscribe to:
Posts (Atom)