how to use ant tool to build my application?
Hi struts-user, I apologize in advance for this kind of problem ,but I think it is the best mailing-list I am aware of :) So when I use the ant to build my application, there are some error: Buildfile: build.xml BUILD FAILED javax.xml.parsers.FactoryConfigurationError: org.apache.crimson.jaxp.SAXParserFa ctoryImpl at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java: 95) at org.apache.tools.ant.ProjectHelper.getParserFactory(ProjectHelper.jav a:706) at org.apache.tools.ant.ProjectHelper.parse(ProjectHelper.java:105) at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.jav a:85) at org.apache.tools.ant.Main.runBuild(Main.java:403) at org.apache.tools.ant.Main.main(Main.java:149) Total time: 0 seconds org.apache.crimson.jaxp.SAXParserFactoryImpl And I have put ant.jar, jaxp.jar, servlet.jar, and parser.jar these archives under $TOMCAT_HOME/lib directory . please help me .thx :=) Best regards, JeanX pacificnet.com(GZ)
Digester : how to use nested tag as data ?
Hi, I would like to learn an easy solution to get a XML part as a parameter of a method a the current object of the stack. I explain with an example : Input XML (configuration file of my application) : 2 ... I would like that everything between and (nested tags, comment tags and simple data without tags..) may be regarded as a String, so that I can give it as a parameter to one method. Which Rule must I use for this ? I tried "digest.addCallMethod("cfg/header", "setHeaderPart", 0);", but I received only "2" and some carriage returns, where is the rest ? My goal is to put easily this portion in all other XML documents which my application sends without modifying this header at all (like a simple cut and paste) ! Thank you in advance, > - Sébastien Noel - > DEXIA - Banque Internationale à Luxembourg > Equipe Architecture > *(+352) 4590 2218 - Fax 2952/ * PLM +044A * [EMAIL PROTECTED] - Un courrier électronique n'engage pas son émetteur. Tout message susceptible de comporter un engagement doit être confirmé par un écrit dûment signé. An electronic message is not binding on its sender. Any message referring to a binding engagement must be confirmed in writing and duly signed. Ein elektronischer Brief bzw. eine elektronische Nachricht ist für den Absender nicht verbindlich. Jede Nachricht, welche eine Verpflichtung beinhaltet, muß schriftlich bestätigt und ordnungsgemäß unterzeichnet werden. -
Needs Help in Struts File Uploading
Hello, We are working on File Uploading in struts. The problem we are facing is the "name of the file" stored while uploading. When finished submitting, after the file is selected a Randomly Generated temp file ( strts13374.tmp ) is generated in _tmp_war_uptest directory. But instead of this Randomly Generated Name ( strts13374.tmp ) we here need to have user defined name . Can u tell us how to go about it. Thanks in advance, KirubaKaran K.S.
Parsing problem with Tomcat 3.2.1
Has anyone ever tried to use Struts-based applications on a Tomcat 3.2.1 server? I experience parsing errors porting an application from Tomcat 3.1 (where it works) to Tomcat 3.2.1 (where it crashes). The error looks like this: org.apache.jasper.compiler.ParseException: /usr/local/tomcat/webapps/night/content.jsp(43,0) Unterminated user-defined tag: ending tag not found or incorrectly nested at org.apache.jasper.compiler.Parser$Tag.accept(Parser.java:837) at org.apache.jasper.compiler.Parser.parse(Parser.java:1077) at org.apache.jasper.compiler.Parser.parse(Parser.java:1042) at org.apache.jasper.compiler.Parser.parse(Parser.java:1038) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:182) at org.apache.jasper.servlet.JspServlet.doLoadJSP(JspServlet.java:462) at org.apache.jasper.servlet.JasperLoader12.loadJSP(JasperLoader12.java:146) at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:433) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspSe rvlet.java:152) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja va:164) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404) at org.apache.tomcat.core.Handler.service(Handler.java:286) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79 7) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC onnectionHandler.java:210) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498) at java.lang.Thread.run(Thread.java:484) Fact is: There is no problem running this on Tomcat 3.1. Does anybody know why this happens? Thanx in advance, Michael
problem with redirecting url
Hi, I am using tomcat 3.2. I am calling servlet like this. http://localhost/employee/servlet/dispPage?p=sales from servlet I redirecting to jsp page. But jsp page URL coming like this http://localhost/employee/servlet/disp.jsp I want URL like this. http://localhost/employee/disp.jsp my servlet forward function like this. private void forward( String url, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { etServletConfig().getServletContext().getRequestDispatcher( url).forward(req uest, response); return; } can any one give me some idea for this. Thanks sundaram
how to cache lists?
Hi, Lets say you have a web app that runs over a number of web pages in a wizard fashion. On each one of these pages you need to present the user with a select box holding lists. e.g. locations, cities, etc. This data is read from a database and rarely changes. How would you cache these lists so that as each user access this site they do not need to have this info downloaded again? I was thinking in the init() of my ActionServlet to access the database and get these lists then place them in the session with Application scope. I think this would allow each user to access the data without reaccessing the database. Any comments or suggestions are appreciated. Regards Alex
Re: Needs Help in Struts File Uploading
look at the example struts-upload from one of the later nightly builds. There is a example included to write the file to disk with a specified name. Soeren Kirubakaran> Hello, Kirubakaran> We are working on File Uploading in struts. The problem we are facing is the "name of the file" stored while uploading. When finished submitting, after the file is selected a Kirubakaran> Randomly Generated temp file ( strts13374.tmp ) is generated in _tmp_war_uptest directory. But instead of this Randomly Generated Name ( strts13374.tmp ) we here need to have user Kirubakaran> defined name . Can u tell us how to go about it. Kirubakaran> Thanks in advance, Kirubakaran> KirubaKaran K.S.
RE: how to cache lists?
Alex, It is a good idea from a developers point of view. But when U say this to an IT manager and also tell him that U have to restart the webserver when ever new data is added, he/she will not allow U to do that. I faced the same situation but gave up on the idea of caching the data at application level. Thanks, Uday. -Original Message- From: Alex Colic [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 17, 2001 8:15 AM To: Struts Subject: how to cache lists? Hi, Lets say you have a web app that runs over a number of web pages in a wizard fashion. On each one of these pages you need to present the user with a select box holding lists. e.g. locations, cities, etc. This data is read from a database and rarely changes. How would you cache these lists so that as each user access this site they do not need to have this info downloaded again? I was thinking in the init() of my ActionServlet to access the database and get these lists then place them in the session with Application scope. I think this would allow each user to access the data without reaccessing the database. Any comments or suggestions are appreciated. Regards Alex
RE: how to cache lists?
You can set the combo box data retrieved from a database as a Servlet context attribute and retrieve this attribute in your web pages using the getAttribute method. Code as follows in your init() method. getServletConfig().getServletContext().setAttribute("cities", list of cities); And in your JSP page, do a application.getAttribute("cities") and display it. Note: Remember to do a load-on-startup of your servlet. The above approach is fine if you want to have cache within a single application. If you want to have the same cached data accessible to different web applications, you can use a Startup class like what Weblogic provides. You can have your cached data as instance variables of your startup class and every web application should be able to access that. Regards, Harish. -Original Message- From: Alex Colic [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 17, 2001 9:15 AM To: Struts Subject: how to cache lists? Hi, Lets say you have a web app that runs over a number of web pages in a wizard fashion. On each one of these pages you need to present the user with a select box holding lists. e.g. locations, cities, etc. This data is read from a database and rarely changes. How would you cache these lists so that as each user access this site they do not need to have this info downloaded again? I was thinking in the init() of my ActionServlet to access the database and get these lists then place them in the session with Application scope. I think this would allow each user to access the data without reaccessing the database. Any comments or suggestions are appreciated. Regards Alex
RE: how to cache lists?
Uday, why don´t you just implement a kind of "secret area" (similar to the password-protected /admin-zone in Tomcat), that allows you to reload this data manually (and therefore gently, for it rarely changes and you don´t have to restart the server). If you put the object bearing the same key into the session, the old instance should be deleted (hashtable), and the new values should be present. Regards, Michael -Ursprüngliche Nachricht- Von: Natra, Uday [mailto:[EMAIL PROTECTED]] Gesendet: Dienstag, 17. April 2001 15:35 An: '[EMAIL PROTECTED]' Betreff: RE: how to cache lists? Alex, It is a good idea from a developers point of view. But when U say this to an IT manager and also tell him that U have to restart the webserver when ever new data is added, he/she will not allow U to do that. I faced the same situation but gave up on the idea of caching the data at application level. Thanks, Uday. -Original Message- From: Alex Colic [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 17, 2001 8:15 AM To: Struts Subject: how to cache lists? Hi, Lets say you have a web app that runs over a number of web pages in a wizard fashion. On each one of these pages you need to present the user with a select box holding lists. e.g. locations, cities, etc. This data is read from a database and rarely changes. How would you cache these lists so that as each user access this site they do not need to have this info downloaded again? I was thinking in the init() of my ActionServlet to access the database and get these lists then place them in the session with Application scope. I think this would allow each user to access the data without reaccessing the database. Any comments or suggestions are appreciated. Regards Alex
Re: how to cache lists?
If you use a servlet to initialize your lists, you can simply do a post to this same servlet whenever you need to refresh... without bouncing the servers. This can be a cron'd process or done automatically whenever you edit the lists. - Original Message - From: "Natra, Uday" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, April 17, 2001 8:34 AM Subject: RE: how to cache lists? > Alex, It is a good idea from a developers point of view. But when U say this > to an IT manager and also tell him that U have to restart the webserver when > ever new data is added, he/she will not allow U to do that. I faced the same > situation but gave up on the idea of caching the data at application level. > > Thanks, > Uday. > > -Original Message- > From: Alex Colic [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 17, 2001 8:15 AM > To: Struts > Subject: how to cache lists? > > > Hi, > > Lets say you have a web app that runs over a number of web pages in a wizard > fashion. On each one of these pages you need to present the user with a > select box holding lists. e.g. locations, cities, etc. This data is read > from a database and rarely changes. > > How would you cache these lists so that as each user access this site they > do not need to have this info downloaded again? > > I was thinking in the init() of my ActionServlet to access the database and > get these lists then place them in the session with Application scope. I > think this would allow each user to access the data without reaccessing the > database. > > Any comments or suggestions are appreciated. > > Regards > > Alex >
Re: how to cache lists?
At 09:15 AM 4/17/2001 -0400, Alex Colic wrote: >Lets say you have a web app that runs over a number of web pages in a wizard >fashion. On each one of these pages you need to present the user with a >select box holding lists. e.g. locations, cities, etc. This data is read >from a database and rarely changes. > >How would you cache these lists so that as each user access this site they >do not need to have this info downloaded again? you could have a singleton data storage class that dumps the country list into a hashmap. if the country cache existed, the class would return the list from there - otherwise it would go to the database and populate the cache... (1x) the singleton class is only instantiated once for the app, or potentially once per cluster node. use getInstance() to return the sole instantiation of the class... ie. public class MyClass() { private static MyClass singleton = new MyClass(); private HashMap countries = null; //constructor private MyClass() { } public getInstance() { return singleton; } } along the lines of that - i think... caveat - may have some errors above, i'm writing it off the cuff. >I was thinking in the init() of my ActionServlet to access the database and >get these lists then place them in the session with Application scope. I >think this would allow each user to access the data without reaccessing the >database. i think there's some additional overhead in putting this in App scope. Also potentially costs in clustering depending on servlet runner. (weblogic?) i'm not super familiar with how App scope is managed, but the issue seems to be more of a db abstraction layer sort of issue rather than a presentation one. i'd deal with the data in the layer where it generally is handled, rather than pushing it all the way up the app to the presentation layer (Struts). just my $0.02 though, chris
RE: how to cache lists?
You could store the data in Application context as you've stated, but provide a mechanism for that data to be refreshed (either automatically or manually) without restarting the server. I haven't implemented this at all, but it seems possible. I've considered using some sort of date/time stamp, a boolean flag, or some other means to make the data automatically refresh. Otherwise you'd have to create some admin actions that would manually be invoked to refresh the data. -Original Message- From: [EMAIL PROTECTED] Sent: Tuesday, April 17, 2001 8:34 AM To: [EMAIL PROTECTED] Subject: RE: how to cache lists? Alex, It is a good idea from a developers point of view. But when U say this to an IT manager and also tell him that U have to restart the webserver when ever new data is added, he/she will not allow U to do that. I faced the same situation but gave up on the idea of caching the data at application level. Thanks, Uday. -Original Message- From: Alex Colic [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 17, 2001 8:15 AM To: Struts Subject: how to cache lists? Hi, Lets say you have a web app that runs over a number of web pages in a wizard fashion. On each one of these pages you need to present the user with a select box holding lists. e.g. locations, cities, etc. This data is read from a database and rarely changes. How would you cache these lists so that as each user access this site they do not need to have this info downloaded again? I was thinking in the init() of my ActionServlet to access the database and get these lists then place them in the session with Application scope. I think this would allow each user to access the data without reaccessing the database. Any comments or suggestions are appreciated. Regards Alex
Using , tags with strut template
When I use or tags with strut template, these tags do not get parsed. Has anyone experienced this? Any solution? Thanks. __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
RE: how to cache lists?
< The above approach is fine if you want to have cache within a single < application. If you want to have the same cached data accessible to < different web applications, you can use a Startup class like what Weblogic < provides. You can have your cached data as instance variables of your < startup class and every web application should be able to access that. Or you could keep them in an intermediate store like LDAP.
Re: Parsing problem with Tomcat 3.2.1
I run the struts applications on tomcat 3.2.1 all the time. [EMAIL PROTECTED] wrote: > > Has anyone ever tried to use Struts-based applications on a Tomcat 3.2.1 > server? > > org.apache.jasper.compiler.ParseException: > /usr/local/tomcat/webapps/night/content.jsp(43,0) Unterminated user-defined > tag: ending tag not found or incorrectly nested I run the struts applications on tomcat 3.2.1 all the time. Are you sure that there isn't a tag where a tag should be ? > Fact is: There is no problem running this on Tomcat 3.1. Does anybody know > why this happens? > > Thanx in advance, > > Michael
RE: how to cache lists?
I would say implement a pattern like the Observer which watches for any changes to the data list. If any changes occur it immediatly updates the internal list. So you will always have an updated list (no matter what) and it is done automatically behind the scenes... cheers, Amar.. -Original Message- From: Greg Reddin [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 17, 2001 9:46 AM To: [EMAIL PROTECTED] Subject: RE: how to cache lists? You could store the data in Application context as you've stated, but provide a mechanism for that data to be refreshed (either automatically or manually) without restarting the server. I haven't implemented this at all, but it seems possible. I've considered using some sort of date/time stamp, a boolean flag, or some other means to make the data automatically refresh. Otherwise you'd have to create some admin actions that would manually be invoked to refresh the data. -Original Message- From: [EMAIL PROTECTED] Sent: Tuesday, April 17, 2001 8:34 AM To: [EMAIL PROTECTED] Subject: RE: how to cache lists? Alex, It is a good idea from a developers point of view. But when U say this to an IT manager and also tell him that U have to restart the webserver when ever new data is added, he/she will not allow U to do that. I faced the same situation but gave up on the idea of caching the data at application level. Thanks, Uday. -Original Message- From: Alex Colic [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 17, 2001 8:15 AM To: Struts Subject: how to cache lists? Hi, Lets say you have a web app that runs over a number of web pages in a wizard fashion. On each one of these pages you need to present the user with a select box holding lists. e.g. locations, cities, etc. This data is read from a database and rarely changes. How would you cache these lists so that as each user access this site they do not need to have this info downloaded again? I was thinking in the init() of my ActionServlet to access the database and get these lists then place them in the session with Application scope. I think this would allow each user to access the data without reaccessing the database. Any comments or suggestions are appreciated. Regards Alex
AW: Parsing problem with Tomcat 3.2.1
Thanks, just as you said but why did it work with the former version then? Michael -Ursprungliche Nachricht- Von: Rob Leland [mailto:[EMAIL PROTECTED]] Gesendet: Dienstag, 17. April 2001 03:57 An: [EMAIL PROTECTED] Betreff: Re: Parsing problem with Tomcat 3.2.1 I run the struts applications on tomcat 3.2.1 all the time. [EMAIL PROTECTED] wrote: > > Has anyone ever tried to use Struts-based applications on a Tomcat 3.2.1 > server? > > org.apache.jasper.compiler.ParseException: > /usr/local/tomcat/webapps/night/content.jsp(43,0) Unterminated user-defined > tag: ending tag not found or incorrectly nested I run the struts applications on tomcat 3.2.1 all the time. Are you sure that there isn't a tag where a tag should be ? > Fact is: There is no problem running this on Tomcat 3.1. Does anybody know > why this happens? > > Thanx in advance, > > Michael
RE: Using , tags with strut template
Hi "Web Programmer" :) > When I use or tags with strut > template, these tags do not get parsed. Has anyone > experienced this? Any solution? Thanks. Don't forget to define your taglib before you use custom tags. e.g. <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> Hope that helps, regards Tobias Meyer
RE: Using , tags with strut template
Thanks Tobias, it worked. I had the taglib only in the template. Need to put in every file. --- Tobias Meyer <[EMAIL PROTECTED]> wrote: > Hi "Web Programmer" :) > > > When I use or tags with > strut > > template, these tags do not get parsed. Has anyone > > experienced this? Any solution? Thanks. > > Don't forget to define your taglib before you use > custom tags. > > e.g. > <%@ taglib uri="/WEB-INF/struts-html.tld" > prefix="html" %> > > Hope that helps, > regards > > Tobias Meyer __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
Re: AW: Parsing problem with Tomcat 3.2.1
Sorry, I hit the send button before typing. Maybe there is a tag at the bottom of the page instead of a . Another possability is that either the is either commented out or there is an unmatched " or ' that is hiding the tag. [EMAIL PROTECTED] wrote: > > Thanks, just as you said but why did it work with the former version > then? > > Michael > > -Ursprungliche Nachricht- > Von: Rob Leland [mailto:[EMAIL PROTECTED]] > Gesendet: Dienstag, 17. April 2001 03:57 > An: [EMAIL PROTECTED] > Betreff: Re: Parsing problem with Tomcat 3.2.1 > > I run the struts applications on tomcat 3.2.1 all the time. > > [EMAIL PROTECTED] wrote: > > > > Has anyone ever tried to use Struts-based applications on a Tomcat 3.2.1 > > server? > > > > org.apache.jasper.compiler.ParseException: > > /usr/local/tomcat/webapps/night/content.jsp(43,0) Unterminated > user-defined > > tag: ending tag not found or incorrectly nested > > I run the struts applications on tomcat 3.2.1 all the time. > Are you sure that there isn't a tag where a tag > should be ? > > > Fact is: There is no problem running this on Tomcat 3.1. Does anybody know > > why this happens? > > > > Thanx in advance, > > > > Michael
Need help with Bean:define.
Hi, I have a bean StoreRoomForm which I have saved in the session in application scope via: StoreRoomForm storerooms=new StoreRoomForm(); ServletContext context=this.getServlet().getServletContext(); context.setAttribute("storeroom",storerooms ); StoreRoomForm has the following two methods: Vector storerooms=new Vector() public void setStoreroom(pwStoreroom newStoreroom) { storerooms.add(newStoreroom); } public Vector getStoreroom() { return storerooms; } pwStoreroom has the following method: public String getName() { return name; } public void setName(String newName) { name = newName; } Now I want to populate a select box with the names of the storerooms kept in my list of storerooms kept in the session. I have tried the following: First Line: check to make sure that their is an object of type 'StoreRoomForm' in the session under the key "storeroom". This works. Second line: place any user selection into another bean. This works Third line: create a bean using the pwStorerooms held in the vector. This does not work. I keep getting a "No getter method for property storeroom of bean storeroom." I think the way I have structured this line is correct. Name=the key of the bean to search for; scope=the session scope to search upon and property=the name of the vector property in the bean. Any help in unravelling this is appreciated. Regards Alex
Can I internationalize all parameters of ActionError?
Hi there, In the ActionError, we can internationalize the first parameter: key. But I am wondering if we can also internationlize the other parameters, which are replacement values. For example, I have some replacement values which are Strings. If these Strings can be in different languages, my resources file can be much simplier. I have checked the struts source code. It doesn't seem to support this requirement. While if the pageContext object can be passed into form bean's validate method, or it can be got from request object, then this problem can be solved. Can anyone give me some idea? Thanks, John __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
RE: how to cache lists?
This is ok, but doesnt work if you have no control over the data changes. Some of our data in the database gets changed by other legacy apps, so we've implemented a CacheManager through which we obtain cached data. If the data item is not currently cached we retrieve it from the EJB tier, store it in the session or servlet context depending on the data, and if required use a Timer to schedule for the data attribute to be cleared from the session/context. Regards, Menno 17/04/2001 06:58:50, "Nanduri, Amarnath" <[EMAIL PROTECTED]> wrote: >I would say implement a pattern like the Observer which watches for any >changes to the data list. If any changes occur it immediatly updates the >internal list. So you will always have an updated list (no matter what) and >it is done automatically behind the scenes... > >cheers, >Amar.. > >-Original Message- >From: Greg Reddin [mailto:[EMAIL PROTECTED]] >Sent: Tuesday, April 17, 2001 9:46 AM >To: [EMAIL PROTECTED] >Subject: RE: how to cache lists? > > >You could store the data in Application context as you've stated, but >provide a >mechanism for that data to be refreshed (either automatically or manually) >without restarting the server. I haven't implemented this at all, but it >seems >possible. I've considered using some sort of date/time stamp, a boolean >flag, >or some other means to make the data automatically refresh. Otherwise you'd >have to create some admin actions that would manually be invoked to refresh >the >data. > >-Original Message- >From: [EMAIL PROTECTED] >Sent: Tuesday, April 17, 2001 8:34 AM >To: [EMAIL PROTECTED] >Subject: RE: how to cache lists? > > >Alex, It is a good idea from a developers point of view. But when U say this >to an IT manager and also tell him that U have to restart the webserver when >ever new data is added, he/she will not allow U to do that. I faced the same >situation but gave up on the idea of caching the data at application level. > >Thanks, >Uday. > >-Original Message- >From: Alex Colic [mailto:[EMAIL PROTECTED]] >Sent: Tuesday, April 17, 2001 8:15 AM >To: Struts >Subject: how to cache lists? > > >Hi, > >Lets say you have a web app that runs over a number of web pages in a wizard >fashion. On each one of these pages you need to present the user with a >select box holding lists. e.g. locations, cities, etc. This data is read >from a database and rarely changes. > >How would you cache these lists so that as each user access this site they >do not need to have this info downloaded again? > >I was thinking in the init() of my ActionServlet to access the database and >get these lists then place them in the session with Application scope. I >think this would allow each user to access the data without reaccessing the >database. > >Any comments or suggestions are appreciated. > >Regards > >Alex >
FW: Session scope
Obviously, design decisions have been made on the session context. Is anyone running (or considering running) Struts in a truly distributed server infrastructure? Does Craig's suggestion of Serializable session beans stand up under volume? Just looking for some pointers. Jim -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Friday, April 13, 2001 11:03 PM To: Struts-User@Jakarta. Apache. Org (E-mail) Subject: Re: Session scope On Tue, 10 Apr 2001, Girish Baxi wrote: > I am a new strut user as far as i know , isnt it a bad idea to store > data in the session scope simply becoz its not scalable for a multiple web > server scenario ... > is there any work around to using session scope in case of form beans that > span more than one html page ??? > > any guidance is appreciated, > thanx > > > Let's understand what is really happening in order to understand what the potential impacts are: * An HttpSession, as implemented by your servlet container, typically uses something like a Hashtable or a HashMap to store session attributes. * When you create a bean instance, the bytecodes that make up the executable methods of your bean are shared across all instances -- the only thing that takes memory is the bean properties themselves. * Let's assume that your bean uses about 1000 bytes for the properties that are unique to that bean, and you want to save a bean in each user's session because it represents information you need over more than one request. * If you have 10,000 simultaneous users, that means you need roughly ten megabytes (10,000 * 1000) of memory to store these objects. Whether that is a problem or not depends on how much free memory you have. * Some application servers support load balancing and distribution facilities, so that they can handle more users than can be supported by a single server. Essentially, they are running a copy of your web application on each server. In order to facilitate migrating your session from one server to another, they may require you to make all of your session beans Serializable. The bottom line is that, like everything else, use of session beans involves tradeoffs. If you are running amazon.com or Yahoo, you care a lot about memory occupancy. If you're writing an Intranet app for 50 users in your department, it's probably not a big deal unless you have very large data objects to be stored. You should analyze your expected simultaneous user counts, and the typical amount of memory that their session attributes require. Compare that to the amount of available memory on your server. The results of this comparison will tell you how much (or little) you need to worry about the amount of space session variables require. Craig McClanahan
Confusing error and other questions
Hello Everyone, I am working on an application that interacts with a database. When I try to run the app, I get an error (500) that tells me: javax.servlet.ServletException: Cannot find ActionMappings or ActionFormBeans collection. Can someone offer some insight? Also, I have added a datasource mapping in my struts-config.xml file for my database access. When I reference this in my bean, do I have to reference one of the attributes of the datasource tag(ex:driverclass), or do I simply do a call to javax.sql.DataSource dataSource = (javax.sql.DataSource) getServletContext().getAttribute(Action.DATA_SOURCE_KEY); Thanks in advance, Scott Fitzgerald
Re: Need help with Bean:define.
setStoreroom and getStoreroom are not using the same class type. If you change them to match, this will work. -- Dan Miser http://www.distribucon.com >From: "Alex Colic" <[EMAIL PROTECTED]> >Reply-To: [EMAIL PROTECTED] >To: "Struts" <[EMAIL PROTECTED]> >Subject: Need help with Bean:define. >Date: Tue, 17 Apr 2001 10:59:58 -0400 > >StoreRoomForm has the following two methods: > > Vector storerooms=new Vector() > public void setStoreroom(pwStoreroom newStoreroom) > { > storerooms.add(newStoreroom); > } > > public Vector getStoreroom() > { > return storerooms; > } >Now I want to populate a select box with the names of the storerooms kept >in >my list of storerooms kept in the session. > >I have tried the following: > >First Line: check to make sure that their is an object of type >'StoreRoomForm' in the session under the key "storeroom". This works. > >Second line: place any user selection into another bean. This works > >Third line: create a bean using the pwStorerooms held in the vector. This >does not work. I keep getting a "No getter method for property storeroom of >bean storeroom." I think the way I have structured this line is correct. >Name=the key of the bean to search for; scope=the session scope to search >upon and property=the name of the vector property in the bean. > _ Get your FREE download of MSN Explorer at http://explorer.msn.com
Caching going well.
Hi, caching my lists is going pretty well. In the init of my ActionServlet I compile all my lists and place them into the ServletContext. Then throughout my web pages I pull the lists out and populate select boxes. I have noticed a large speed improvement. My next challenge is going to be to set up a listener to update the lists as they change in the underlying database. All my database access goes through a VB server we have created. In response to my requests it passes me data via a socket. In response to a change in the database this server is going to send me a String "refreshList" on a port. I intend to listen on this port for this MSG and then update my cached list. I am still figuring out how to do this update. I could have another servlet listening on this port and when the cmd comes in, recompile the lists and then place them back into the session. This should replace the present lists. Any comments on my ideas is appreciated. Regards Alex
Re: Caching going well.
I'm currently evaluating Poolman (www.codestudio.com) which has database connection pooling and query caching. According to the docs, the cached queries will be periodically updated against a database, at an interval set in a config file. I haven't tested this package out yet, and I have no idea if it will work on your deployment system, but it sounds like something that may save you some time.. Zach Alex Colic wrote: > Hi, > > caching my lists is going pretty well. > > In the init of my ActionServlet I compile all my lists and place them into > the ServletContext. Then throughout my web pages I pull the lists out and > populate select boxes. I have noticed a large speed improvement. > > My next challenge is going to be to set up a listener to update the lists as > they change in the underlying database. All my database access goes through > a VB server we have created. In response to my requests it passes me data > via a socket. In response to a change in the database this server is going > to send me a String "refreshList" on a port. > > I intend to listen on this port for this MSG and then update my cached list. > I am still figuring out how to do this update. I could have another servlet > listening on this port and when the cmd comes in, recompile the lists and > then place them back into the session. This should replace the present > lists. > > Any comments on my ideas is appreciated. > > Regards > > Alex >
Last little bit of help will get me over the hump!
Hi, I have almost moved my app over to struts. Fantastic framework. I am being held up at that dual select control where the user selects a storeroom in the first box and the second box is populated with locations using criteria from the first. I have a class pwStoreroomList in the session under the key 'storeroomList'. Its class layout is as follows: public Vector getStoreroomList() { return storeroomList; } public void setStoreroomList(pwStoreroom newStoreroom) { storeroomList.add(newStoreroom); } the pwStoreroom class layout is as follows: public String getName() { return name; } public void setName(String newName) { name = newName; } public java.util.Vector getLocation() { return location; } public void setLocation(pwLocation newLocation) { location.add(newLocation); } pwLocation is set up as follows: public String getName() { return name; } public void setName(String newName) { name = newName; } Ok why am I telling you all this? Well, when my app starts I populate pwStoreroomList with all the Storerooms in the database and each one of these storerooms I populate with all the locations. Now when I want to populate my first select box I do the following: This works well, the first select box is composed of all the storeroom names. When the user selects a storeroom it is saved in another bean under 'requisitionLines.storeroom.name.' What I need to do is figure out how to take the storeroom picked in the first select box, iterate through the collection of storerooms, choose the correct one, then populate the second combo with all its locations. I have been working on this for a couple of days and through I have made progress populating the first select box, I can't figure out how to populate the second. Any Struts experts out there? Any help is appreciated. Thanks Alex
link tag not getting transalated
Hi, I have following in my jsp file My html:link is not getting transalated correctly. I have specified the correct tld etc. Vimal __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great prices http://auctions.yahoo.com/
i want the jsp pages to be updateable (from internet,browser)
Hi, When i include my jsp inside a war file i really don't know where those files are unpacked (if they are unpacked) But if i want my jsp's to be updateable from the internet (uploading) where must i put my jsp's? Can i for example put my jsp's inside a DB and then have some common class that will supply a jsp pages for a Container (like tomcat but others must also be possible) I don't think this is caputered in an interface of jsp/servlet isn't it? This is left to the container builder? How do you guy's do it? Don't use a war file? But a normal directory so that i know where everything is and i know where to save the uploaded jsp's? any idee's? johan
RE: Confusing error and other questions
Hi Scott, this may or may not end up answering your question: I remember seeing something similar when I was first trying to create my own Struts app. What happened was that, for some mysterious reason, the struts-config.xml file was not getting read properly - although I never got a parse error or anything of that sort. I couldn't figure it out for my life, so I started off with the struts-config.xml from the struts-example app, and slowly added my modifications. If you change the logging level in web.xml to show you all the messages that get shown when struts-config.xml gets read (I believe it's a parameter to the 'action' servlet that looks like this: detail 2) then you MIGHT notice that the messages that you normally see in the struts-example app do not appear when your app gets initialized (I'm talking of the messages of the sort: Call org.apache.struts.action.ActionMapping.addForward(ActionForward[failure])Pop org.apache.struts.action.ActionForwardCall org.apache.struts.action.ActionServlet.addMapping(ActionMapping[path=/prepareNewFolderCreation) So basically what I'm saying is that there's a possibility that struts-config.xml does not get read correctly, and you only find out about it later. I hope that makes sense (and that it solves your problem.) Iraklis -Original Message-From: Scott Fitzgerald [mailto:[EMAIL PROTECTED]]Sent: Tuesday, April 17, 2001 1:00 PMTo: Struts-UserSubject: Confusing error and other questions Hello Everyone, I am working on an application that interacts with a database. When I try to run the app, I get an error (500) that tells me: javax.servlet.ServletException: Cannot find ActionMappings or ActionFormBeans collection. Can someone offer some insight? Also, I have added a datasource mapping in my struts-config.xml file for my database access. When I reference this in my bean, do I have to reference one of the attributes of the datasource tag(ex:driverclass), or do I simply do a call to javax.sql.DataSource dataSource = (javax.sql.DataSource) getServletContext().getAttribute(Action.DATA_SOURCE_KEY); Thanks in advance, Scott Fitzgerald
in which scope to find a formBean request/session ?
Hi, I am using struts 1.0b with Orion 1.4.5 (? one of the latest anyway). In my JSP I have: in my struts-config.xml I have: name="registrationForm" scope="request" input="/registration.jsp"> When trying to display the content of scope in the Action:Actionforward() method, I have: mapping.getScope() => session When loading the jsp, I have the following error: javax.servlet.jsp.JspException: No bean found under attribute key registrationForm I don't understand exactly how it works. Looks like the jsp is expecting the bean to be inside request, while it is in session. I would like to put it in request...I should I do this ? Any clue? Thanks, Olivier
how to restrict direct access to jsps(and have struts work)
Hello, I'm using Struts and Tomcat 3.2.1. Is it possible to set things up so that jsps cannot be directly accessed at all, but must always be referenced through an action? I had writen a tag for inclusion in each jsp when the above question occured to me. I've looked at web.xml descriptions etc., but I don't really want to setup role based security, I just want any URL of the type http://localhost:8080/CompEnterprise/jsp/ to get a 404, yet still allow Struts to forward to them and work...this would allow me to do logon validation within the actions and not the jsps. This would also solve the problem of someone going to a jsp that depends on request data that is set by the action. thanks, dan
Request..
Hi, Please add my mail id into struts-user mailing list. Thanks, Tangeti.
Re: how to restrict direct access to jsps(and have struts work)
You can place the JSPs inside your WEB-INF directory. -- Dan Miser http://www.distribucon.com >From: "Daniel Toms" <[EMAIL PROTECTED]> >Reply-To: [EMAIL PROTECTED] >To: "Struts-User" <[EMAIL PROTECTED]> >Subject: how to restrict direct access to jsps(and have struts work) >Date: Tue, 17 Apr 2001 14:28:52 -0700 > >I'm using Struts and Tomcat 3.2.1. Is it possible to set >things up so that jsps cannot be directly accessed at all, >but must always be referenced through an action? _ Get your FREE download of MSN Explorer at http://explorer.msn.com
Re: Data Connection Pool, solution?
there should be another attribute in the datasource like this: testSql="select * from test" and GenericConnection has a setTestSql(String) method and that test method is executed right before the connections is given to the request in getConnection() When it fails it closed and tries another one (or opens another one) So anyone can decide there own test method/sql statement, because i don't think there is a common one. Only some rules must be set: Must the testSQL string return a result set and must it have one result if not it is the same as failing? This would be a nice addition to struts 1.0! Johan Compagner > > autoCommit="false" >description="Interbase Data Source" >driverClass="interbase.interclient.Driver" >maxCount="4" >minCount="0" >url="jdbc:interbase://path/to/database" >user="username" >password="password" > /> > > > Anthony > > It is by caffeine alone I set my mind in motion. > It is by the Beans of Java that thoughts acquire speed, > the hands acquire shaking, the shaking becomes a warning. > It is by caffeine alone I set my mind in motion. >
a form within iterate
Does anyone know if the
RE: a form within iterate
Better idea: -Original Message- From: Christine Robb [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 17, 2001 4:38 PM To: '[EMAIL PROTECTED]' Subject: a form within iterate Does anyone know if the
Handling File Upload Failures
Is there an elegant way of handling file upload errors when the file size is too large? I want to display an error page that indicates that the file is too large to upload. Currently I can only get a second exception to display. For example if I restrict the file size to be 500K and someone attempts to send a 1Mb file a ServletException with the message "Multipart data size exceeds the maximum allowed post size" is thrown but execution continues until another ServletException is thrown. This second exception wraps an IOException with the message " IOException while reading file element: ioe.getMessage()" (Note the small bug with the message generated!) . It is the second error message that comes through in the implicit exception object to my jsp error page. It seems that the real error is masked by the second exception. Why does execution continue after the first ServletException is thrown? - mike Full Stack Trace: 2001-04-17 06:02:36 - Ctx( ): Exception in: R( + /upload.do + null) - javax.servlet.ServletException: Multipart data size exceeds the maximum allowed post size at org.apache.struts.upload.MultipartIterator.createLocalFile(MultipartIterator .java:484) at org.apache.struts.upload.MultipartIterator.getNextElement(MultipartIterator. java:201) at org.apache.struts.upload.DiskMultipartRequestHandler.handleRequest(DiskMulti partRequestHandler.java:70) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:447) at org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:19 10) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1521) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:387) at org.apache.tomcat.core.Handler.service(Handler.java:263) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:371) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:74 9) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:695) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC onnectionHandler.java:207) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:403) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498) at java.lang.Thread.run(Thread.java:484) 2001-04-17 06:02:37 - Ctx( ): Exception in: R( + /upload.do + null) - javax.servlet.ServletException: IOException while reading file element: ioe.getMessage() at org.apache.struts.upload.MultipartIterator.getNextElement(MultipartIterator. java:205) at org.apache.struts.upload.DiskMultipartRequestHandler.handleRequest(DiskMulti partRequestHandler.java:70) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:447) at org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:19 10) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1521) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:387) at org.apache.tomcat.core.Handler.service(Handler.java:263) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:371) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:74 9) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:695) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC onnectionHandler.java:207) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:403) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498) at java.lang.Thread.run(Thread.java:484) Root cause: java.io.IOException: end of stream before boundary found! at org.apache.struts.upload.MultipartValueStream.(MultipartValueStream.ja va:65) at org.apache.struts.upload.MultipartIterator.createLocalFile(MultipartIterator .java:469) at org.apache.struts.upload.MultipartIterator.getNextElement(MultipartIterator. java:201) at org.apache.struts.upload.DiskMultipartRequestHandler.handleRequest(DiskMulti partRequestHandler.java:70) at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:447) at org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:19 10) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1521) at org.apache.struts.action.A
RE: a form within iterate
Thanks for the suggestion, but that won't work for what I'm doing. All the submit buttons will have the same label, and same action associated with them. Here's more information: SubmitRollo is a custom tag I wrote to handle the placement of buttons on all the screens. What I would like to capture when posting the form is the hidden 'id' item. It will be unique for each record. Right now, since all records are in the same form, I can only capture the first id. I need to capture the unique id for each record depending on which submit button clicked. Programmer/Analyst Pangaea Systems PH: (250) 360-0111 FX: (250) 381-4306 www.pangaeainc.com [EMAIL PROTECTED] -Original Message- From: Anthony Martin [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 17, 2001 4:30 PM To: '[EMAIL PROTECTED]' Subject: RE: a form within iterate Better idea: -Original Message- From: Christine Robb [mailto:[EMAIL PROTECTED]] Sent: Tuesday, April 17, 2001 4:38 PM To: '[EMAIL PROTECTED]' Subject: a form within iterate Does anyone know if the
Confirmation page
Hello, I am new to Struts and I am struggling on what would be the best way to do the following: on several pages, the user can perform actions which need to be confirmed before being actually performed (e.g., exiting the application or logging off). The confirmation page is the same regardless of the calling point, but if the user cancels, I need to go back to the previous page. I am not sure how to pass the return url to the confirmation page, and how to make this page generic (template tag, read value from session)... would anyone have an idea? Thanks for your help, -Fabien
Any way to customize button image?
Is there a way to specify a custom image for a button when using the tag? -- Thanks Jacob
How to avoid hardcoding image path in table
When creating a table row, is there a way to avoid having to specify the context name in the path for images as shown below: does not seem to be sufficient for this purpose. Also, using relative path is not preferred for the application since the pages can move around. -- Thanks Jacob
struts not reading properties file
I've posted this once, but nothing led me to any ideas. I was using Orion 1.4.5 and now I've upgraded to 1.4.7 in hopes of seeing something different to no avail. Here's the error and below that is the section of web.xml that points to the properties file and below that is the section of index.jsp with the message key itself. Any help much appreicated, or even ideas of debugging. 500 Internal Server Errorjavax.servlet.jsp.JspException: Missing message for key main.title atorg.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java,Compiled Code) at /index.jsp._jspService(/index.jsp.java, Compiled Code) at ... -- ~WEB-INF/web.xml action org.apache.struts.action.ActionServlet application cais -- ~/index.jsp <%@ page language="java" %><%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %><%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> -- ~WEB-INF/classes/cais.properties # C.A.I.S. Resource Bundlemain.title=CAISmain.master=Master Viewmain.detail=Detailed View
Re: struts not reading properties file
Most likely you have a copy of struts.jar somewhere on your CLASSPATH. It only belongs in WEB-INF/lib. -- Dan Miser http://www.distribucon.com - Original Message - From: G.L. Grobe To: [EMAIL PROTECTED] Sent: Tuesday, April 17, 2001 10:27 PM Subject: struts not reading properties file 500 Internal Server Error javax.servlet.jsp.JspException: Missing message for key main.title at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java, Compiled Code) at /index.jsp._jspService(/index.jsp.java, Compiled Code) at
indicating mandatory input fields in html form?
Is there a recommended method for indicating a required field in an html input form? I know I can just type an asterisk in, but isn't there a better way? Thanks. Phillip
Re: Confusing error and other questions
The exception is happening in the tag. I would guess that you have a malformed struts-config.xml file. Do you have any error messages in your console or servlet log file? You can look up data-source elements that you defined in struts-config.xml in your Action or ActionForm by using servlet.findDataSource(null) to retrieve the default DataSource, or servlet.findDataSource(key) to retrieve the DataSource identified by the key attribute. -- Dan Miser http://www.distribucon.com - Original Message - From: Scott Fitzgerald To: Struts-User Sent: Tuesday, April 17, 2001 1:00 PM Subject: Confusing error and other questions I am working on an application that interacts with a database. When I try to run the app, I get an error (500) that tells me: javax.servlet.ServletException: Cannot find ActionMappings or ActionFormBeans collection. Can someone offer some insight? Also, I have added a datasource mapping in my struts-config.xml file for my database access. When I reference this in my bean, do I have to reference one of the attributes of the datasource tag(ex:driverclass), or do I simply do a call to javax.sql.DataSource dataSource = (javax.sql.DataSource) getServletContext().getAttribute(Action.DATA_SOURCE_KEY);
Another bean:iterate question
I've been working on this problem for some time now. I finally had to use a scriplet to get it to work. I am trying to get a list of FieldTypes from a record controller (PrimaryServer below) which implement an AbstractField object (this may be the entire problem ... let me know if Abstract objects will cause problems). The controller has a method called getFieldList which returns an Iterator of these AbstractField objects. I then want to get the name of each field using the property getFielName(). The following is a snippet of my Jsp page. Tomcat always returns with an error saying it "can't find bean 'field' in scope null". Here is the scriplet that I wrote to finally get the results that I wanted. <% Iterator iter = PrimaryServer.getFieldList(); while( iter.hasNext() ) { AbstractField field = (AbstractField) iter.next(); String fieldName = field.getFieldName(); %> <%=fieldName%> <%} %> The iterator tag still trips me up from time to time. If anyone has any suggestions I would appreciate them. I have enjoyed reading the previous postings concerning the iterator tag. Thanks again, Brett
FormAction Bean for dynamically created forms
What is the best way to develop a FormAction bean for HTML forms that are dynamically generated? In other words, the FormAction bean won't know the parameters names of the form until runtime. For example, if I wanted to process HTML forms for relational database tables dynamically. Each input element could represent a column in the table. I have a Record class that contains a HashTable of the fields for a particular table. The Record class can be used to verify that the submitted values are correct for each field, but I can't have a static FormAction bean that knows every form paramter. Any suggestions would be greatly appreciated. Thanks in advance. Brett
Re: struts not reading properties file
Agreed, but not the case. - Original Message - From: "Dan Miser" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, April 17, 2001 11:13 PM Subject: Re: struts not reading properties file > Most likely you have a copy of struts.jar somewhere on your CLASSPATH. It > only belongs in WEB-INF/lib. > -- > Dan Miser > http://www.distribucon.com > > - Original Message - > From: G.L. Grobe > To: [EMAIL PROTECTED] > Sent: Tuesday, April 17, 2001 10:27 PM > Subject: struts not reading properties file > > 500 Internal Server Error > javax.servlet.jsp.JspException: Missing message for key main.title at > org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java, > Compiled Code) at /index.jsp._jspService(/index.jsp.java, Compiled Code) at > >