Katie Doody

Ranch Hand
+ Follow
since Nov 03, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Katie Doody

Ironically, if you check theFile.length() > 0 (wrong) rather than getUpload().length() > 0 it will work on occasion but not consistently.
10 years ago
Nevermind, it was my code and a stupid mistake. At first I was checking to make sure that the file had a value when I should have been checking to see if the upload had a value since I was creating a new file and copying the upload to this new file. Here is the corrected code:

10 years ago
Hello, I am using the file upload in struts 2 and it works perfectly on my local machine but when I deploy to the server it is not working. I have tried adding: struts.multipart.saveDir="/usr/local/jboss/server/default/work/jboss.web/localhost/easements" to the struts.properties but the path does not seem to make a difference.

The first time I go into the application and try to attach the document I can see the file being written and the log also shows this. I think it is the actual upload that is faling but there are no errors in the log.

Does anyone have any ideas?
10 years ago
Yes, that works. Thank you so much. I think I might be losing because I don't remember having to do that before.

Thank you...sigh .
10 years ago
Thanks for your reply. Why is everything moving to the right ? I am using an action form in Struts 2 but I am used to Struts 1. Before I ever added the validation everything worked fine but now that I added the validation I lose any bean with multiple attributes. I know if i took my bean that is made up of first name, last name and id and created getters and setter for each of these on the action form that this would work.

The thing is I have several arraylists that this would not work for and I am not sure how to make it work. I get an error when I try to store the arraylists as hidden fields since they are not really a single hidden field. I know in struts 1 you could use a use bean?

Thanks for your help.
10 years ago
I am trying to simplify my question in the hopes that someone will answer. I have been stuck on this for a while. In my form I have a getter and setter for transfer object. I also have individual fields that I set.

If I set the individual fields on the form, the values stay when validation fails but when I use the iterate tag or the bean tag the values do not stay.

So I have the following transfer object:


In my form, I have a setter and getter for the object and not for each fields in the object. When I use the object, all the values are wiped out if validation fails.




Any help would be appreciated.
10 years ago
I found the answer. I was close but my syntax was not quite right. The code below sends multiple parameters specific to each row to create dynamic links. Thanks anyway.


[ September 30, 2008: Message edited by: Katie Doody ]
None of the fields were populating because I was using a session bean to display the data. As far as I can find, I need to set all the data in the form in order to do the validation. Well, I know this is now working since I set all the form values. but if anyone knows of a way to use the bean it would be nice.
10 years ago
I am trying to create a dynamic link and my row value does not seem to change. It is always passing the value of the first row. I have tried everything I could find so any help would be great. In the two links below row.reqId does not change. If I display the property in the table, it is changing properly but when I try to reference it so I can pass it to the javascript it is always passing the reqId for the first row?

Here is my code:


[ September 30, 2008: Message edited by: Katie Doody ]
For some reason when validation fails on my form I lose my been value and my jsp displays empty. I am iterating through my bean in my jsp. I tried just setting the form field and displaying it in the jsp and this value returns after validation. I don't understand why my bean does not work?
Here is my action:












private String GenerateOutput(File xsltFile,File xmlFile,String req_or_easement) {

/* New code for setting up a FOP driver and showing a read-only PDF document*/
try

{

ByteArrayOutputStream out = new ByteArrayOutputStream();
ServletOutputStream output = null;
// 1. Instantiate org.apache.fop.apps.Driver.


Driver driver = new Driver();

// 2. Set the type of rendering you want to do.

driver.setRenderer(Driver.RENDER_PDF);

// 3. Set a logger to log to.

// driver.setLogger(logger);

//4. Set an Input Handler as an XSLTInputHandler.

InputHandler inputHandler = new XSLTInputHandler(xmlFile,xsltFile);

// 5. Set an output stream to render to.

driver.setOutputStream(out);

// 6. Grab the parser out of this handler and render.


driver.render(inputHandler.getParser(), inputHandler.getInputSource());
// inputHandler.run(driver);




getResponse().setContentType("application/pdf");
//ked changed to avoid use of back button
getResponse().setHeader("Content-disposition","attachment;filename=easEasement.pdf" );
byte[] content = out.toByteArray();
getResponse().setContentLength(content.length);
output = getResponse().getOutputStream();
output.write(content);
output.flush();
output.close();



} catch (Exception e) {
setActionErrors(null);
getLogger().error("Exception in EASEasementTemplateA.GenerateOutput", e);
addActionError(EASMessages.MESSAGE1);
}

return SUCCESS;

}




public Logger getLogger() {
return logger;
}

public void setLogger(Logger logger) {
this.logger = logger;
}



public void setServletResponse(HttpServletResponse httpServletResponse) {
this.setResponse(httpServletResponse);
}

public HttpServletResponse getServletResponse() {
return this.getResponse();
}

public HttpServletRequest getRequest() {
return request;
}

public void setServletRequest(HttpServletRequest request) {
this.setRequest(request);
}

