JSTL Map Accessors
Hello, I have a problem that I can't seem to get around. I have a number of maps in my request, all keyed by same sequence of String keys that are contained within an ArrayList in that same request. My question is how do I get to the values in those maps? I've tried variations on: but that obviously looks for entries keyed to "masterKey" and not the value contained in the masterKey variable. How would I evaluate masterKey before firstMap[] is evaluated? Is that even possible? What are my alternatives? Thanks a lot, Denis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
html:submit button
Hello, >From what I understand, the value attribute on html:submit button is both the value of the label and the value submitted to the property attribute when the button is pressed. Is there a way to separate those two? I need 10 buttons, all the same label, but with different values submitted, depending on which button is pressed. I am not sure how to achieve that with html:submit. Should I just throw in a regular tag instead? Thanks, Denis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: can someone help me?
What is your action mapping for majprospect action? Since your form is going to be submitted to majprospect.do (you need to add .do in there) your action mapping should basically have a name="prospectForm" in it. Also, to make sure your form is being named correctly: request.setAttribute("prospectForm", form); (if you are setting the form in request, make sure that the action mapping for majprospect also has scope="request" otherwise it will be looking for the form in the wrong scope) I assume that the form has values prepopulated already and that you have checked that before you exit that action all the values that need to be there are there. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Input with name different than bean name property
There is a value attribute in the tag >From what I understand you have a form bean that has id and parentId as properties. You have a child object with an id property, and you have a parent object with an id property. So you could have and That is, you can do this if you use JSTL. You can do the same without -el tags and with code snippets but I just don't even want to think about those. Denis On Fri, 09 Jul 2004 12:06:36 -0400, FlyingElvi <[EMAIL PROTECTED]> wrote: > Hi ! > > I wanted to know if there was any direct way to use a input field > getting the value from a request bean that has a different property name > than the form bean. > > for example : Form Bean has 2 property id and parentId > > in my JSP page request I have 2 objects of the same type and I want to > populate the input field with the Id of both objects. > > // this works because > my CHILD OBJECT has a method getId() > // this doesn't > work because I need to call getId() > // and not > getParentId(). > > So is there any way to get it directly without having to do something > like this ? > > " /> > > Thanks > > - > 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]
Servlet help for a Struts programmer
I have an strange request: While I am very familiar with Struts (I've worked almost exclusively in Struts for last 2 years, right after college), I have only basic knowledge of actual Servlet programming. Now I am faced with a task of updating and maintaining a pure Servlet application. Does anyone know of a resource (or resources) where I can compare servlet functionality to struts functionality. I know they are related, but (for example) I miss having a Struts config file, where I can glance at one file and see all my action mappings. Is there anyone there in a similar situation? How are you coping? Thanks, Denis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Servlet help for a Struts programmer
Jim is correct. :) On Tue, 10 Aug 2004 12:29:23 -0700, Jim Barrows <[EMAIL PROTECTED]> wrote: > > > > -Original Message- > > From: Michael McGrady [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, August 10, 2004 12:25 PM > > To: Struts Users Mailing List > > Subject: RE: Servlet help for a Struts programmer > > > > > > At 12:17 PM 8/10/2004, you wrote: > > >WEB-INF/web.xml > > > > > >You can take a glance there and see what servlets are mapped > > to where. > > > > > >Servlet programming is not that much different. You just end > > up doing a > > >lot of manual labor to get your parameters and such. Instead of doing > > >thing like, myForm.getPersonName(); > > > > I think that he must be considering replacing JSP with > > Servlet. No? What > > else could this be? Surely he is not going to replace > > ActionForm, etc. > > with servlets. That would make no sense. The question is > > probably not > > well formed. Struts is not an alternative to servlets. It is a web > > platform based on JSP and Servlet technology. > > Nope.. you misunderstood his question. First he started on struts. Every project > he's worked on. Now, PHB wants him to work on another project, which is just > servlets. He's never done any servlet programming, so he wants to know what > differences there are etc. etc. etc. > > > > > - > 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: Servlet help for a Struts programmer
I am sure that in a week or two that might be apparent to me. However right now I am exposed to everything that ActionServlet and MultipartRequestWrapper hid from view. Using Struts in my programming, the controller part of the MVC was hidden. For example, one of the first questions I had was: How in the world do I control where a successful action will forward to? Where do I set that? My questions are pretty much in that ballpark. :) On Tue, 10 Aug 2004 12:40:50 -0700, Michael McGrady <[EMAIL PROTECTED]> wrote: > At 12:29 PM 8/10/2004, you wrote: > >Nope.. you misunderstood his question. First he started on struts. Every > >project he's worked on. Now, PHB wants him to work on another project, > >which is just servlets. He's never done any servlet programming, so he > >wants to know what differences there are etc. etc. etc. > > > Hi, Jim. That is what I thought he said. That makes no sense. The > comparison is of apples and oranges. There is no project that is "just > servlets" unless it is nuts. Struts, again, is not an alternative to > Servlets. Struts is based on Servlet technology. Working on a project > involving Servlets but not using the Struts framework of course makes > sense. But comparing Struts to Servlets makes no sense. > > Michael > > > > > - > 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: Servlet help for a Struts programmer
Wow. I unleashed a beast. Next time I'll ask the question way before I have to leave work. I have to thank you all for your input. The discussion on Servlets and Struts and how they relate (or don't) was in itself very helpful to understanding how the things work. I will take your advice and tutorials and start from web.xml. One of the things I love about my job is that I always learn something on every project, be it Struts, or a taglib or (in this case a "missed step") Servlet. Thank you! Denis On Tue, 10 Aug 2004 18:04:04 -0500, joe a. <[EMAIL PROTECTED]> wrote: > np! what are cognizantorees? > > On Tue, 10 Aug 2004 14:54:11 -0700, Michael McGrady > > > <[EMAIL PROTECTED]> wrote: > > At 02:21 PM 8/10/2004, you wrote: > > >Have any of you guys read Jakarta Struts Live by Hightower? Its > > >available for free here in pdf form: > > >http://www.theserverside.com/books/sourcebeat/JakartaStrutsLive/index.tss > > > > Thanx! I also highly recommend as a beginning The Struts Framework by Sue > > Spielman. Ted Husted's Struts in Action and Programming Jakarta Struts by > > Chuck Cavaness are, of course, better for the "cognizantorees". > > > > > > > > > > - > > 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: Losing request attributes
In order to keep the actual entries that the user typed in (so they don't have to retype everything if they changed a bunch of things) I usually put the entire form and errors into request if there are errors. Then you need to make sure that your populate action checks for presence of the form in request and overrides the DB entries with the ones in the form. On Fri, 13 Aug 2004 15:23:47 -0300 (ART), Leandro Melo <[EMAIL PROTECTED]> wrote: > Hubert, > i think that's actually the only solution. > Thanks. > > > > > > You can point the "input" to an action which will > > populate the request with > > the attribute(s) you need, and then forwards to your > > form. > > > > --- Hubert Rabago <[EMAIL PROTECTED]> wrote: > > > > > This is because when the user submits the form, > > that already starts a > > > different request, so the request attributes are > > no longer there. > > > In your mapping for the action where the form gets > > submitted to, where does > > > the input attribute point to? > > > > > > Hubert > > > > > > --- Leandro Melo <[EMAIL PROTECTED]> > > wrote: > > > > > > > As i replied many times for this topic, i'd like > > to > > > > expose the situation again and in DETAILS. > > > > > > > > Suppose a user submits a request that is handled > > by > > > > MyActionDoSomething. Then this action sets a > > request > > > > attribute like this: > > > > > > > > request.setAttribute("MyObject", obj); > > > > > > > > and forwards the request to the page > > > > myPageDoSomeOtherThing.jsp, wich has some inputs > > for > > > > the user to fill in. > > > > This page (myPageDoSomeOtherThing.jsp) uses the > > bean > > > > "obj" that was set in MyActionDoSomething.java > > ok !? > > > > > > > > Now suppose the user submits wrong information > > in > > > > myPageDoSomeOtherThing.jsp, what will cause the > > > > validate method in the associated ActionForm to > > return > > > > some ActionErrors. BUT when the ActionForm send > > this > > > > page back for the user to re-input data, the > > bean > > > > "obj" that was set at the very beginning in > > > > MyActionDoSomething.java is NOT present anymore! > > > > > > > > I think now it's clear that i'm not talking > > about the > > > > formBean attributes, right !? > > > > > > > > > > __ > > Do You Yahoo!? > > Tired of spam? Yahoo! Mail has the best spam > > protection around > > http://mail.yahoo.com > > > > > - > > To unsubscribe, e-mail: > > [EMAIL PROTECTED] > > For additional commands, e-mail: > > [EMAIL PROTECTED] > > > > > > = > > > ___ > Yahoo! Acesso Grátis - navegue de graça com conexão de qualidade! Acesse: > http://br.acesso.yahoo.com/ > > > > - > 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]
[OT] Setting up a struts project in IDEA
Hello, I switched to IntelliJ IDEA 4.5 recently and I finally got an opportunity to set up a pure struts project for a demo. I unpacked struts-blank, and guessed at various settings IDEA asked me when I tried to set up a project. Now I can't get the IDE to recognize the tld's anywhere, I am not sure what path root it is using or how to set it. I've tried searching online for a tutorial on how to set up a struts project for development in IDEA, but I didn't have any luck. Is there anyone out there using IDEA 4.5 that has a list of settings, paths and other things that need to be set in order for all the bells and whistles to work? Thanks, Denis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] Good Java tech book?
I am looking for a book on Java, but one focusing on the underlying technologies rather than the programming aspect. I want to learn more about JVM and bytecode and stuff like that, and I am not sure where I should look to find information about that. I figured a book would be a good central repository. Thanks, Denis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Load-on-startup init servlet
I am trying to set up a start up sequence for my app but I have never set up something like that. Basically I want to initialize some classes with attributes found in my resources file. How would I go about doing this? I set up my web.xml file to load a servlet on startup, but I am not sure how I am supposed to get to the message resources that are loaded in the ActionServlet. I know I saw this done before but I can't remember how it was set up. Thanks. Denis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Load-on-startup init servlet
So I can call MessageResources.getMessageResources("blah") in the init() method? Is there an order I have to load the servlets in web.xml in order for that to work? (if I remember correctly, ActionServlet actually loads those resources, right?) On Tue, 5 Oct 2004 07:49:02 -0700 (PDT), Varun Garg <[EMAIL PROTECTED]> wrote: > MessageResources res = > MessageResources.getMessageResources("ApplicationResources"); > > If you are using the property file name > ApplicationResources in the root folder. > > In the init method of the servlet that you are loading > at startup, you can do whatever you want. > >public void init(ServletConfig config) throws > ServletException { > > > > > --- Denis Avdic <[EMAIL PROTECTED]> wrote: > > > I am trying to set up a start up sequence for my app > > but I have never > > set up something like that. > > > > Basically I want to initialize some classes with > > attributes found in > > my resources file. How would I go about doing this? > > I set up my > > web.xml file to load a servlet on startup, but I am > > not sure how I am > > supposed to get to the message resources that are > > loaded in the > > ActionServlet. > > > > I know I saw this done before but I can't remember > > how it was set up. > > > > Thanks. > > > > Denis > > > > > - > > 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]
Filters
Hello all, Although I've been using Struts for small projects for a while now, I haven't really used filters. Now I am incorporating some functionality from another project into mine, and the other project used plain old servlets and filters. My question is this: In filter's doFilter method, is there a way to forward to a Struts action somehow? I need to populate the session and I have all this stuff already written, I just need to do a forward to the action somehow. How could I do this without request.getRequestDispatcher() calls? Or can I do it at all? I haven't wrote pure servlet in a long long while and I forgot a lot of things so please excuse me if my question is dumb. Thanks, Denis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] Exporting data to Indesign
Hello all, Sorry for the off topic post. I need to get some data exported into Indesign format, and I am not sure how to do that. Is there anyone out there doing this already? I've seen some techniques that require number of conversions but I would like to keep this to a minimum and have the whole process automated if possible. Please point me in the right direction if you know. Thanks, Denis
Ancient (1.1) Struts Help - Map Backed Forms
Hello list, I've recently moved jobs and landed in a position where I have to develop with Struts 1.1 (don't ask me why they don't want to upgrade). In any case, I need to use map-backed ActionForm, first time we're doing this in the company looks like. I am running into problems that I've previously solved by using JSTL. However that is another no-no. Basically the problem is this. When trying to access the page I get this error: javax.servlet.jsp.JspException: No getter method for property value(officeCell_2001) of bean org.apache.struts.taglib.html.BEAN at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:517) JSP snip: <% String curPos = Integer.toString(position.getEmployeeId()); prop = "value(officePhone_"+curPos+")"; %> Form: public class MFEditForm extends ActionForm { public MFEditForm() { } private String officeId; private Map values = new HashMap(); public String getOfficeId() { return officeId; } public String getValue(String key) {return (String) values.get(key); } public void setOfficeId(String oid) {officeId = oid; } public void setValue(String key, Object value) {values.put(key, value); } } from struts-config.xml I prepopulate the formBean and set it in request. The formBean is getting associated correctly with the form on JSP (I checked by outputing the officeId without touching the map). Interesting thing is that if I don't use getter methods (IE, if I use ) there is no error. It seems to me that the getter method is somehow wrong, but I can't see it. I tried these getValue signature variations: public String getValue(String key) public Object getValue(Object key) public String getValue(Object key) public Object getValue(String key) It seems to me that this plain vanilla map backed ActionForm should work without a hitch. Am I missing something really obvious? I really can't use JSTL or EL tags so if there is a solution not involving those, please let me know. Thanks, Denis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Ancient (1.1) Struts Help - Map Backed Forms
Forget that. They're actually running 1.0.2. No map backed forms for me. Sorry for wasting your time. D On 11/2/05, Denis Avdic <[EMAIL PROTECTED]> wrote: > Hello list, > > I've recently moved jobs and landed in a position where I have to > develop with Struts 1.1 (don't ask me why they don't want to upgrade). > > In any case, I need to use map-backed ActionForm, first time we're > doing this in the company looks like. > > I am running into problems that I've previously solved by using JSTL. > However that is another no-no. > > Basically the problem is this. When trying to access the page I get > this error: > > javax.servlet.jsp.JspException: No getter method for property > value(officeCell_2001) of bean org.apache.struts.taglib.html.BEAN >at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:517) > > > JSP snip: > > type="com.foo.bar.bat.MFPositionContact"> > > <% String curPos = > Integer.toString(position.getEmployeeId()); > > prop = "value(officePhone_"+curPos+")"; %> > > > > > > > Form: > > public class MFEditForm extends ActionForm { > public MFEditForm() { > > } > > private String officeId; > private Map values = new HashMap(); > > public String getOfficeId() { return officeId; } > public String getValue(String key) {return (String) values.get(key); } > public void setOfficeId(String oid) {officeId = oid; } > public void setValue(String key, Object value) {values.put(key, value); } > > } > > from struts-config.xml > > > > type="com.foo.bar.bat.ReportAction" >name="mFForm" >scope="request" >validate="true"> > > > > > I prepopulate the formBean and set it in request. The formBean is > getting associated correctly with the form on JSP (I checked by > outputing the officeId without touching the map). Interesting thing > is that if I don't use getter methods (IE, if I use property="value(userId_<%=curPos%>)" value="foo"/>) > there is no error. It seems to me that the getter method is somehow > wrong, but I can't see it. > > I tried these getValue signature variations: > > public String getValue(String key) > public Object getValue(Object key) > public String getValue(Object key) > public Object getValue(String key) > > > It seems to me that this plain vanilla map backed ActionForm should > work without a hitch. Am I missing something really obvious? I > really can't use JSTL or EL tags so if there is a solution not > involving those, please let me know. > > Thanks, > > Denis > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Redirect after a file download
Hello, I have an application that enables a user to download a file and keeps stats on total downloads as well as last time anyone downloaded a file. My problem is that the client wants the download page refreshed after a file has been sent. Right now I have a forward that points back to the download page (which would reload the stats from the DB reflecting the new download), but since I have something in the response in the download action it doesn't seem to follow the forward after sending the file. I am not quite sure how I should handle this. Does anyone have an idea? Thanks, Denis - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Redirect after a file download
I was unclear I guess. No, the refresh happens after the action STARTS sending the file, at the beginning of the download. This solution works with a timeout on the second window.location. I was hoping I could do something else, perhaps forking control or something after the response has is sent, but I didn't think it possible. The file is constructed in the action so it's not really a direct path to the file, thus the need for the timeout (so the action has some time to construct the file and write to DB). Thank you for your response, Denis On 12/21/05, Frank W. Zammetti <[EMAIL PROTECTED]> wrote: > Does the refresh *have* to happen only *after* the download is complete? > If so, I suspect your SOL. > > However, what you can do if that isn't important is to start the download > via Javascript, and at the same time kick off the refresh. Do something > like this: > > Download > > function download() { > window.location = "path_to_file"; > window.location = "path_to_this_page"; > } > > > I haven't tried this, but I *believe* the browser WILL NOT overwrite the > current page when you point to a downloadable file. So, the second call > to window.location should still fire. Since these are both atomic > requests, you should get a download popup, and the page should refresh at > the same time. > > I assume your statistics are updated when the download begins because I > don't see how you could do otherwise. So, I would think this would be OK. > You may however have to have a delay between the two location set > calls... or, you could open the download in a new window, which should > immediately close anyway IIRC. Still, you may need a delay between the > two, so maybe set up a timeout that waits a second or two before > refreshing the page. > > -- > Frank W. Zammetti > Founder and Chief Software Architect > Omnytex Technologies > http://www.omnytex.com > AIM: fzammetti > Yahoo: fzammetti > MSN: [EMAIL PROTECTED] > > On Wed, December 21, 2005 10:51 am, Denis Avdic said: > > Hello, > > > > I have an application that enables a user to download a file and keeps > > stats on total downloads as well as last time anyone downloaded a > > file. My problem is that the client wants the download page refreshed > > after a file has been sent. > > > > Right now I have a forward that points back to the download page > > (which would reload the stats from the DB reflecting the new > > download), but since I have something in the response in the download > > action it doesn't seem to follow the forward after sending the file. > > > > I am not quite sure how I should handle this. Does anyone have an idea? > > > > Thanks, > > > > Denis > > > > - > > 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]