StrutsTestCase
Thanks to this list I just found the StrutsTestCase package. I think its a great tool. Testing my forms and actions OUTSIDE the container has increased my velocity 10 fold. But it seems that not many Struts people talk about this package (aside from page 510 of J.B.'s book). Is there something wrong with it? Seems to me that StrutsTestCase really allows you to do TDD and Struts, a very powerful combination. Am I missing some major negative about StrutsTestCase? Thanks. --Marty - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
file upload problem
Hi, I am modifying the upload files given by struts and trying to upload the file to server without the user entering any path. I have modified the upload.jsp with html:text property=filePath value=/upload/images / Its means I am trying to upload to the same context in which the jsp is running (webapps/test/upload/images) I have modified the UploadAction.java as //else { //write the file to the file specified String filePath = theForm.getFilePath(); System.out.println(filePath:+filePath); String fileName2 = filePath+/+fileName; System.out.println(fileName2:+fileName2); OutputStream bos = new FileOutputStream(fileName2); int bytesRead = 0; byte[] buffer = new byte[8192]; while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) { bos.write(buffer, 0, bytesRead); } bos.close(); data = The file has been written to \ + theForm.getFilePath() + \; //} I get this output too filePath:/upload/images fileName2:/upload/images/test.jpg I do not have any error the page just becomes blank and the file is not uploaded. Any ideas? Uma - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: file upload problem
include the below and check html:text property=filePath value=/upload/images enctype=multipart/form-data/ - Original Message - From: uma.k [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Saturday, December 18, 2004 3:10 PM Subject: file upload problem Hi, I am modifying the upload files given by struts and trying to upload the file to server without the user entering any path. I have modified the upload.jsp with html:text property=filePath value=/upload/images / Its means I am trying to upload to the same context in which the jsp is running (webapps/test/upload/images) I have modified the UploadAction.java as //else { //write the file to the file specified String filePath = theForm.getFilePath(); System.out.println(filePath:+filePath); String fileName2 = filePath+/+fileName; System.out.println(fileName2:+fileName2); OutputStream bos = new FileOutputStream(fileName2); int bytesRead = 0; byte[] buffer = new byte[8192]; while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) { bos.write(buffer, 0, bytesRead); } bos.close(); data = The file has been written to \ + theForm.getFilePath() + \; //} I get this output too filePath:/upload/images fileName2:/upload/images/test.jpg I do not have any error the page just becomes blank and the file is not uploaded. Any ideas? Uma - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: file upload problem
I get an error org.apache.jasper.compiler.CompileException: /upload/upload.jsp(32,4) Attribute enctype invalid according to the specified TLD I am already using enctype in the html:form But when I hard code the value to system path e.g. c:\\test\\mages then it works but I dont want this. As I need to upload the file to the server. Any ideas? -Original Message- From: Jay Chandran [mailto:[EMAIL PROTECTED] Sent: Saturday, December 18, 2004 3:57 PM To: Struts Users Mailing List Subject: Re: file upload problem include the below and check html:text property=filePath value=/upload/images enctype=multipart/form-data/ - Original Message - From: uma.k [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Saturday, December 18, 2004 3:10 PM Subject: file upload problem Hi, I am modifying the upload files given by struts and trying to upload the file to server without the user entering any path. I have modified the upload.jsp with html:text property=filePath value=/upload/images / Its means I am trying to upload to the same context in which the jsp is running (webapps/test/upload/images) I have modified the UploadAction.java as //else { //write the file to the file specified String filePath = theForm.getFilePath(); System.out.println(filePath:+filePath); String fileName2 = filePath+/+fileName; System.out.println(fileName2:+fileName2); OutputStream bos = new FileOutputStream(fileName2); int bytesRead = 0; byte[] buffer = new byte[8192]; while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) { bos.write(buffer, 0, bytesRead); } bos.close(); data = The file has been written to \ + theForm.getFilePath() + \; //} I get this output too filePath:/upload/images fileName2:/upload/images/test.jpg I do not have any error the page just becomes blank and the file is not uploaded. Any ideas? Uma - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Preview of an Image and text
1. From the jsp page select the image (image path) for uploading. Let the preview button be a submit button . form name =frm method=POST action=$link.setAction('graphics') enctype=multipart/form-data INPUT TYPE =hidden NAME =filePath size=39 value=C:\Program Files\Tomcat 5.0\webapps\cevm\uploadedimages\/ input type=submit value=Preview style=width:80 onClick=setHidValue() function setHidValue() { document.frm.paramPassed.value=preview; } input type=hidden name=paramPassed size=25/ ie when u click the preview button a java script function is called, in which we assign a value to the hidden variable as preview. this value is passed to the action file. ur struts config file willl be form-bean name=graphicsForm type=GraphicsForm/ action path=/graphics type=GraphicsInfoDetailsAction name=graphicsForm scope=request input=/submit.vm forward name=preview path=/preview.vm / /action ur graphicsForm is import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionMapping; import org.apache.struts.upload.FormFile; import org.apache.struts.upload.MultipartRequestHandler; public class GraphicsForm extends ActionForm { public static final String ERROR_PROPERTY_MAX_LENGTH_EXCEEDED = MaxLengthExceeded; /** * The value of the text the user has sent as form data */ protected String theText; /** * The value of the embedded query string parameter */ protected String queryParam; /** * Whether or not to write to a file */ protected boolean writeFile; /** * The file that the user has uploaded */ protected FormFile logoFile; /** * The file path to write to */ protected String filePath; /** * Retrieve the value of the text the user has sent as form data */ protected String paramPassed; public String getParamPassed() { return paramPassed; } public void setParamPassed(String argParamPassed) { this.paramPassed=argParamPassed; } /** * Retrieve the value of the query string parameter */ public String getQueryParam() { // queryParam=Successful; return queryParam; } /** * Set the value of the query string parameter */ public void setQueryParam(String queryParam) { this.queryParam = queryParam; } /** * Retrieve a representation of the logoFile the user has uploaded */ public FormFile getLogoFile() { return logoFile; } /** * Set a representation of the logoFile the user has uploaded */ public void setLogoFile(FormFile logoFile) { this.logoFile = logoFile; } /** * Set whether or not to write to a file */ public void setWriteFile(boolean writeFile) { this.writeFile = writeFile; } /** * Get whether or not to write to a file */ public boolean getWriteFile() { return writeFile; } /** * Set the path to write a file to */ public void setFilePath(String filePath) { this.filePath = filePath; } /** * Get the path to write a file to */ public String getFilePath() { return filePath; } public void reset() { writeFile = false; } /** * Check to make sure the client hasn't exceeded the maximum allowed upload size inside of this * validate method. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = null; //has the maximum length been exceeded? Boolean maxLengthExceeded = (Boolean) request.getAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED); if ((maxLengthExceeded != null) (maxLengthExceeded.booleanValue())) { errors = new ActionErrors(); errors.add(ERROR_PROPERTY_MAX_LENGTH_EXCEEDED, new ActionError(maxLengthExceeded)); } return errors; } } ur action file will be import java.io.ByteArrayOutputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Date; import java.util.Calendar; import java.util.GregorianCalendar; import java.text.SimpleDateFormat; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.upload.FormFile; import org.apache.struts.action.ActionServlet; import java.sql.Connection;
Re: file upload problem
change the below line of ur action file String fileName2 = filePath+/+fileName; to String fileName2 = filePath+fileName; - Original Message - From: uma.k [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED]; 'Jay Chandran' [EMAIL PROTECTED] Sent: Saturday, December 18, 2004 3:44 PM Subject: RE: file upload problem I get an error org.apache.jasper.compiler.CompileException: /upload/upload.jsp(32,4) Attribute enctype invalid according to the specified TLD I am already using enctype in the html:form But when I hard code the value to system path e.g. c:\\test\\mages then it works but I dont want this. As I need to upload the file to the server. Any ideas? -Original Message- From: Jay Chandran [mailto:[EMAIL PROTECTED] Sent: Saturday, December 18, 2004 3:57 PM To: Struts Users Mailing List Subject: Re: file upload problem include the below and check html:text property=filePath value=/upload/images enctype=multipart/form-data/ - Original Message - From: uma.k [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Saturday, December 18, 2004 3:10 PM Subject: file upload problem Hi, I am modifying the upload files given by struts and trying to upload the file to server without the user entering any path. I have modified the upload.jsp with html:text property=filePath value=/upload/images / Its means I am trying to upload to the same context in which the jsp is running (webapps/test/upload/images) I have modified the UploadAction.java as //else { //write the file to the file specified String filePath = theForm.getFilePath(); System.out.println(filePath:+filePath); String fileName2 = filePath+/+fileName; System.out.println(fileName2:+fileName2); OutputStream bos = new FileOutputStream(fileName2); int bytesRead = 0; byte[] buffer = new byte[8192]; while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) { bos.write(buffer, 0, bytesRead); } bos.close(); data = The file has been written to \ + theForm.getFilePath() + \; //} I get this output too filePath:/upload/images fileName2:/upload/images/test.jpg I do not have any error the page just becomes blank and the file is not uploaded. Any ideas? Uma - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Displaying errors messages from validate in V1.2.4
Your ActionMessage should contain the key to a message in some message resources, rather than the actual message itself. Something like... errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionMessage( user.required ) ); then define user.required=User name is null in your message resources. Niall - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 17, 2004 8:47 PM Subject: Displaying errors messages from validate in V1.2.4 Hi, I cannt find the correct setup for html:messages to display error messages from a form's validate method in Struts 1.2.4 For example, if I have something like this in the validate method: snip public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if (username == null) { errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionMessage( User name is null ) ); return errors; /snip What is the correct struts tag to use to display the error message ? Are the java docs accurate? Best regards, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
struts Validator framework -URGENT Pls...
Hi All Its very urgent for me.I am struck on this point at a very critical point of my project. I am using Validator framework of struts 1.1 In Validator.xml file for my mask variable i am using regular expression so as the string to accept alphanum+special char-.,-,,\s .nowI want my regular expression to have scope to accept french chars too .so i am using unicode to represent that but its not working. the problem is when i write my regex in validator.xml file as [A-Za-z0-9-.\\s] its fine but as soon as i write [A-Za-z0-9-.\\s\u00E0] its not working I even tried to replace \u00E0 with\x{E0}(hex) its still not working. Please kindly help me out what should i do.(somewhere i read that old version of validator framework supported this) i couldn't get that how come that new version will remove this and secondly if this is so from where will i get that version and which version.I request u all to Please help me out .Its really very urgent. Thanx .Wating for someone's response before monday ThanKs Regards Runa Yahoo! India Matrimony: Find your life partneronline.
Re: Preview of an Image and text
Works good with firefox as well , seems like a damned good simple solution to me. Hey did you see Brady Hegberg's post for dynamic dropdown list's, I reckon you'll like it as well, also cross platform. quote If you wanted to be a bit more ambitious you could also try implimenting this: http://developer.apple.com/internet/webcontent/xmlhttpreq.html Brady /quote --b On Fri, 17 Dec 2004 12:14:06 -0500, Frank W. Zammetti [EMAIL PROTECTED] wrote: You might consider doing it all on the client... html head titletest/title script function preview() { lyrPreview.innerHTML = ; lyrPreview.innerHTML += Some message text...br; lyrPreview.innerHTML += img src=\file:// + theForm.theFile.value + \; } /script /head body Select file, then click button to preview:br form name=theForm input type=file name=theFile input type=button onClick=preview(); value=Preview message /form brbr uPreview:/ubrbr span id=lyrPreview/span /body /html Works on IE, can't say whether it does on anything else. Of course, this will only work if you have enough information to construct the complete preview on the client at that point, but you could alternatively submit the form, then in the reply construct the file:// reference to the image as I've done above. That would probably give you the best of both worlds, and also remove any cross-browser concerns. But, if you can do it without touching the server, so much the better I figure. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com uma.k wrote: Hi, I have a form where the user is given the option to select a file to upload(normally gif or jpg) before the user submits the file to the server, I wanted to show him a preview of his message and image. How do I do that? Where do I store the image temporarly? Any solutions? Uma - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- http://www.revoltingdigits.com https://jestate.dev.java.net - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Preview of an Image and text
Just carry the path of the file, not the image itself. When you submit the form you can get at that information (I believe, if not just grab it via JavaScript on the form submission and stick it in a hidden field). Then, when yout next JSP executes, you have the path to the file and you construct the img path: img src=%=file://+myForm.getPathToImageUserSelected()$ Something like that. The basic idea is that the JSP you send back as a result of the form submission is displaying the image from the user's PC, not your server. You just need to append the file:// part of the image's URI at some point. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com uma.k wrote: Hi Frank, Thanks for the reply. Your solution works good if I have to show preview in the same page but I what if I need to show preview in the next JSP? How do I carry the values/images? Uma -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Friday, December 17, 2004 10:44 PM To: Struts Users Mailing List Subject: Re: Preview of an Image and text You might consider doing it all on the client... html head titletest/title script function preview() { lyrPreview.innerHTML = ; lyrPreview.innerHTML += Some message text...br; lyrPreview.innerHTML += img src=\file:// + theForm.theFile.value + \; } /script /head body Select file, then click button to preview:br form name=theForm input type=file name=theFile input type=button onClick=preview(); value=Preview message /form brbr uPreview:/ubrbr span id=lyrPreview/span /body /html Works on IE, can't say whether it does on anything else. Of course, this will only work if you have enough information to construct the complete preview on the client at that point, but you could alternatively submit the form, then in the reply construct the file:// reference to the image as I've done above. That would probably give you the best of both worlds, and also remove any cross-browser concerns. But, if you can do it without touching the server, so much the better I figure. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com uma.k wrote: Hi, I have a form where the user is given the option to select a file to upload(normally gif or jpg) before the user submits the file to the server, I wanted to show him a preview of his message and image. How do I do that? Where do I store the image temporarly? Any solutions? Uma - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
online book(not free) and free video solutions
http://wiki.apache.org/struts/StrutsTutorials - videos are free. Tutorial builds from lab to lab and you build a full realistic DB master/detail CRUD, w navigation, and most commonly used features. Check out the video - 30 of them, one for each lab. ( ... as I move to new Sun Swing Extensions /JDNC ;-) ; some of you are still doing Java legacy html (vs LAMP) so above may help; I am not likely to want to support it, go to Infonoia.com for support maybe. I even got rid of baseBeans.com and basicPortal.com domains ) Also, from time to time I make an IDE that includes JRockit 1.5, Eclipse 3.1 (for 1.5) w/XML, Tomcat 5.5, Ant 1.62, PostgreSQL 8.msi, and a few samples and usefully docs and pdfs -all open source. Useful when I teach a class to set up all the students ... or if you show up on client site and do not want to spend 1/2 a day integrating. You just unzip and run: http://sourceforge.net/project/showfiles.php?group_id=126375package_id=138662 I will be updating this now and then but will only post notice to http://sandraSF.com/forums. So when I teach JDNC RiA-SoA, I use above to set up students so it's not a mess. hope somone has a use for it. I wonder if the IDE should be linked in Wiki, sometimes newbies are not shure how to set up the eviroment. .V -- RiA-SoA w/JDNC http://www.SandraSF.com forums blog http://www.sandrasf.com/adminBlog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tiles controller
I have problems compiling when I move code from an Action to a Tiles Controller The line that won't compile is, DataSource dataSource = getDataSource(request, userDB); ..and the error message is RetrieveFormController.java:110: cannot find symbol symbol : method getDataSource(javax.servlet.http.HttpRequest, java.lang.String) location: class app.model.RetrieveFormController DataSource datasource = getDataSource(request, userDB); This is the code from the Action, package app.web; import app.model.*; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; import java.io.IOException; import java.util.Hashtable; import java.util.Locale; import java.util.List; import java.util.ArrayList; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.Statement; import java.sql.ResultSet; import java.sql.SQLException; import javax.sql.DataSource; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionServlet; import org.apache.struts.util.MessageResources; public final class RetrieveFormAction extends Action { private final static Logger log = Logger.getLogger(RetrieveFormAction.class); String sTemp =; public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) //throws IOException, ServletException { throws Exception { log.info(RetrieveFormAction.CLASS - 1); List formList = new ArrayList(50); log.info(RetrieveFormAction.CLASS - 2); String userName = t; DataSource dataSource = getDataSource(request, userDB); ...and this is the codefrom the Tiles Controller, package app.model; import org.apache.struts.tiles.beans.MenuItem; import org.apache.struts.tiles.beans.SimpleMenuItem; import org.apache.struts.tiles.Controller; import org.apache.struts.tiles.ComponentContext; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; //import javax.naming.*; import java.io.IOException; import java.util.Hashtable; import java.util.Locale; import java.util.List; import java.util.ArrayList; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.Statement; import java.sql.ResultSet; import java.sql.SQLException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.sql.DataSource; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; //import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionServlet; import org.apache.struts.util.MessageResources; public class RetrieveFormController implements Controller { private final static Logger log = Logger.getLogger(RetrieveFormController.class); String sTemp =; public void execute( ComponentContext tileContext, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext) throws Exception { List formList = new ArrayList(50); String userName = t; DataSource dataSource = getDataSource(request, userDB); What is wrong with the datasource in the Tiles Controller? Thanks, Jim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re[2]: Displaying errors messages from validate in V1.2.4
Thanks for the tip. I did finally discover the message resource was missing and the cause of the the excption in the JSP tag. Thanks for the assistance. Your ActionMessage should contain the key to a message in some message resources, rather than the actual message itself. Something like... errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionMessage( user.required ) ); then define user.required=User name is null in your message resources. Niall - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, December 17, 2004 8:47 PM Subject: Displaying errors messages from validate in V1.2.4 Hi, I cannt find the correct setup for html:messages to display error messages from a form's validate method in Struts 1.2.4 For example, if I have something like this in the validate method: snip public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if (username == null) { errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionMessage( User name is null ) ); return errors; /snip What is the correct struts tag to use to display the error message ? Are the java docs accurate? Best regards, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tiles controller
Jim, I think I see your problem: The getDataSource() method is only available in an Action, not in a Controller. You could mix the two and make your action subclass a TilesAction. That would give you access to a merging of both worlds: Action and Controller. For more details, you could read Tiles Advanced Features by Cedric Dumoulin in PDF at: http://www.lifl.fr/~dumoulin/tiles/tilesAdvancedFeatures.pdf (from the resources section of the Tiles developer guide. Regards, David -Original Message- From: Jim Douglas [mailto:[EMAIL PROTECTED] Sent: Saturday, December 18, 2004 11:23 AM To: [EMAIL PROTECTED] Subject: Tiles controller I have problems compiling when I move code from an Action to a Tiles Controller The line that won't compile is, DataSource dataSource = getDataSource(request, userDB); ..and the error message is RetrieveFormController.java:110: cannot find symbol symbol : method getDataSource(javax.servlet.http.HttpRequest, java.lang.String) location: class app.model.RetrieveFormController DataSource datasource = getDataSource(request, userDB); This is the code from the Action, package app.web; import app.model.*; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; import java.io.IOException; import java.util.Hashtable; import java.util.Locale; import java.util.List; import java.util.ArrayList; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.Statement; import java.sql.ResultSet; import java.sql.SQLException; import javax.sql.DataSource; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionServlet; import org.apache.struts.util.MessageResources; public final class RetrieveFormAction extends Action { private final static Logger log = Logger.getLogger(RetrieveFormAction.class); String sTemp =; public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) //throws IOException, ServletException { throws Exception { log.info(RetrieveFormAction.CLASS - 1); List formList = new ArrayList(50); log.info(RetrieveFormAction.CLASS - 2); String userName = t; DataSource dataSource = getDataSource(request, userDB); ...and this is the codefrom the Tiles Controller, package app.model; import org.apache.struts.tiles.beans.MenuItem; import org.apache.struts.tiles.beans.SimpleMenuItem; import org.apache.struts.tiles.Controller; import org.apache.struts.tiles.ComponentContext; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; //import javax.naming.*; import java.io.IOException; import java.util.Hashtable; import java.util.Locale; import java.util.List; import java.util.ArrayList; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.Statement; import java.sql.ResultSet; import java.sql.SQLException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.sql.DataSource; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; //import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionServlet; import org.apache.struts.util.MessageResources; public class RetrieveFormController implements Controller { private final static Logger log = Logger.getLogger(RetrieveFormController.class); String sTemp =; public void execute( ComponentContext tileContext, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext) throws Exception { List formList = new ArrayList(50); String userName = t; DataSource dataSource = getDataSource(request, userDB); What is wrong with the datasource in the Tiles Controller? Thanks, Jim
bean:message and escaping
Hi is there any way to escape html with bean:message?. The only way I find to achieve this is: 1 - set a pageContext var with the bean:message value. 2 - use bean:write, wich escapes html. I'd like to do this with a single tag. Something like bean:message key=mykey filter=true / If it's not possible wich is the best practice? Thanks in advance. Edgar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tiles controller
Sorry guys, I'm not resending these messages, Netcom is (something wrong with their server resending the same exact messages - headers seem to indicate the very same message) doing it by themselves. Regards, David -Original Message- From: David G. Friedman [mailto:[EMAIL PROTECTED] Sent: Saturday, December 18, 2004 3:31 PM To: Struts Users Mailing List Subject: RE: Tiles controller Jim, I think I see your problem: The getDataSource() method is only available in an Action, not in a Controller. You could mix the two and make your action subclass a TilesAction. That would give you access to a merging of both worlds: Action and Controller. For more details, you could read Tiles Advanced Features by Cedric Dumoulin in PDF at: http://www.lifl.fr/~dumoulin/tiles/tilesAdvancedFeatures.pdf (from the resources section of the Tiles developer guide. Regards, David -Original Message- From: Jim Douglas [mailto:[EMAIL PROTECTED] Sent: Saturday, December 18, 2004 11:23 AM To: [EMAIL PROTECTED] Subject: Tiles controller I have problems compiling when I move code from an Action to a Tiles Controller The line that won't compile is, DataSource dataSource = getDataSource(request, userDB); ..and the error message is RetrieveFormController.java:110: cannot find symbol symbol : method getDataSource(javax.servlet.http.HttpRequest, java.lang.String) location: class app.model.RetrieveFormController DataSource datasource = getDataSource(request, userDB); This is the code from the Action, package app.web; import app.model.*; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; import java.io.IOException; import java.util.Hashtable; import java.util.Locale; import java.util.List; import java.util.ArrayList; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.Statement; import java.sql.ResultSet; import java.sql.SQLException; import javax.sql.DataSource; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionServlet; import org.apache.struts.util.MessageResources; public final class RetrieveFormAction extends Action { private final static Logger log = Logger.getLogger(RetrieveFormAction.class); String sTemp =; public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) //throws IOException, ServletException { throws Exception { log.info(RetrieveFormAction.CLASS - 1); List formList = new ArrayList(50); log.info(RetrieveFormAction.CLASS - 2); String userName = t; DataSource dataSource = getDataSource(request, userDB); ...and this is the codefrom the Tiles Controller, package app.model; import org.apache.struts.tiles.beans.MenuItem; import org.apache.struts.tiles.beans.SimpleMenuItem; import org.apache.struts.tiles.Controller; import org.apache.struts.tiles.ComponentContext; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; //import javax.naming.*; import java.io.IOException; import java.util.Hashtable; import java.util.Locale; import java.util.List; import java.util.ArrayList; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.Statement; import java.sql.ResultSet; import java.sql.SQLException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.sql.DataSource; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; //import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionServlet; import org.apache.struts.util.MessageResources; public class RetrieveFormController implements Controller { private final static Logger log = Logger.getLogger(RetrieveFormController.class); String sTemp =; public void execute( ComponentContext tileContext, HttpServletRequest request,
returning to correct form after validating a page in a wizard form
Here's hoping somebody's still answering questions this close to Christmas :) I have a form that takes place over 3 pages, with prev and next buttons for the user to navigate around with. The buttons call their own action in my dispatchaction, which increments the page # and sends to the appropriate page. Now that I'm at the end and have added in the validation for this form, I realize that I may have made a wrong turn... since I can only supply one input in my actionmapping and it really needs to be one of 3. So, while it does a lovely job of validating, its always returning me to the wrong form :( What I'd really like to do is just hard-code the input from the code in my action... Is that possible? Or do I need to go back to the drawing board? Thanks for the help! Janice Here's the relevant bits (hopefully): - start snip from struts-config- action path=/submission input=.submissionForm1 parameter=action type=web.actions.SubmissionActions name=submissionForm validate=false set-property property=secure value=false/ forward name=form1 path=.submissionForm1/ forward name=form2 path=.submissionForm2/ forward name=form3 path=.submissionForm3/ forward name=gotoconfirm path=/submissionConfirm.do / /action - end snip from struts-config- - start snip from SubmissionActions- // this is just a for example of what I'm doing in SubmissionActions to move prev and next public ActionForward nextForm(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { ActionErrors errors = form.validate(mapping, request); if (!errors.isEmpty()) { saveErrors(request, errors); return mapping.getInputForward(); } DynaValidatorForm dvf = (DynaValidatorForm)form; int pageNumber = ((Integer)dvf.get(page)).intValue(); pageNumber = pageNumber + 1; String target = form + String.valueOf(pageNumber); dvf.set(page, new Integer(pageNumber)); return (mapping.findForward(target)); } - end snip from SubmissionActions- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
test - my ISP is forcing me in order to track down the issue
Sorry again, but my ISP will not fix their mail server unless I follow every damn step such as emailing the list again AFTER I did detect and repair in MS Outlook. Freaking ISPs! (I know I used to work for two of them!) Regards, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: returning to correct form after validating a page in a wizard form
I may not be understanding this, because it seems somewhat obvious... I assume you can determine on which page of the wizard the validation failed... Assuming that's true, simply don't return the input forward, instead have three forwards in your /submission mapping, as it looks like you do already, and return the appropriate forward. I assume I'm missing something because that's too obvious... -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Janice wrote: Here's hoping somebody's still answering questions this close to Christmas :) I have a form that takes place over 3 pages, with prev and next buttons for the user to navigate around with. The buttons call their own action in my dispatchaction, which increments the page # and sends to the appropriate page. Now that I'm at the end and have added in the validation for this form, I realize that I may have made a wrong turn... since I can only supply one input in my actionmapping and it really needs to be one of 3. So, while it does a lovely job of validating, its always returning me to the wrong form :( What I'd really like to do is just hard-code the input from the code in my action... Is that possible? Or do I need to go back to the drawing board? Thanks for the help! Janice Here's the relevant bits (hopefully): - start snip from struts-config- action path=/submission input=.submissionForm1 parameter=action type=web.actions.SubmissionActions name=submissionForm validate=false set-property property=secure value=false/ forward name=form1 path=.submissionForm1/ forward name=form2 path=.submissionForm2/ forward name=form3 path=.submissionForm3/ forward name=gotoconfirm path=/submissionConfirm.do / /action - end snip from struts-config- - start snip from SubmissionActions- // this is just a for example of what I'm doing in SubmissionActions to move prev and next public ActionForward nextForm(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { ActionErrors errors = form.validate(mapping, request); if (!errors.isEmpty()) { saveErrors(request, errors); return mapping.getInputForward(); } DynaValidatorForm dvf = (DynaValidatorForm)form; int pageNumber = ((Integer)dvf.get(page)).intValue(); pageNumber = pageNumber + 1; String target = form + String.valueOf(pageNumber); dvf.set(page, new Integer(pageNumber)); return (mapping.findForward(target)); } - end snip from SubmissionActions- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
indexed property is not populated
Hi, I have a problem: Struts config file has: form-beans form-bean name=form type=org.apache.struts.action.DynaActionForm form-property name=model type=com.mycomp.SecurityAdminModel/ /form-bean /form-beans On JSP I have: logic:iterate id=email property=model.currentPerson.contactInfo.emails name=form html:text property=emailAddress name=email /logic:iterate It generates folowing HTML: input type=text name=email[0].emailAddress value=[EMAIL PROTECTED] input type=text name=email[1].emailAddress value=[EMAIL PROTECTED] But when I submit the form actual values in a bean are not updated. They are still the same. What do I do wrong? Thanks, Eugene __ Do you Yahoo!? Yahoo! Mail - Find what you need with new enhanced search. http://info.mail.yahoo.com/mail_250 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: AW: Preventing concurrent execution of an Action
Why don't you create the file with a temporary filename and return a link to the file you created. If you do this, you will not have to lock your action. -Richard -Original Message- From: Behrang Saeedzadeh [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 14, 2004 3:25 PM To: Struts Users Mailing List Subject: Re: AW: Preventing concurrent execution of an Action Hi Thanks for the responses. You don't need your locked flag, it's provided by java object monitors automatically. I actually used the lock so if the updateXML is being executed the next request won't even try and wait to aquire the lock for it and simply return. Last question: if two users click the link simultaneously, what should happen? In your code, the second user overwrites the changes of the first user (silently). I guess what I have done ignores the second click as the control returns from the doExecute method before reaching the updateXml method. Regards, Behrang S. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Validation using multiple resource bundles
Validation of data in form fields worked fine when I had only default resource bundle. But, when I started using multiple resource bundles, the validation failed. I tried to specify the value for bundle attribute for the 'arg' elements(s), and 'msg' elements but didn't work. Following is my environment: Struts 1.2.4 Tomcat 4.1.30 Commons Validator 1.1.3 Using http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; in validation.xml As per the above DTD, we can specify the value for bundle attribute. When searching on the internet for this problems, on some sites, I found that Validation package doesn't support multiple resource bundles, but only supports default resource bundles. Is that true? Or this was true only with old versions of struts/validators. Here is an example of my field element in validation.xml file: form name=createUserForm field property=userId depends=required,minlength,mask arg position=0 bundle=security key=label.userId/ arg position=1 name=minlength key=${var:minlength} resource=false / var var-nameminlength/var-name var-value5/var-value /var msg name=mask key=userId.maskmsg bundle=security / var var-namemask/var-name var-value^[0-9a-zA-Z]*$/var-value /var /field /form Any help is greatly appreciated. TIA Venkat If you have received this e-mail in error, please delete it and notify the sender as soon as possible. The contents of this e-mail may be confidential and the unauthorized use, copying, or dissemination of it and any attachments to it, is prohibited. Internet communications are not secure and Hyperion does not, therefore, accept legal responsibility for the contents of this message nor for any damage caused by viruses. The views expressed here do not necessarily represent those of Hyperion. For more information about Hyperion, please visit our Web site at www.hyperion.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Populating data using Mapped Back Action Forms
Hi! Is there any known issue related to populating a List in a Mapped Back Action Form? It works ok when validation is not active but when I set validate to true in the action mapping the list vanishes. This does not happen with the rest of the form parameters. Any clue? Thanks! -- Saludos, Martin I. Levi Centre Tecnològic de Transferenciència de Calor Universitat Politècnica de Catalunya www.cttc.upc.edu - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
checkbox array transfer problem
I have the following problem with checkbox arrays. I would really appreciate clues on what is the best workaround. The situation is this: - I have a data entry page flow with multiple pages entering data into a form bean stored on the session (all the actions share the same form bean). - Several pages contain checkboxes so I have to reset their corresponding form properties in an overridden ActionForm.reset() method. - Some of these checkboxes appear on the first page only and causes a problem as the form will reset their properties when navigating to the second page, but they will not be repopulated as they don't have a control on this page and therefore will remain cleared. For simple checkboxes I just put a corresponding html:hidden field on the pages that shouldn't render that particular checkbox. The hidden field makes sure the checkbox's value is posted through to the action and thus repopulated into the form. But, for array checkboxes created with html:multibox I don't succeed with this solution. The solution with the hidden field I used for simple checkboxes will only hold one value, and thus will only keep one of potentially many selections in the checkbox array. How should this best be solved? At the moment I have implemented a workaround that will only reset the checkbox array when populating from a page that actually contains the corresponding checkboxes. I do this by adding a hidden flag field that signals that the page contains the checkboxes and I can later use this as a conditional in the reset method: page1.jsp input type=hidden name=hasPersonCheckboxes c:forEach items=${personList} var=person html:multibox property=personIds c:out value=${person.id}/ /html:multibox c:out value=${person.name}/ /c:forEach MyActionForm.java: public void reset( ActionMapping mapping, HttpServletRequest request) { if ( request.getParameter(hasPersonCheckboxes) != null ) personIds = new Long[0]; } This way, if page2.jsp doesn't contain a hasPersonCheckboxes field, the personIds attribute will not be cleared when navigating to this page and will retain its value (given that the form bean scope remains on the session). But, there may be a better and cleaner solution? (Sometimes I wish that Struts would include support for handling all this checkbox reset stuff. F ex, each rendering of Struts' checkbox or multibox tags could make additions to some Struts managed hidden field that records what checkboxes are placed in the form, and could use this for automagically clearing the appropriate properties.) Mike - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Form data
Hi, Is there any restriction in the data struts populates from ActionForm classes when validate is turn on? I mean, I put a Map in the action form and it seems normal keys (String vs String) are populated but keys which point to lists (String vs List) are not there after the form.validate() method is called. -- Saludos, Martin I. Levi Centre Tecnològic de Transferenciència de Calor Universitat Politècnica de Catalunya www.cttc.upc.edu - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
exception thrown while trying to validate user input
java.lang.NoSuchMethodException: mypackage.myclass.validateTotalFunds(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, javax.servlet.http.HttpServletRequest) As you can see here it is looking for a method that accepts ActionMessages as one of parameters, but Struts In Action book and web examples show that ActionErrors should be passed instead and that is what I coded. Any help would be appreciated. Thanks in advance. Mariya. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts and JDK 1.4.2_06
Mike Darretta a écrit : I encountered a strange issue that may be relevant to others After upgrading our JDK from 1.4.2_05 to 1.4.2_06, many of our struts actions reported the following error: Got the same problem when update tomcat and jdk (don't know which causes troubles). No getter method for property currentView of bean pagingListForm I upgraded all our apache-related jars to the most recent releases, but to no help. Then, I had an epiphany and simply renamed the form bean property to currView vice currentView, along with its accessor. Suddenly, everything worked as before (hmm...). For my case, my propertie was a calculated one (read-only) with only a getter method. (and the error message was the same No getter method ...) I must have to add a setter (empty code) and a variable to fix the bug. Are there any thoughts on how a form bean property name could conflict with a JDK release? Mike sebastien - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Page navigation links
Is the Action path include the parameter I pass in the request ? For an example: Form A to B, I will pass code='Bcode' in Action B Form B to C, I will pass code='Ccode' in Action C If I back Form C to B, I need to pass code='Bcode' The Question is Is the Action path will include this 'Bcode' If not I need to think the other way to get it back. Thanks a lot Cliff --- In [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: Presumably you would want such a construct to work regardless of what path a user took to get to a specific page (assuming there ARE multiple paths in your app, maybe there aren't). So, if it was me, I'd be thinking a linked list stored in session. Each page that is presented would append itself to the list. Clicking a link would have to break the list at the point of the page that was clicked (i.e., if there are six pages in the nav trail and the user clicks the third, you basically want to discard the last three, which just means removing the link to the next element from the element of the page the user clicked). You would of course have to add enough information to each element in the list as to allow your app to go to that page when clicked. Might just be storing the Action path, might mean each element is really a HashMap with a bunch of information, you would have to decide. I'm not sure something like this exists yet, I'd certainly think it does though. If you have to roll your own, I suspect it wouldn't be too difficult using this approach (assuming I haven't glossed over something that makes it impossible or overly difficult of course!) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Donie Kelly wrote: Hi all Anybody got an example of how to implement a page navigation link for the top of a page like so... Home MainFgorm wizardpage1 wizard page 2 The last entry would be the name of the current page and would not be a link. I'm thinking of a session object where the page inserts it's name somehow so that if the page is re-used in different areas it puts it's link in the correct place. Just wondering how this can be achieved easily with struts and without hardcoding the paths on each page. Thanks Donie --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
validation issues when using multiple modules
I have configured two modules in my web application using Struts 1.2. Each has its own struts config as defined in the web application's web.xml. Each has its own validation XML and resource bundles as defined in their respective struts config files. The problem I'm seeing is that if I violate a validation rule for the root module (/), everything works as expected and I see the appropriate error message on the page. However, if I violate a validation rule in the sub module (/app2), the validation works fine except the error message prints out without the value that should be filled in by the arg0 element for that field. In other words, instead of 'List size is required' I see 'is required', where 'List size' is the value for key 'list.size' that is defined in the resource bundle for module /app2 and is referenced by the arg0 element for the list size field. I am referencing the resource bundle for /app2 in the html:errors tag. In addition, I have tried defining list.size in the root module's resource bundle just to verify that the problem isn't that struts is looking there for it, and that doesn't seem to be the problem because I still see the same behavior. Has anyone seen anything like this or can anyone give me some hints as to what might be going wrong here? Thanks, Leigh - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: exception thrown while trying to validate user input
What version of struts are you using! I think that the version you are using might be de reason for this problem. ActionErrors has been deprecated in favor of ActionMessages as far as I know in recent struts versions. On the other hand, struts in action covers afaik version 1.1. Hope this help. On Fri, 17 Dec 2004 10:22:49 -0500, Klimenko, Mariya [EMAIL PROTECTED] wrote: java.lang.NoSuchMethodException: mypackage.myclass.validateTotalFunds(java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, javax.servlet.http.HttpServletRequest) As you can see here it is looking for a method that accepts ActionMessages as one of parameters, but Struts In Action book and web examples show that ActionErrors should be passed instead and that is what I coded. Any help would be appreciated. Thanks in advance. Mariya. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: test - my ISP is forcing me in order to track down the issue
Dude ... don't sweat it. Do whatcha got to do. If it's their issue, and this is what you've got to do so they can find the problem ... then, so be it. Now, if you start sending 20 a day, that might aggravate me :-) Good Luck! Eddie On Sat, 18 Dec 2004 19:26:23 -0500, David G. Friedman [EMAIL PROTECTED] wrote: Sorry again, but my ISP will not fix their mail server unless I follow every damn step such as emailing the list again AFTER I did detect and repair in MS Outlook. Freaking ISPs! (I know I used to work for two of them!) Regards, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -- Eddie Bush - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamically adding an ActionMapping
On Thu, 16 Dec 2004 11:21:01 -0500, Chaikin, Yaakov Y. [EMAIL PROTECTED] wrote: Craig, What is the reason the configuration gets frozen? I don't mean to ask about the mechanics of how it's frozen. I am just curious as to why freeze it and not let it be dynamically updated during application lifetime? The primary reason for this approach is a performance-related optimization. Underlying most of the collections of configuration objects in Struts are uses of HashMap, which is explicitly declared to be non-thread-safe for methods that modify the structure, but thread-safe for read-only use. If one *knows* that the collection will never be modified during its lifetime, then one can also know that no locks are needed at read time -- and that happens a *lot* during the lifetime of a Struts-based application. On the other hand, if the configuration data structures were allowed to change dynamically during the lifetime of the application, we'd have to lock on read accesses as well. That doesn't matter in an app with, say, 10-20 users who play with it occasionally -- it is critically important in apps that are supposed to be Internet scale. A completely separate discussion could be had about the maintainability and testability of an application that allows dynamic updates to its configuration. I'm very much in the conservative camp on this issue -- if you haven't been able to thoroughly test the exact application environment of your updated code (and this is basically impossible when you allow dynamic updates to the runtime configuration), then you have *zero* guarantees about the quality of the implementation of your app at any given time. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OJB struts
More importantly (from the perspective of Struts) is that the webapp framework should not *dictate* a decision for how you factor your business logic and persistence logic. That is a decision that should be made on it's own merits (independently of how you choose your view tier framework) -- any solution that binds you to *one* particular view tier technology and *one* specific business logic technology and *one* specific persistence technology should be viewed with suspicion. Struts doesn't do that. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: file upload problem
Hi Jay, I tried this way too, but I am actually getting FileNotFoundException. This is the modified code String filePath = theForm.getFilePath(); System.out.println(filePath:+filePath); String fileName2 = filePath+fileName; System.out.println(fileName2:+fileName2); //byte[] fileContent =file.getFileData(); OutputStream bos = new FileOutputStream(new File(fileName2)); int bytesRead = 0; byte[] buffer = new byte[8192]; while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) { bos.write(buffer, 0, bytesRead); } bos.close(); In the catch block I made SOP to print the exception and this is the output in Tomcat console. filePath:/upload/images/ fileName2:/upload/images/test.jpg fnfejava.io.FileNotFoundException: \upload\images\test.jpg (The system cannot find the path specified) Why is the system not able to find out the path? Uma - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: file upload problem
how is ur file path given ??/ please try to give the full path ie like C:\Program Files\Tomcat 5.0\webapps\cevm\uploadedimages\ ie filePath value should be C:\Program Files\Tomcat 5.0\webapps\cevm\uploadedimages\ ie in your jsp page give something as below . INPUT TYPE =hidden NAME =filePath size=39 value=C:\Program Files\Tomcat 5.0\webapps\cevm\uploadedimages\/ - Original Message - From: uma.k [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED]; 'Jay Chandran' [EMAIL PROTECTED] Sent: Sunday, December 19, 2004 12:32 PM Subject: RE: file upload problem Hi Jay, I tried this way too, but I am actually getting FileNotFoundException. This is the modified code String filePath = theForm.getFilePath(); System.out.println(filePath:+filePath); String fileName2 = filePath+fileName; System.out.println(fileName2:+fileName2); //byte[] fileContent =file.getFileData(); OutputStream bos = new FileOutputStream(new File(fileName2)); int bytesRead = 0; byte[] buffer = new byte[8192]; while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) { bos.write(buffer, 0, bytesRead); } bos.close(); In the catch block I made SOP to print the exception and this is the output in Tomcat console. filePath:/upload/images/ fileName2:/upload/images/test.jpg fnfejava.io.FileNotFoundException: \upload\images\test.jpg (The system cannot find the path specified) Why is the system not able to find out the path? Uma - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: file upload problem
Hi Jay, It works if I give in this way but I wanted to upload by giving relative path. i.e. the context in which the application is working. Also if I print File fileTemp = new File(fileName2); System.out.println(fileTemp: +fileTemp.getAbsolutePath()); I get fileTemp: D:\upload\images\test.jpg which actually doesn't exist. Any ideas on how to over come this issue? Uma -Original Message- From: Jay Chandran [mailto:[EMAIL PROTECTED] Sent: Sunday, December 19, 2004 12:59 PM To: Struts Users Mailing List Subject: Re: file upload problem how is ur file path given ??/ please try to give the full path ie like C:\Program Files\Tomcat 5.0\webapps\cevm\uploadedimages\ ie filePath value should be C:\Program Files\Tomcat 5.0\webapps\cevm\uploadedimages\ ie in your jsp page give something as below . INPUT TYPE =hidden NAME =filePath size=39 value=C:\Program Files\Tomcat 5.0\webapps\cevm\uploadedimages\/ - Original Message - From: uma.k [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED]; 'Jay Chandran' [EMAIL PROTECTED] Sent: Sunday, December 19, 2004 12:32 PM Subject: RE: file upload problem Hi Jay, I tried this way too, but I am actually getting FileNotFoundException. This is the modified code String filePath = theForm.getFilePath(); System.out.println(filePath:+filePath); String fileName2 = filePath+fileName; System.out.println(fileName2:+fileName2); //byte[] fileContent =file.getFileData(); OutputStream bos = new FileOutputStream(new File(fileName2)); int bytesRead = 0; byte[] buffer = new byte[8192]; while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) { bos.write(buffer, 0, bytesRead); } bos.close(); In the catch block I made SOP to print the exception and this is the output in Tomcat console. filePath:/upload/images/ fileName2:/upload/images/test.jpg fnfejava.io.FileNotFoundException: \upload\images\test.jpg (The system cannot find the path specified) Why is the system not able to find out the path? Uma - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]