public HttpServletResponse getResponse() {
return response;
}

public void setResponse(HttpServletResponse response) {
this.response = response;
}

public void setRequest(HttpServletRequest request) {
this.request = request;
}


public String getCommand() {
return command;
}

public void setCommand(String command) {
this.command = command;
}

public Map getSession() {
return session;
}

public void setSession(Map session) {
this.session = session;
}

public EASEasementScheduleTO getEasEasementScheduleTO() {
return easEasementScheduleTO;
}

public void setEasEasementScheduleTO(EASEasementScheduleTO easEasementScheduleTO) {
this.easEasementScheduleTO = easEasementScheduleTO;
}

public EASEasementTO getEasEasementTO() {
return easEasementTO;
}

public void setEasEasementTO(EASEasementTO easEasementTO) {
this.easEasementTO = easEasementTO;
}

public String getXslt() {
return xslt;
}

public void setXslt(String xslt) {
this.xslt = xslt;
}

public String getRequestNbr() {
return requestNbr;
}

public void setRequestNbr(String requestNbr) {
this.requestNbr = requestNbr;
}

public int getReqId() {
return reqId;
}

public void setReqId(int reqId) {
this.reqId = reqId;
}

public String getJobNbr() {
return jobNbr;
}

public void setJobNbr(String jobNbr) {
this.jobNbr = jobNbr;
}

public StringBuffer getXmlHistory() {
return xmlHistory;
}

public void setXmlHistory(StringBuffer xmlHistory) {
this.xmlHistory = xmlHistory;
}

public String getPartner() {
return partner;
}

public void setPartner(String partner) {
this.partner = partner;
}

public String getPermAcres() {
return permAcres;
}

public void setPermAcres(String permAcres) {
this.permAcres = permAcres;
}

public String getKeyword() {
return keyword;
}

public void setKeyword(String keyword) {
this.keyword = keyword;
}

public String getTempAcres() {
return tempAcres;
}

public void setTempAcres(String tempAcres) {
this.tempAcres = tempAcres;
}

public String getLawTempEasement() {
return lawTempEasement;
}

public void setLawTempEasement(String lawTempEasement) {
this.lawTempEasement = lawTempEasement;
}

public String getLawPermEasement() {
return lawPermEasement;
}

public void setLawPermEasement(String lawPermEasement) {
this.lawPermEasement = lawPermEasement;
}

public String getWitness() {
return witness;
}

public void setWitness(String witness) {
this.witness = witness;
}

public String getGrantor() {
return grantor;
}

public void setGrantor(String grantor) {
this.grantor = grantor;
}

public String getRange2() {
return range2;
}

public void setRange2(String range2) {
this.range2 = range2;
}

public EASFormParamTO getEasFormParamTO() {
return easFormParamTO;
}

public void setEasFormParamTO(EASFormParamTO easFormParamTO) {
this.easFormParamTO = easFormParamTO;
}

public String getOriginalUser() {
return originalUser;
}

public void setOriginalUser(String originalUser) {
this.originalUser = originalUser;
}


public String getRole() {
return role;
}

public void setRole(String role) {
this.role = role;
}

public String getTitle() {
return title;
}

public void setTitle(String title) {
this.title = title;
}

public String getLastName() {
return lastName;
}

public void setLastName(String lastName) {
this.lastName = lastName;
}

public String getFirstName() {
return firstName;
}

public void setFirstName(String firstName) {
this.firstName = firstName;
}

public EASUserInfoTO getEasUserInfoTO() {
return easUserInfoTO;
}

public void setEasUserInfoTO(EASUserInfoTO easUserInfoTO) {
this.easUserInfoTO = easUserInfoTO;
}

public String getEid() {
return eid;
}

public void setEid(String eid) {
this.eid = eid;
}

public boolean isReadOnly() {
return readOnly;
}

public void setReadOnly(boolean readOnly) {
this.readOnly = readOnly;
}



}


My jsp:
10 years ago
This is a great site with code you can download:

http://www.devx.com/webdev/10MinuteSolution/31020/0/page/2

This was also good in getting displaytag set up because there were some supporting jars I was missing:

http://www.laliluna.de/struts-paging-tutorial.html
10 years ago
I found the answer to my question. My syntax was wrong. This accomplishes what I need to do;


[ September 23, 2008: Message edited by: Katie Doody ]
10 years ago
I am looking on documentation on using displaytag with struts 2. Does anyone know of a good resource? Also, if maybe there is something better to use for paging with struts 2?

Thanks.
10 years ago
I am working on validation and need to do the following logic:



What I am trying to do is say either lawPermEasement and permAcres must have values OR lawTempEasement and tempAcres must have values OR all four fields can have values.

I am having real problems with whether the validation should be written in the negative or the positive.
[ September 17, 2008: Message edited by: Katie Doody ]
10 years ago
I think this is what you are looking for.The corresponding xml file used for the validation of your form should have:

10 years ago