Struts-example database
I just downloaded struts 1.1 binary and loaded the struts-example into tomcat and it works fine. My question is I do not understand when and how the database is loaded in the index.jsp. There is a tag that reads: logic:notPresent name=database scope=application But I do not see the database name in the struts-config or web.xml file. In the tour.htm file it talks about a DatabaseServlet that I can not seem to find (I guess it was takin out). Thanks for the help, Derrick (Sorry if this is the second time you received this message. I do not think my first post went through.) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DynaForm Beans and Indexed Text fields.
Okay, so I set the scope of both the preload action, and the action servlet that my form is bieng posted to, to session. I also put the bean in session scope instead of request scope when I preload the DynaForm with values before passing it to the jsp. So The jsp still loads and reders the indexed text fields just fine.. but now I get this exception when I submit the form: java.lang.ClassCastException at org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:688) at org.apache.struts.action.RequestProcessor.processActionForm(RequestProcessor.java:359) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:253) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1420) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:520) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown Source) at org.apache.catalina.core.StandardWrapperValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardContextValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardContext.invoke(Unknown Source) at org.apache.catalina.core.StandardHostValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.valves.ErrorReportValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardEngineValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619) at java.lang.Thread.run(Thread.java:534) Apache Tomcat/4.1 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Generic Ok/Cancel Page
Hi I am wishing to create a generic OK/CANCEL type page that can be used by different workflow situations. Can anyone suggest a nice tidy way of doing this? The way I see it is that somehow I need to dynamically define the ok/cancel forwards from the page based on the page it is coming from. Cheers Shane Shane Mingins Analyst Programmer Assure NZ Ltd Ph 644 494 2522
Re: validation, input page, and request-scoped variables
That makes perfect sense now. Another action mapping that sets up the rest of the page variables but doesn't touch the form. I'll do it like that, of course making sure that the common parts (setting up the request attributes) is in one method that gets used by all. Thanks! On Sunday, Aug 24, 2003, at 06:38 Canada/Eastern, Adam Hardy wrote: Ah, I see I missed out a bit of the logic. My action class has a part that is executed for every action mapping, which fetches the necessary related data, such as dropdown lists (but not the actual object's properties). What else the action does is dependent on the result of a bit of logic which is executed after the mandatory processing mentioned above. I'm having problems describing it, perhaps it's easier to understand just looking at the xml: actionpath=/secure/startSectionInsert type=org.blacksail.linklib.section.SectionAction name=sectionForm scope=request validate=false parameter=blank roles=user set-property property=secure value=false/ forward name=finished path=.section/ /action actionpath=/secure/startSectionUpdate type=org.blacksail.linklib.section.SectionAction name=sectionForm scope=request validate=false parameter=display roles=user set-property property=secure value=false/ forward name=finished path=.section/ /action actionpath=/secure/sectionUpdate type=org.blacksail.linklib.section.SectionAction name=sectionForm scope=request validate=true parameter=save input=/secure/sectionValidateFailed.do roles=user set-property property=secure value=false/ forward name=failed path=.section/ forward name=displaypath=/secure/startSectionUpdate.do/ forward name=finished path=/secure/library.do redirect=true/ /action actionpath=/secure/sectionValidateFailed type=org.blacksail.linklib.section.SectionAction name=sectionForm scope=request parameter=finished roles=user set-property property=secure value=false/ forward name=finished path=.section/ /action Both insert and update submit to update. The last mapping there just does the mandatory getting the required dropdown lists. HTH Adam On 08/24/2003 02:13 AM ll wrote: Thanks for the reply. So in your save action your form input is the action that sets up the form. Meaning that in your struts-config for the save action you have input=/edit.do or input=/add.do...? Which one do you choose? Also, as I understand it, this can only work if the action doesn't set any of the form fields. Do your actions set any form fields? If not, then I guess you can always use the add action. But in my case the add action sets some values (for example to preselect a default item in an options list), and of course the edit action also sets values (it looks up the values from the database). So after submitting, if the validation fails, the form field values are changed, they are not what the user just typed. Or am I misunderstanding something? Thanks... On Saturday, Aug 23, 2003, at 13:42 Canada/Eastern, Adam Hardy wrote: Hi II I use your method 1. My add and edit actions use the same JSP and both submit to the same save action. In my add, I set the id to 0, so on save, it knows that this is an add and not an edit. I had to make a decision not to allow 0s as ids in the database. Possibly I could have used a negative number instead, as long as it validates. Adam On 08/23/2003 07:29 PM ll wrote: Here's my problem: I have a form page that uses some request-scoped attributes for some things it shows on the page (other than the form field data). I always access the page through an action which sets up the attributes. But if validation fails when I submit the form, then those request attributes no longer exist because the input forwards to the jsp page without going through the action again. Two possible solutions: 1. On the save action, use input=/person/add so that when validation fails control is forwarded back through the action, which can then set up the request attributes again. - problem: I use the same page from an edit action, which takes a person id parameter and pre-fills the form. If I do it this way I will need two save actions, one that uses the edit page as the input and one that uses the add page as the input. Then the form can't be shared, because I the submit action will need to change depending on whether it is an add or an edit. 2. Store the attributes in the session instead of the request. - problem: if the user has two browser windows open to the same form then the values displayed in the page could be wrong
Re: Generic Ok/Cancel Page
I have a generic confirm page (it just tells the user that the action was completed, i.e. their data was saved), but I'm sure you could use the same idea. In my submit action (the one that handles the form submission), I have two forwards: forward name=confirm path=/WEB-INF/jsp/confirm.jsp/ forward name=continue path=/app/setup/normalUser redirect=true/ confirm is the confirmation page, and continue is where the user should go after the confirmation page. In my action: // find the continue ActionForward, and save it's path in the request ActionForward continueAf = mapping.findForward(continue); WebUtil.setRequestAttribute(request, continuePath, continueAf.getPath()); return mapping.findForward(confirm); and in the confirmation jsp page there is a continue link: html:link hide=true page=%= (String) request.getAttribute(continuePath) % bean:message key=common.continue/ /html:link Instead of just a continue forward, you could have two: ok and cancel. Then in the action store them both in the request, and the jsp page could have two links. Hope that helps. On Sunday, Aug 24, 2003, at 21:55 Canada/Eastern, Shane Mingins wrote: Hi I am wishing to create a generic OK/CANCEL type page that can be used by different workflow situations. Can anyone suggest a nice tidy way of doing this? The way I see it is that somehow I need to dynamically define the ok/cancel forwards from the page based on the page it is coming from. Cheers Shane Shane Mingins Analyst Programmer Assure NZ Ltd Ph 644 494 2522 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts-example database
The example application defines a custom plug-in that is initialised at start-up and loads the database and stores it in the ServletContext (application scope). struts-config.xml: plug-in className=org.apache.struts.webapp.example.memory.MemoryDatabasePlugIn set-property property=pathname value=/WEB-INF/database.xml/ /plug-in MemoryDatabasePlugIn.java servlet.getServletContext().setAttribute(Constants.DATABASE_KEY, database); Constants.java public static final String DATABASE_KEY = database; Plug-ins are a common way to initialise application resources. Another way, that requires at least a Servlet 2.3 container would be to implement a ServletContextListener. Steve http://www.ninsky.com/struts/ -Original Message- From: Derrick Brooks [mailto:[EMAIL PROTECTED] Sent: August 24, 2003 3:43 PM To: [EMAIL PROTECTED] Subject: Struts-example database I just downloaded struts 1.1 binary and loaded the struts-example into tomcat and it works fine. My question is I do not understand when and how the database is loaded in the index.jsp. There is a tag that reads: logic:notPresent name=database scope=application But I do not see the database name in the struts-config or web.xml file. In the tour.htm file it talks about a DatabaseServlet that I can not seem to find (I guess it was takin out). Thanks for the help, Derrick (Sorry if this is the second time you received this message. I do not think my first post went through.) - 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: How to dynamically decide the properties of the DynaValidator/DynaActionForm
Adam, Even, i know the nature of all the attributes during design time itself. Assume, i have 50 attributes in general, i know how to validate each one of them, during design time. But, for a particular kind of Business object, i would be getting just 20 properties alone, and the rest of the properties will not be applicable to the business object. Thats why i was facing problem, while contructing the bean. I think, with struts-validator, i can define all the possible rules for the bean. I have to give a try ... Thanks, R Balaji Adam Hardy wrote: Concerning the validation, what you do depends on whether all the possible different validation mechanisms are limited to a defined set, or whether it is an unbounded set that you cannot limit at design time. On 08/24/2003 07:06 AM R Balaji wrote: well, in the jsp, i would be getting all the dynaproperties.. and be enumerating them while printing the keys and values in the UI. I managed to to do this, and able to display the bean details. I too realized that i should handle the reset method. I will try that. Yes, my business tier will give the information regarding the valid values of each attribute. I believe that i can use this for validating the properties. But i too do not know how far i can use dynavalidator and the validation framework. Do you have any suggestions other than my current dynamic bean population design ?. Regards, R Balaji Adam Hardy wrote: I read your solution for populating the dynaform. How do you display it in JSP? I mean, how does the JSP know what the field names are? I don't really know the internal workings of the dynavalidator form and how struts would populate the form bean with request parameters. You would probably have to do the same formbean initialization in the bean's reset method, otherwise the request parameters will probably not get saved to it. Once you get that far, then validation becomes an issue. At design time you don't what the fields of a form will be - but do you know how any particular type of field should be validated? If so, how do you know? Is that in the design? Adam On 08/23/2003 05:34 PM R Balaji wrote: Yes, Adam .. this is a valid point , that i need to consider. But, it is almost impossible to define a bean for each type of data, in my application. I need to use the dynabean and dynaclass , some how. I managed to find a solution for populating the bean , now i have to find a solution for validation too. Suggest me a suitable validation approach.. With Regards, R Balaji Adam Hardy wrote: I can see that you could just iterate over the unknown form properties in the JSP, but how would you label them? And when the form is submitted, how would you validate them? I think you would be better advised to add your list of properties as beans to your form. In each bean you could also have a label and a validation. my 2 cents. Adam On 08/23/2003 12:03 PM Mark Lowe wrote: You cant dynamically add properties to DynaActionForms. I'm not sure why you've a problem with just adding the fields to you form bean in struts config. I've demonstrated how to literally do what you want, but you'd have to specify the properties you want in you jsp anyway. But here goes You could create a new form bean copy the properties across from you old one and then add some new stuff.. DynaActionForm oldForm = (DynaActionForm) form; //get the map out and mess with this and life should be simpler that using the dynaBean Map oldFormMap = oldForm.getMap(); oldFormMap.put(statusChangeTime,A new Time); DynaActionForm newForm = new DynaActionForm(); BeanUtils.populate(newForm, oldFormMap); If this doesn't work you can try constructing all you dyna properties, having a DynaProperty[] array and then use the dynaBean constructer that takes a properties array. Cheers Mark On Saturday, August 23, 2003, at 04:42 AM, R Balaji wrote: Dear All, I have an application which returns a varity of properties, which can not be decided at design time. I would like to populate the Business data into a dynaValidatorForm and display them. In this case, it is not possible to specify all the properties as form-property. If i set properties, without specifying them in the struts-config.xml, i am getting exception as mentioned below. java.lang.IllegalArgumentException: Invalid property name 'statusChangeTime' at org.apache.struts.action.DynaActionForm.getDynaProperty(DynaActionForm. java:598) at org.apache.struts.action.DynaActionForm.set(DynaActionForm.java:412) at com.adventnet.nms.webclient.topo.details.ObjectDetailsHandler.populateV iewBean(ObjectDetailsHandler.java:63) at com.adventnet.nms.webclient.topo.details.ObjectDetailsHandler.fetchObje ctDetails(ObjectDetailsHandler.java:49) at com.adventnet.nms.webclient.topo.details.ObjectDetailsAction.execute(Ob jectDetailsAction.java:54) Please help me , in this regards, Thanks in
Re: Generic Ok/Cancel Page
and in the confirmation jsp page there is a continue link: html:link hide=true page=%= (String) request.getAttribute(continuePath) % bean:message key=common.continue/ /html:link oh sorry... ignore the hide=true... I have subclassed the link tag and added some functionality (optionally hide the link if the currently logged-in user would not be able to access it), but I forgot to remove that from my example for you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Disallow user to modify URL in browser address bar
You can check the HTTP_REFERRER host header info. If you click an url (hyperlink) http://localhost:8080/app/str/testview_srchpost.do which is given in http://localhost:8080/app/str/index.jsp page then the referrer would be http://localhost:8080/app/str/index.jsp if you just type the url in the location bar, then the referrer would be blank. You can check that out and send a status 500 in the header. -Original Message- From: Syed, Nazeer [mailto:[EMAIL PROTECTED] Sent: Friday, August 22, 2003 7:11 PM To: Struts Users Mailing List Subject: RE: Disallow user to modify URL in browser address bar If testview_srchpost.do and testtwoview_srchpost.do are valid action then you cannot restrict. This means testview_srchpost.do, esttwoview_srchpost.do are in Struts Config File If that testtwoview_srchpost.do not Valid action then It will go default page or Error Page Thanks Nazeer -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Friday, August 22, 2003 2:16 AM To: 'Struts Users Mailing List' Subject: Disallow user to modify URL in browser address bar How to identify if user has manipulated the URL in Address Bar of the browser? For ex., the application displays a page with the following URL: http://localhost:8080/app/str/testview_srchpost.do Now, the user modifies the URL in the address bard. Instead of testview_srchpost.do, user types testtwoview_srchpost.do and clicks ENTER. I want to restrict such types of URL modification Struts application. I should take the user to a default access denied page when ever user does such changes. How to identify this action of the user? Pl. give some ideas. This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately. You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited. Visit Us at http://www.polaris.co.in - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Issue in using struts-html-el tag
Hi All, I am using struts-html-el tag in my jsp page for textarea. Steps i have followed.. 1. Put struts-el.jar in CLASSPATH or WEB-INF/lib (This jar would be present in $STRUTS_HOME/contrib/struts-el/lib) 2. Declare the prefix to be used in your jsp : [EMAIL PROTECTED] uri = http://jakarta.apache.org/struts/tags-html-el; prefix = html-el % The piece of code looks like this, [EMAIL PROTECTED] uri = http://jakarta.apache.org/struts/tags-html-el; prefix = html-el % form action=# table width=90% border=0 align=center cellpadding=2 cellspacing=1 tr td width=26% align=left valign=top class=textMessage :/td td height=30 html-el:text property=assign style=width:180 styleClass=formstyle/ /td /tr /table /form But i am getting the following exception while invoking it. Where i am making the mistake. The exception is, Apache Tomcat/4.0.4 - HTTP Status 500 - Internal Server Error *type* Exception report *message* _Internal Server Error_ *description* _The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request._ *exception* javax.servlet.ServletException: Cannot find bean org.apache.struts.taglib.html.BEAN in any scope at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:471) at org.apache.jsp.assignAlert$jsp._jspService(assignAlert$jsp.java:585) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:683) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:431) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:355) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1058) at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:451) at org.apache.struts.action.RequestProcessor.processActionForward(RequestProcessor.java:401) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1420) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:502) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
RE: Problem build war using Ant
Thanks for the response, My dir strucute is webgui |_ build #contains the build file |_ classes #Where build stores the class |_ etc # contains all my config files. |_ lib # contains depending jar file like jar files of struts tld etc. |_ pages# contains jsp files |_ src # contains .java files. Thanks and regards Deeapk. -Original Message- From: Navjot Singh [mailto:[EMAIL PROTECTED] Sent: Saturday, August 23, 2003 12:21 PM To: Struts Users Mailing List; deepaksawdekar Subject: RE: Problem build war using Ant hi deepak, Posting the directory structure would have been great help. BTW, which version of Ant are you using? If any less than 1.5.3, switch RIGHT NOW. Lower version are buggy in terms of getting classes and lib tasks. hth Navjot Singh |-Original Message- |From: deepaksawdekar [mailto:[EMAIL PROTECTED] |Sent: Friday, August 22, 2003 10:18 PM |To: Struts Users Mailing List |Subject: Problem build war using Ant | | |I am using Ant to build my war file. my build file is | |target name=createwar | war destfile=${war.file.name} webxml=WEB-INF/myapp.xml | fileset dir=./pages excludes=*.war, |**/*.nbattrs, *.java/ | webinf dir=./etcincludes=*.tld, |./struts-config.xml excludes=**/*.jar, **/*.class/ |lib dir=./lib /lib |classes dir=${build.dir} includes=**/*.properties / | /war | /target | | |When i run the build only content of pages dir is included, Can |some one help me to debug tht build file. | |Thanks and Regards |Deepak | |- |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: How to dynamically decide the properties of the DynaValidator/DynaActionForm
Mark, This approach looks nice. Did you consider, populating the bean, on form submit ? ... one more thing is.. will the struts-validator go well with this ? R Balaji Mark Lowe wrote: Okay .. I've been thinking about this. I think it might work something like this.. form-property name=beans property=java.util.ArrayList / The arrayList will be a container for your beans with indexed properties. So in jsp we're thinking, or aiming for logic:iterate id=bean name=myForm property=beans bean:write name=bean property=key[%= index %] / html:text name=bean property=value[%= index %] / /logic:iterate So we have a bean thats mapped backed, or something here's some pseudo code. public class MyBean { private Map map; public Object[] getKeys() { return map.keySet().toArray(); } public Object[] getValues() { ArrayList list = new ArrayList(); Object[] keys = getKeys(); for(int i = 0;i keys.length;i++) { String value = map.get(keys[i].toString()); list.add(value); } return list.toArray(); } public String getKey(int i) { return keys[i].toString(); } public String getValue(int i) { String key = getKey(i); return map.get(key); } public void setKey(int i, String str) { keys[i] = str; } public void setValue(int i , String str) { map.put(getKey(i),str); } ... well you get the idea.. Am I tree barking, smoking crack or something but Its starting look possible.. el should help move the scriptlets out, but using indexed, mapped properties looks like it may do the job.. the bean could have a double sided array it returns to keep the keys and values in the correct order. The keys are after all the illusion that the properties have names, when really they are associated via index. When it comes time to write to a db or something the bean could return a map and the key=value pairs should all be there ready. Cheers mark On Saturday, August 23, 2003, at 06:51 PM, Adam Hardy wrote: I read your solution for populating the dynaform. How do you display it in JSP? I mean, how does the JSP know what the field names are? I don't really know the internal workings of the dynavalidator form and how struts would populate the form bean with request parameters. You would probably have to do the same formbean initialization in the bean's reset method, otherwise the request parameters will probably not get saved to it. Once you get that far, then validation becomes an issue. At design time you don't what the fields of a form will be - but do you know how any particular type of field should be validated? If so, how do you know? Is that in the design? Adam On 08/23/2003 05:34 PM R Balaji wrote: Yes, Adam .. this is a valid point , that i need to consider. But, it is almost impossible to define a bean for each type of data, in my application. I need to use the dynabean and dynaclass , some how. I managed to find a solution for populating the bean , now i have to find a solution for validation too. Suggest me a suitable validation approach.. With Regards, R Balaji Adam Hardy wrote: I can see that you could just iterate over the unknown form properties in the JSP, but how would you label them? And when the form is submitted, how would you validate them? I think you would be better advised to add your list of properties as beans to your form. In each bean you could also have a label and a validation. my 2 cents. Adam On 08/23/2003 12:03 PM Mark Lowe wrote: You cant dynamically add properties to DynaActionForms. I'm not sure why you've a problem with just adding the fields to you form bean in struts config. I've demonstrated how to literally do what you want, but you'd have to specify the properties you want in you jsp anyway. But here goes You could create a new form bean copy the properties across from you old one and then add some new stuff.. DynaActionForm oldForm = (DynaActionForm) form; //get the map out and mess with this and life should be simpler that using the dynaBean Map oldFormMap = oldForm.getMap(); oldFormMap.put(statusChangeTime,A new Time); DynaActionForm newForm = new DynaActionForm(); BeanUtils.populate(newForm, oldFormMap); If this doesn't work you can try constructing all you dyna properties, having a DynaProperty[] array and then use the dynaBean constructer that takes a properties array. Cheers Mark On Saturday, August 23, 2003, at 04:42 AM, R Balaji wrote: Dear All, I have an application which returns a varity of properties, which can not be decided at design time. I would like to populate the Business data into a dynaValidatorForm and display them. In this case, it is not possible to specify all the properties as form-property. If i set properties, without specifying them in the struts-config.xml, i am
RE: Problem build war using Ant
have you checked the ANT version? |-Original Message- |From: deepaksawdekar [mailto:[EMAIL PROTECTED] |Sent: Monday, August 25, 2003 10:39 AM |To: Navjot Singh; Struts Users Mailing List |Subject: RE: Problem build war using Ant | | |Thanks for the response, |My dir strucute is |webgui | |_ build #contains the build file | |_ classes #Where build stores the class | |_ etc # contains all my config files. | |_ lib # contains depending jar file like jar files of |struts tld etc. | |_ pages# contains jsp files | |_ src # contains .java files. | | |Thanks and regards |Deeapk. | |-Original Message- |From: Navjot Singh [mailto:[EMAIL PROTECTED] |Sent: Saturday, August 23, 2003 12:21 PM |To: Struts Users Mailing List; deepaksawdekar |Subject: RE: Problem build war using Ant | | |hi deepak, | |Posting the directory structure would have been great help. | |BTW, which version of Ant are you using? If any less than 1.5.3, switch |RIGHT NOW. Lower version are buggy in terms of getting classes and lib |tasks. | |hth |Navjot Singh | ||-Original Message- ||From: deepaksawdekar [mailto:[EMAIL PROTECTED] ||Sent: Friday, August 22, 2003 10:18 PM ||To: Struts Users Mailing List ||Subject: Problem build war using Ant || || ||I am using Ant to build my war file. my build file is || ||target name=createwar || war destfile=${war.file.name} webxml=WEB-INF/myapp.xml || fileset dir=./pages excludes=*.war, ||**/*.nbattrs, *.java/ || webinf dir=./etcincludes=*.tld, ||./struts-config.xml excludes=**/*.jar, **/*.class/ ||lib dir=./lib /lib ||classes dir=${build.dir} includes=**/*.properties / || /war || /target || || ||When i run the build only content of pages dir is included, Can ||some one help me to debug tht build file. || ||Thanks and Regards ||Deepak || ||- ||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]
Is singleton DAO acceptable? -- Best Practices
All the DAO examples I've read have DaoFactory classes that always return a new DAO instance, and typically the action using it keeps a handle to it for that session. The DAOs that I've created have no state or instance variables, and get their connections from a synchronized pool (and always returning the connection within the same method call). So, since they are multi-threaded, it makes sense to me performance wise it is better for the factory to always return a singleton instance of the DAO. This single instance of the DAO is shared across all sessions in the JVM. (Note this is not the traditional usage of singleton where the singleton itself is responsible for returning the single instance through a static method). My question is, is this such a good idea? Am I missing or misunderstanding something crucial about the DAO Design Pattern? Mick. -- BR/ We all may have come on different ships, but were in the same boat now. Martin Luther King. Jr. BR/ --- a href=http://www.harryspractice.com.auwww.harryspractice.com.au/a --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Design question...
hi, If are getting some collection to the JSP page and just wish to display a subset of them without changing anything on BL layer, Use Pager Taglib and get away with it easily. But there is a downside to it as you may have 1000 records and you just want to show 10. So, 990 records are burden on network for no use at all. But you can avoid this also. Pager taglib provides you with one parameter offset that can be passed onto the controller layer and then to your Session EJB. Session EJB will trim the 1000 records collection obtained to 10 records based on that offset value. Now when you pass the DTO back, it will contain maximum 10 records. Reducing network load and you get only those records that you want in presentation layer. HTH navjot singh |-Original Message- |From: Keith Pemberton [mailto:[EMAIL PROTECTED] |Sent: Sunday, August 24, 2003 7:09 PM |To: [EMAIL PROTECTED] |Subject: Design question... | | |I have a JSP page that contains entries from a database. I am getting |the items using a DTO that is passed from a session EJB. What I would |like to be able to do is to specify a parameter in the URL named |offset that when changed would display the next results from the |database. Couple of questions... Would it be considered presentation |logic to perform the action of getting the DTO from the session bean |within the JSP page? I really don't want to do it that way because I'm |trying to keep the layers as separate as possible. So, if I don't do it |that way, I will have to use Action classes and html:links that can pass |the parameter to action class? | |My real question is what is the best way of dealing with EJBs in the |presentation layer? I know that I have to get a DTO of the information |that I want, but usually the methods of the DTO take parameters that I |can't pass to the DTO in the JSP page. I have read over and over the |Oreilly Struts book but it still is confusing me. Thanks for any help! | |Keith Pemberton |-- |Keith Pemberton [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]
Missing images style sheet in welcome file
Hi, In my web application (using struts), I have login.jsp as welcome file. I've defined the welcome file in web.xml as follows: welcome-file-list welcome-file/jsp/login.jsp/welcome-file /welcome-file-list And in login.jsp, I'm using relative path to load images and style sheet. My directory structure is as follows: ---web | |--css | |--jsp | |--images | |--WEB-INF login.jsp is located in /web/jsp folder. In login.jsp, I'm including style sheet as follows: link href=../css/style.css rel=stylesheet type=text/css ../css/style.css -- the style sheet is located in /web/css folder. Now, when I browse http://localhost:8080/myApp, login.jsp is displayed as welcome page, but the style sheet is not found. Same is the case with images on login.jsp. (this problem is occurring on Linux) But when I use http://localhost:8080/myApp/jsp/login.jsp, then it is displaying everything perfectly. And http://localhost:8080/myApp displays the login page correctly on Windows. Any idea what could be the problem? Sriram
Re: Issue in using struts-html-el tag
Hi Aattai, Well, all the configurations you made in your jsp are fine. in the html-el:text, you have mentioned that it should be populated to the assign property of the bean. But how will the el tag know, the name of the bean, this property belongs to ?. better you specify the name of the bean also html-el:text styleClass= smalltext name=***FormBean property=assigns value=${***FormBean.assign}/ Hope this helps, With Regards, R Balaji K.M.Prabhu wrote: Hi All, I am using struts-html-el tag in my jsp page for textarea. Steps i have followed.. 1. Put struts-el.jar in CLASSPATH or WEB-INF/lib (This jar would be present in $STRUTS_HOME/contrib/struts-el/lib) 2. Declare the prefix to be used in your jsp : [EMAIL PROTECTED] uri = http://jakarta.apache.org/struts/tags-html-el; prefix = html-el % The piece of code looks like this, [EMAIL PROTECTED] uri = http://jakarta.apache.org/struts/tags-html-el; prefix = html-el % form action=# table width=90% border=0 align=center cellpadding=2 cellspacing=1 tr td width=26% align=left valign=top class=textMessage :/td td height=30 html-el:text property=assign style=width:180 styleClass=formstyle/ /td /tr /table /form But i am getting the following exception while invoking it. Where i am making the mistake. The exception is, Apache Tomcat/4.0.4 - HTTP Status 500 - Internal Server Error *type* Exception report *message* _Internal Server Error_ *description* _The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request._ *exception* javax.servlet.ServletException: Cannot find bean org.apache.struts.taglib.html.BEAN in any scope at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:471) at org.apache.jsp.assignAlert$jsp._jspService(assignAlert$jsp.java:585) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:683) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:431) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:355) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1058) at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:451) at org.apache.struts.action.RequestProcessor.processActionForward(RequestProcessor.java:401) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1420) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:502) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170) at
Re: How to dynamically decide the properties of the DynaValidator/DynaActionForm
The struts-validator configuration xml requires you to name the form fields to be validated and the validation it depends on, at design time. I am not sure about this, but it might be possible to define your validation to do all possible validations on a form bean. I haven't tried putting extra fields in a validation.xml that aren't present in the struts-config form definition. Perhaps it's possible, perhaps it will fail. It won't be too difficult though to write your own validate routine, and just drop the validator. I assume you are not so ambitious to want javascript validation as well! Adam On 08/25/2003 05:13 AM R Balaji wrote: Mark, This approach looks nice. Did you consider, populating the bean, on form submit ? ... one more thing is.. will the struts-validator go well with this ? R Balaji Mark Lowe wrote: Okay .. I've been thinking about this. I think it might work something like this.. form-property name=beans property=java.util.ArrayList / The arrayList will be a container for your beans with indexed properties. So in jsp we're thinking, or aiming for logic:iterate id=bean name=myForm property=beans bean:write name=bean property=key[%= index %] / html:text name=bean property=value[%= index %] / /logic:iterate So we have a bean thats mapped backed, or something here's some pseudo code. public class MyBean { private Map map; public Object[] getKeys() { return map.keySet().toArray(); } public Object[] getValues() { ArrayList list = new ArrayList(); Object[] keys = getKeys(); for(int i = 0;i keys.length;i++) { String value = map.get(keys[i].toString()); list.add(value); } return list.toArray(); } public String getKey(int i) { return keys[i].toString(); } public String getValue(int i) { String key = getKey(i); return map.get(key); } public void setKey(int i, String str) { keys[i] = str; } public void setValue(int i , String str) { map.put(getKey(i),str); } ... well you get the idea.. Am I tree barking, smoking crack or something but Its starting look possible.. el should help move the scriptlets out, but using indexed, mapped properties looks like it may do the job.. the bean could have a double sided array it returns to keep the keys and values in the correct order. The keys are after all the illusion that the properties have names, when really they are associated via index. When it comes time to write to a db or something the bean could return a map and the key=value pairs should all be there ready. Cheers mark On Saturday, August 23, 2003, at 06:51 PM, Adam Hardy wrote: I read your solution for populating the dynaform. How do you display it in JSP? I mean, how does the JSP know what the field names are? I don't really know the internal workings of the dynavalidator form and how struts would populate the form bean with request parameters. You would probably have to do the same formbean initialization in the bean's reset method, otherwise the request parameters will probably not get saved to it. Once you get that far, then validation becomes an issue. At design time you don't what the fields of a form will be - but do you know how any particular type of field should be validated? If so, how do you know? Is that in the design? Adam On 08/23/2003 05:34 PM R Balaji wrote: Yes, Adam .. this is a valid point , that i need to consider. But, it is almost impossible to define a bean for each type of data, in my application. I need to use the dynabean and dynaclass , some how. I managed to find a solution for populating the bean , now i have to find a solution for validation too. Suggest me a suitable validation approach.. With Regards, R Balaji Adam Hardy wrote: I can see that you could just iterate over the unknown form properties in the JSP, but how would you label them? And when the form is submitted, how would you validate them? I think you would be better advised to add your list of properties as beans to your form. In each bean you could also have a label and a validation. my 2 cents. Adam On 08/23/2003 12:03 PM Mark Lowe wrote: You cant dynamically add properties to DynaActionForms. I'm not sure why you've a problem with just adding the fields to you form bean in struts config. I've demonstrated how to literally do what you want, but you'd have to specify the properties you want in you jsp anyway. But here goes You could create a new form bean copy the properties across from you old one and then add some new stuff.. DynaActionForm oldForm = (DynaActionForm) form; //get the map out and mess with this and life should be simpler that using the dynaBean Map oldFormMap = oldForm.getMap(); oldFormMap.put(statusChangeTime,A new Time); DynaActionForm newForm = new DynaActionForm();
RE: Problem build war using Ant
Thanks a lot. yes it was the problem of ant version only. i was using eclipse plugin which support ant 1.5.2. After i installed the separate ant 1.5.4 it works. Now i have to find the plugin for eclipse which supports ant 1.5.3 or above. Deepak -Original Message- From: Navjot Singh [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 11:50 AM To: Struts Users Mailing List Subject: RE: Problem build war using Ant have you checked the ANT version? |-Original Message- |From: deepaksawdekar [mailto:[EMAIL PROTECTED] |Sent: Monday, August 25, 2003 10:39 AM |To: Navjot Singh; Struts Users Mailing List |Subject: RE: Problem build war using Ant | | |Thanks for the response, |My dir strucute is |webgui | |_ build #contains the build file | |_ classes #Where build stores the class | |_ etc # contains all my config files. | |_ lib # contains depending jar file like jar files of |struts tld etc. | |_ pages# contains jsp files | |_ src # contains .java files. | | |Thanks and regards |Deeapk. | |-Original Message- |From: Navjot Singh [mailto:[EMAIL PROTECTED] |Sent: Saturday, August 23, 2003 12:21 PM |To: Struts Users Mailing List; deepaksawdekar |Subject: RE: Problem build war using Ant | | |hi deepak, | |Posting the directory structure would have been great help. | |BTW, which version of Ant are you using? If any less than 1.5.3, switch |RIGHT NOW. Lower version are buggy in terms of getting classes and lib |tasks. | |hth |Navjot Singh | ||-Original Message- ||From: deepaksawdekar [mailto:[EMAIL PROTECTED] ||Sent: Friday, August 22, 2003 10:18 PM ||To: Struts Users Mailing List ||Subject: Problem build war using Ant || || ||I am using Ant to build my war file. my build file is || ||target name=createwar || war destfile=${war.file.name} webxml=WEB-INF/myapp.xml || fileset dir=./pages excludes=*.war, ||**/*.nbattrs, *.java/ || webinf dir=./etcincludes=*.tld, ||./struts-config.xml excludes=**/*.jar, **/*.class/ ||lib dir=./lib /lib ||classes dir=${build.dir} includes=**/*.properties / || /war || /target || || ||When i run the build only content of pages dir is included, Can ||some one help me to debug tht build file. || ||Thanks and Regards ||Deepak || ||- ||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: How to dynamically decide the properties of the DynaValidator/DynaActionForm
sorry, I meant to say regarding validation, if you try defining 50 form fields in a validation.xml, then you have to have 50 names. You would also have to copy and paste the whole form definition for each form. Sounds less and less like a good idea, if it even works. On 08/25/2003 05:13 AM R Balaji wrote: Mark, This approach looks nice. Did you consider, populating the bean, on form submit ? ... one more thing is.. will the struts-validator go well with this ? R Balaji Mark Lowe wrote: Okay .. I've been thinking about this. I think it might work something like this.. form-property name=beans property=java.util.ArrayList / The arrayList will be a container for your beans with indexed properties. So in jsp we're thinking, or aiming for logic:iterate id=bean name=myForm property=beans bean:write name=bean property=key[%= index %] / html:text name=bean property=value[%= index %] / /logic:iterate So we have a bean thats mapped backed, or something here's some pseudo code. public class MyBean { private Map map; public Object[] getKeys() { return map.keySet().toArray(); } public Object[] getValues() { ArrayList list = new ArrayList(); Object[] keys = getKeys(); for(int i = 0;i keys.length;i++) { String value = map.get(keys[i].toString()); list.add(value); } return list.toArray(); } public String getKey(int i) { return keys[i].toString(); } public String getValue(int i) { String key = getKey(i); return map.get(key); } public void setKey(int i, String str) { keys[i] = str; } public void setValue(int i , String str) { map.put(getKey(i),str); } ... well you get the idea.. Am I tree barking, smoking crack or something but Its starting look possible.. el should help move the scriptlets out, but using indexed, mapped properties looks like it may do the job.. the bean could have a double sided array it returns to keep the keys and values in the correct order. The keys are after all the illusion that the properties have names, when really they are associated via index. When it comes time to write to a db or something the bean could return a map and the key=value pairs should all be there ready. Cheers mark On Saturday, August 23, 2003, at 06:51 PM, Adam Hardy wrote: I read your solution for populating the dynaform. How do you display it in JSP? I mean, how does the JSP know what the field names are? I don't really know the internal workings of the dynavalidator form and how struts would populate the form bean with request parameters. You would probably have to do the same formbean initialization in the bean's reset method, otherwise the request parameters will probably not get saved to it. Once you get that far, then validation becomes an issue. At design time you don't what the fields of a form will be - but do you know how any particular type of field should be validated? If so, how do you know? Is that in the design? Adam On 08/23/2003 05:34 PM R Balaji wrote: Yes, Adam .. this is a valid point , that i need to consider. But, it is almost impossible to define a bean for each type of data, in my application. I need to use the dynabean and dynaclass , some how. I managed to find a solution for populating the bean , now i have to find a solution for validation too. Suggest me a suitable validation approach.. With Regards, R Balaji Adam Hardy wrote: I can see that you could just iterate over the unknown form properties in the JSP, but how would you label them? And when the form is submitted, how would you validate them? I think you would be better advised to add your list of properties as beans to your form. In each bean you could also have a label and a validation. my 2 cents. Adam On 08/23/2003 12:03 PM Mark Lowe wrote: You cant dynamically add properties to DynaActionForms. I'm not sure why you've a problem with just adding the fields to you form bean in struts config. I've demonstrated how to literally do what you want, but you'd have to specify the properties you want in you jsp anyway. But here goes You could create a new form bean copy the properties across from you old one and then add some new stuff.. DynaActionForm oldForm = (DynaActionForm) form; //get the map out and mess with this and life should be simpler that using the dynaBean Map oldFormMap = oldForm.getMap(); oldFormMap.put(statusChangeTime,A new Time); DynaActionForm newForm = new DynaActionForm(); BeanUtils.populate(newForm, oldFormMap); If this doesn't work you can try constructing all you dyna properties, having a DynaProperty[] array and then use the dynaBean constructer that takes a properties array. Cheers Mark On Saturday, August 23, 2003, at 04:42 AM, R Balaji wrote: Dear All, I have an application which returns a varity of properties,
suggestion needed
Hi, I'm a new bee to struts. I have tried some examples and now I'm able to understand a bit abt the framework, but still not sure of the complete steps needed to develop a web application using struts. It will be a great help for me, if any one of you suggest me a site with good examples. Thanks Regards, Raju BSN,
RE: Missing images style sheet in welcome file
Nagendra, After posting the question, I realized that I haven't included html:base/ in .jsp file. I included that and it worked fine. Thanks. Sriram -Original Message- From: Nagendra Kumar O V S [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 12:53 PM To: [EMAIL PROTECTED] Subject: Re: Missing images style sheet in welcome file hi, have u looked in to the the final url after the page is rendered.?? have u tried using the html:base/ in ur jsp?? -- nagi ---Original Message--- From: Struts Users Mailing mailto:[EMAIL PROTECTED] List Date: Monday, August 25, 2003 12:12:56 PM To: 'Struts Users Mailing mailto:[EMAIL PROTECTED] List' Subject: Missing images style sheet in welcome file Hi, In my web application (using struts), I have login.jsp as welcome file. I've defined the welcome file in web.xml as follows: welcome-file-list welcome-file/jsp/login.jsp/welcome-file /welcome-file-list And in login.jsp, I'm using relative path to load images and style sheet. My directory structure is as follows: ---web | |--css | |--jsp | |--images | |--WEB-INF login.jsp is located in /web/jsp folder. In login.jsp, I'm including style sheet as follows: link href=../css/style.css rel=stylesheet type=text/css ../css/style.css -- the style sheet is located in /web/css folder. Now, when I browse http://localhost:8080/myApp, login.jsp is displayed as welcome page, but the style sheet is not found. Same is the case with images on login.jsp. (this problem is occurring on Linux) But when I use http://localhost:8080/myApp/jsp/login.jsp, http://localhost:8080/myApp/jsp/login.jsp, then it is displaying everything perfectly. And http://localhost:8080/myApp displays the login page correctly on Windows. Any idea what could be the problem? Sriram http://www.incredimail.com/redir.asp?ad_id=309lang=9 IncrediMail - Email has finally evolved - http://www.incredimail.com/redir.asp?ad_id=309lang=9 Click Here
RE: Disallow user to modify URL in browser address bar
Veeraswamy, Thanks for that. I have done the same. Instead of HTTP_REFERER, I have used 'referer'. When I was working with ASP, I have done this with HTTP_REFERER and I tried the same with JSP-Struts application also. But it didn't work. Then I printed all the headers and noticed that it should be 'referer' instead of 'HTTP_REFERRER' This is working now. But I am wondering if this a good practice or not because I have not seen this as a standard anywhere. Sriram -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 10:27 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: RE: Disallow user to modify URL in browser address bar Importance: High You can check the HTTP_REFERRER host header info. If you click an url (hyperlink) http://localhost:8080/app/str/testview_srchpost.do which is given in http://localhost:8080/app/str/index.jsp page then the referrer would be http://localhost:8080/app/str/index.jsp if you just type the url in the location bar, then the referrer would be blank. You can check that out and send a status 500 in the header. -Original Message- From: Syed, Nazeer [mailto:[EMAIL PROTECTED] Sent: Friday, August 22, 2003 7:11 PM To: Struts Users Mailing List Subject: RE: Disallow user to modify URL in browser address bar If testview_srchpost.do and testtwoview_srchpost.do are valid action then you cannot restrict. This means testview_srchpost.do, esttwoview_srchpost.do are in Struts Config File If that testtwoview_srchpost.do not Valid action then It will go default page or Error Page Thanks Nazeer -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Friday, August 22, 2003 2:16 AM To: 'Struts Users Mailing List' Subject: Disallow user to modify URL in browser address bar How to identify if user has manipulated the URL in Address Bar of the browser? For ex., the application displays a page with the following URL: http://localhost:8080/app/str/testview_srchpost.do Now, the user modifies the URL in the address bard. Instead of testview_srchpost.do, user types testtwoview_srchpost.do and clicks ENTER. I want to restrict such types of URL modification Struts application. I should take the user to a default access denied page when ever user does such changes. How to identify this action of the user? Pl. give some ideas.
RE: Missing images style sheet in welcome file
I forgot to include html:base/ in login.jsp. I've included this and it worked! -Original Message- From: sriram [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 11:19 AM To: 'Struts Users Mailing List' Subject: Missing images style sheet in welcome file Hi, In my web application (using struts), I have login.jsp as welcome file. I've defined the welcome file in web.xml as follows: welcome-file-list welcome-file/jsp/login.jsp/welcome-file /welcome-file-list And in login.jsp, I'm using relative path to load images and style sheet. My directory structure is as follows: ---web | |--css | |--jsp | |--images | |--WEB-INF login.jsp is located in /web/jsp folder. In login.jsp, I'm including style sheet as follows: link href=../css/style.css rel=stylesheet type=text/css ../css/style.css -- the style sheet is located in /web/css folder. Now, when I browse http://localhost:8080/myApp, login.jsp is displayed as welcome page, but the style sheet is not found. Same is the case with images on login.jsp. (this problem is occurring on Linux) But when I use http://localhost:8080/myApp/jsp/login.jsp, then it is displaying everything perfectly. And http://localhost:8080/myApp displays the login page correctly on Windows. Any idea what could be the problem? Sriram
Re: DynaForm Beans and Indexed Text fields.
That's more like it. Are all you fields of type string? Can I see the before and after actions? Cheers MArk On Monday, August 25, 2003, at 02:04 AM, Joel wrote: Okay, so I set the scope of both the preload action, and the action servlet that my form is bieng posted to, to session. I also put the bean in session scope instead of request scope when I preload the DynaForm with values before passing it to the jsp. So The jsp still loads and reders the indexed text fields just fine.. but now I get this exception when I submit the form: java.lang.ClassCastException at org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java: 688) at org.apache.struts.action.RequestProcessor.processActionForm(RequestProc essor.java:359) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java :253) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1420) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:520) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknow n Source) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown Source) at org.apache.catalina.core.StandardWrapperValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardContextValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardContext.invoke(Unknown Source) at org.apache.catalina.core.StandardHostValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invokeNext(Unknown Source) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invokeNext(Unknown Source) at org.apache.catalina.valves.ErrorReportValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardEngineValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:5 94) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process Connection(Http11Protocol.java:392) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:5 65) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPoo l.java:619) at java.lang.Thread.run(Thread.java:534) --- - Apache Tomcat/4.1 - 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]
bnot able to display error messages
Hi I have some problems displaying errors in the jsp page. In the action class, I am have the following code catch (Exception exception) { errors.add(dashboard,new ActionError(dashboard,error fetching dashboard valueobject)); saveErrors(request, errors); forwardValue = mapping.findForward(failure); return forwardValue; } And in the jsp page i am trying to print out the errors by putting html:errors/ tag so that it displays all the errors that are saved.But the page is not displaying any errors. Please help Regds Monojit
Re: How to dynamically decide the properties of the DynaValidator/DynaActionForm
You cant expect struts validator to do all the work, its nice and shows you how to get started. But yes you'd have to use the validator libs and get that running yourself. I wouldn't build a form around the limitations of validator. I'll have to get the time to try this out and iron out the wrinkles. No populating the form in submit i don't think will work as the dynaform need to the size of the property, before the page loads. I'd approach the validator as a separate problem. You'll need to read the commons validator stuff and work that out another day. Validator can be layered on afterwards, and i'd suggest you'll have enough on your hands getting something like this running. Cheers Mark On Monday, August 25, 2003, at 08:29 AM, Adam Hardy wrote: sorry, I meant to say regarding validation, if you try defining 50 form fields in a validation.xml, then you have to have 50 names. You would also have to copy and paste the whole form definition for each form. Sounds less and less like a good idea, if it even works. On 08/25/2003 05:13 AM R Balaji wrote: Mark, This approach looks nice. Did you consider, populating the bean, on form submit ? ... one more thing is.. will the struts-validator go well with this ? R Balaji Mark Lowe wrote: Okay .. I've been thinking about this. I think it might work something like this.. form-property name=beans property=java.util.ArrayList / The arrayList will be a container for your beans with indexed properties. So in jsp we're thinking, or aiming for logic:iterate id=bean name=myForm property=beans bean:write name=bean property=key[%= index %] / html:text name=bean property=value[%= index %] / /logic:iterate So we have a bean thats mapped backed, or something here's some pseudo code. public class MyBean { private Map map; public Object[] getKeys() { return map.keySet().toArray(); } public Object[] getValues() { ArrayList list = new ArrayList(); Object[] keys = getKeys(); for(int i = 0;i keys.length;i++) { String value = map.get(keys[i].toString()); list.add(value); } return list.toArray(); } public String getKey(int i) { return keys[i].toString(); } public String getValue(int i) { String key = getKey(i); return map.get(key); } public void setKey(int i, String str) { keys[i] = str; } public void setValue(int i , String str) { map.put(getKey(i),str); } ... well you get the idea.. Am I tree barking, smoking crack or something but Its starting look possible.. el should help move the scriptlets out, but using indexed, mapped properties looks like it may do the job.. the bean could have a double sided array it returns to keep the keys and values in the correct order. The keys are after all the illusion that the properties have names, when really they are associated via index. When it comes time to write to a db or something the bean could return a map and the key=value pairs should all be there ready. Cheers mark On Saturday, August 23, 2003, at 06:51 PM, Adam Hardy wrote: I read your solution for populating the dynaform. How do you display it in JSP? I mean, how does the JSP know what the field names are? I don't really know the internal workings of the dynavalidator form and how struts would populate the form bean with request parameters. You would probably have to do the same formbean initialization in the bean's reset method, otherwise the request parameters will probably not get saved to it. Once you get that far, then validation becomes an issue. At design time you don't what the fields of a form will be - but do you know how any particular type of field should be validated? If so, how do you know? Is that in the design? Adam On 08/23/2003 05:34 PM R Balaji wrote: Yes, Adam .. this is a valid point , that i need to consider. But, it is almost impossible to define a bean for each type of data, in my application. I need to use the dynabean and dynaclass , some how. I managed to find a solution for populating the bean , now i have to find a solution for validation too. Suggest me a suitable validation approach.. With Regards, R Balaji Adam Hardy wrote: I can see that you could just iterate over the unknown form properties in the JSP, but how would you label them? And when the form is submitted, how would you validate them? I think you would be better advised to add your list of properties as beans to your form. In each bean you could also have a label and a validation. my 2 cents. Adam On 08/23/2003 12:03 PM Mark Lowe wrote: You cant dynamically add properties to DynaActionForms. I'm not sure why you've a problem with just adding the fields to you form bean in struts config. I've demonstrated how to literally do what you want, but you'd have to
Problems with: cannot find bean under name concesiones
I obtain the folowing error to access a my JSP Page. Only if i use Internet Explorer 6.0.2 in Windows XP javax.servlet.jsp.JspException: cannot find bean under name concesiones My JSP: html:select styleClass=formTextoPeq property=concesion onchange=ejecutarAccion('ElegirServicioServicio.do') logic:notPresent name=servicios html:option value=Seleccione Concesion/html:option /logic:notPresent html:options collection=concesiones property=identificador labelProperty=etiqueta/ /html:select /td My ACTION: ArrayList concesiones = new ArrayList(); HttpSession sessionActual = request.getSession(); sessionActual.setAttribute(concesiones,(ArrayList) concesiones); Any solution? Why only in Internet explorer 6, in 5.5 or Netscape 7 works!!
Validator and Dispatch Actions
Hi, I want to use the Struts Validator to do validation. The Same action form is used for SEARCH, CREATE and EDIT. The validation rules for each of them is different( from the other two) How do i go about defining such a config in the validation config file. Appreciate any help. TIA Manglu - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: bnot able to display error messages
hi, pl check.. do u have dashboard defined in the application resources?? do u have the "input" attribute defined for the corresponding action mapping?? -- nagi ---Original Message--- From: Struts Users Mailing List Date: Monday, August 25, 2003 03:16:58 PM To: Struts Users Mailing List Subject: bnot able to display error messages HiI have some problems displaying errors in the jsp page.In the action class, I am have the following codecatch (Exception exception) {errors.add("dashboard",new ActionError("dashboard","errorfetching dashboard valueobject"));saveErrors(request, errors);forwardValue = mapping.findForward("failure");return forwardValue;}And in the jsp page i am trying to print out the errors by puttinghtml:errors/ tag so that it displays all the errors that aresaved.But the page is not displaying any errors.Please helpRegdsMonojit IncrediMail - Email has finally evolved - Click Here
Re: suggestion needed
Hi Raju Can you give me more info on you background, do you already use ant? tomcat or other container? new to jsp/java? 50 years experience as a C programmer but new to struts, you get the idea. It will make a difference as to what's to good example or not. On Monday, August 25, 2003, at 06:59 AM, Raju BSN wrote: Hi, I'm a new bee to struts. I have tried some examples and now I'm able to understand a bit abt the framework, but still not sure of the complete steps needed to develop a web application using struts. It will be a great help for me, if any one of you suggest me a site with good examples. Thanks Regards, Raju BSN, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems with: cannot find bean under name concesiones
So what's you list 'concesiones' full off then? The browser thing looks like a red herring to me. Could also try using request to store the list in just to iron out any potential confusion. ArrayList concesiones = new ArrayList(); Concesion c = new Consesion(); c.setIdentificador(1); c.setEtiqueta(Foo!!); concesiones.add(c); request.setAttribute(concesiones, concesiones.toArray()); Cheers Mark On Monday, August 25, 2003, at 10:31 AM, Federico Real wrote: I obtain the folowing error to access a my JSP Page. Only if i use Internet Explorer 6.0.2 in Windows XP javax.servlet.jsp.JspException: cannot find bean under name concesiones My JSP: html:select styleClass=formTextoPeq property=concesion onchange=ejecutarAccion('ElegirServicioServicio.do') logic:notPresent name=servicios html:option value=Seleccione Concesion/html:option /logic:notPresent html:options collection=concesiones property=identificador labelProperty=etiqueta/ /html:select /td My ACTION: ArrayList concesiones = new ArrayList(); HttpSession sessionActual = request.getSession(); sessionActual.setAttribute(concesiones,(ArrayList) concesiones); Any solution? Why only in Internet explorer 6, in 5.5 or Netscape 7 works!! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems with: cannot find bean under name concesiones
hi, that should possibly be a problem with MS explorer 6.0 session put that in to the request rather than session and try again... u can get the culprit -- nagi ---Original Message--- From: Struts Users Mailing List Date: Monday, August 25, 2003 03:23:38 PM To: [EMAIL PROTECTED] Subject: Problems with: cannot find bean under name concesiones I obtain the folowing error to access a my JSP Page. Only if i use Internet Explorer 6.0.2 in Windows XP"javax.servlet.jsp.JspException: cannot find bean under name concesiones"My JSP:html:select styleClass="formTextoPeq" property="concesion" logic:notPresent name="servicios" html:option value=""Seleccione Concesion/html:option /logic:notPresent html:options collection="concesiones" property="identificador" labelProperty="etiqueta"/ /html:select /tdMy ACTION:ArrayList concesiones = new ArrayList();HttpSession sessionActual = request.getSession();sessionActual.setAttribute("concesiones",(ArrayList) concesiones);Any solution? Why only in Internet explorer 6, in 5.5 or Netscape 7 works!! IncrediMail - Email has finally evolved - Click Here
How to write a validator class
Dear All, I am having an application, in which i want to check whether the userName is existing in the database. For that want to write a validator for checking the userName. The userName value will be obtained from the database. How can I write a validator. Please anyone help me. Rgds, Prabhu - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
sorting using logic:iterate tag
Hi *, Is there any possibility of sorting the data elements in the form bean with all indexed properties in it. I need to display this data using logic:iterate tag. does struts provide any functionality similar to this. The data has to be displayed in html table format, by selecting any column for sort, the other properties need to be ordered according to the sorted column my form bean: public class IterateForm extends ActionForm { private int intIndexed[] ={1,2,3,4,5}; private String strAry[] = { String 0, String 1, String 2, String 3, String 4 }; public String getStringIndexed(int index) { return (strAry[index]); } public String[] getStringIndexed(){ return strAry; } public void setStringIndexed(int index, String value) { strAry[index] = value; } public int getIntIndexed(int index) { return (intIndexed[index]); } public int[] getIntIndexed() { return intIndexed; } public void setIntIndexed(int index, int value){ intIndexed[index] = value; } } Thanks in advance Sch. _ Find an old friend. Revisit your past. http://www.batchmates.com/msn.asp It's never been easier! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Is singleton DAO acceptable? -- Best Practices
Mick, The design pattern doesn't states how DAO's are to be implemented, but rather what problem they are supposed to solve. One reason why you might not want a DAO to be a singleton is if you instantiate one with an Connection. This might be done to avoid having to pass the Connection to each method. I think your implementation is appropriate. It makes sense performance wise and it is also intuitively more OO. Why create a new instance of an object if it does not maintain state? My .02, robert -Original Message- From: news [mailto:[EMAIL PROTECTED] Behalf Of Mick Wever Sent: Sunday, August 24, 2003 12:59 PM To: [EMAIL PROTECTED] Subject: Is singleton DAO acceptable? -- Best Practices All the DAO examples I've read have DaoFactory classes that always return a new DAO instance, and typically the action using it keeps a handle to it for that session. The DAOs that I've created have no state or instance variables, and get their connections from a synchronized pool (and always returning the connection within the same method call). So, since they are multi-threaded, it makes sense to me performance wise it is better for the factory to always return a singleton instance of the DAO. This single instance of the DAO is shared across all sessions in the JVM. (Note this is not the traditional usage of singleton where the singleton itself is responsible for returning the single instance through a static method). My question is, is this such a good idea? Am I missing or misunderstanding something crucial about the DAO Design Pattern? Mick. -- BR/ We all may have come on different ships, but were in the same boat now. Martin Luther King. Jr. BR/ --- a href=http://www.harryspractice.com.auwww.harryspractice.com.au/a --- - 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]
Iterating over session.getAttributeNames
I need to iterate over the enumeration returned by session.getAttributeNames() Any idea to do this ? I don't think that logic:iterate id=currentAttr name=session property=attributeNames ... would work... Thanks Renato P.S.: of course I could use % ... % but I'd prefer not to do so ... Renato Romano Sistemi e Telematica S.p.A. Calata Grazie - Vial Al Molo Giano 16127 - GENOVA e-mail: [EMAIL PROTECTED] Tel.: 010 2712603 _ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: bnot able to display error messages
If you're storing the errors under the key dashboard, you need to extract them with that key, otherwise you need to use Globals. From the Struts RC1 tag (sorry I don't have the Final src handy) protected String name = Globals.ERROR_KEY; Globals.ERROR_KEY is the default key the html:errors/ tag will look under. HTH, Mike Jasnowski -Original Message- From: Monajit Choudhury [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 5:29 AM To: Struts Users Mailing List Subject: bnot able to display error messages Hi I have some problems displaying errors in the jsp page. In the action class, I am have the following code catch (Exception exception) { errors.add(dashboard,new ActionError(dashboard,error fetching dashboard valueobject)); saveErrors(request, errors); forwardValue = mapping.findForward(failure); return forwardValue; } And in the jsp page i am trying to print out the errors by putting html:errors/ tag so that it displays all the errors that are saved.But the page is not displaying any errors. Please help Regds Monojit - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE : Validator and Dispatch Actions
you have to use (Dyna)ValitatorActionForm instead of (Dyna)ValidatorForm. Then in your validation.xml file for each new rule you specify you have to replace the name of the form by the name of the action using the form. And the rule will be applied to the form only if it's called from the action you gave the name. In your case you have to specify 1 form, 3 actions and 3 rules. thomas -Original Message- From: manglu [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2003 1:33 AM To: [EMAIL PROTECTED] Subject: Validator and Dispatch Actions Hi, I want to use the Struts Validator to do validation. The Same action form is used for SEARCH, CREATE and EDIT. The validation rules for each of them is different( from the other two) How do i go about defining such a config in the validation config file. Appreciate any help. TIA Manglu - 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: Iterating over session.getAttributeNames
I'm new to struts, but this is how i did it. id and name are what you assign to the field type is the class type in the vector (enumeration) property the the field in the class defined in type(above) that you now refer to as id and name(above) % Vector suppliers = (Vector) catalogSession.getAttribute(suppliers);% logic:iterate id=s collection=%=suppliers % type=Beans.orgVO bean:write name=s property=orgName filter=true/ br /logic:iterate If there's a better way, I'd like to learn too David -Original Message- From: Renato Romano [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 8:14 AM To: 'Struts Users Mailing List' Subject: Iterating over session.getAttributeNames I need to iterate over the enumeration returned by session.getAttributeNames() Any idea to do this ? I don't think that logic:iterate id=currentAttr name=session property=attributeNames ... would work... Thanks Renato P.S.: of course I could use % ... % but I'd prefer not to do so ... Renato Romano Sistemi e Telematica S.p.A. Calata Grazie - Vial Al Molo Giano 16127 - GENOVA e-mail: [EMAIL PROTECTED] Tel.: 010 2712603 _ - 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: Iterating over session.getAttributeNames
JSTLIYF: c:forEach var=name items=${pageContext.session.attributeNames} c:out value=${name}/ /c:forEach Quoting [EMAIL PROTECTED]: I'm new to struts, but this is how i did it. id and name are what you assign to the field type is the class type in the vector (enumeration) property the the field in the class defined in type(above) that you now refer to as id and name(above) %Vector suppliers = (Vector) catalogSession.getAttribute(suppliers);% logic:iterate id=s collection=%=suppliers % type=Beans.orgVO bean:write name=s property=orgName filter=true/ br /logic:iterate If there's a better way, I'd like to learn too David -Original Message- From: Renato Romano [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 8:14 AM To: 'Struts Users Mailing List' Subject: Iterating over session.getAttributeNames I need to iterate over the enumeration returned by session.getAttributeNames() Any idea to do this ? I don't think that logic:iterate id=currentAttr name=session property=attributeNames ... would work... Thanks Renato P.S.: of course I could use % ... % but I'd prefer not to do so ... Renato Romano Sistemi e Telematica S.p.A. Calata Grazie - Vial Al Molo Giano 16127 - GENOVA e-mail: [EMAIL PROTECTED] Tel.: 010 2712603 _ -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] Tree Stucture in STRUTS
Hi Atta How are u doing? Hope you had a good weekend. I have a new problme now, I would like to know how to use the html:link tag with logic:iterate tag. I tried this way: logic:iterate name=WorkQueueForm property=workQueueArrList indexId=clmIdx id=indexBean type=com.tgt.dist.icl.formbeans.WorkQueueBean td width=55 html:link name=indexBean property=claimId / /td /logic:iterate This does not work, it says key/value pair not found??? Could you please help... Thanks Nick. Raghu -Original Message- From: atta-ur rehman [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 19, 2003 5:56 PM To: Struts Users Mailing List Subject: [OT] Tree Stucture in STRUTS hi all, excuse me if this sounds off topic! can somebody please point to some references on how to incorporate a dynamically built tree-like structure in a struts app? can struts-menu be used for this purpose? any other suggestions? thanks. ATTA - 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: DynaForm Beans and Indexed Text fields.
Mark Lowe wrote: That's more like it. Are all you fields of type string? Can I see the before and after actions? You sure can. The fields inside the PMIRateDTO ( the object that makes up each element of the List ) are all of type String. Here is the before action: /* * PreloadRateEditor.java */ package com.dbo.struts.actions; import java.text.NumberFormat; import java.util.Locale; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.dbo.bd.RateStoreBD; import com.dbo.dto.RateDTO; import com.dbo.struts.forms.RateEditorForm; 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.action.DynaActionForm; /** * Struts Action to Load current rates from xml, then preload a Struts Form Bean before sending request * to RateEditor.jsp to be displayed. * * === XDoclet Configuration Tags === * * @struts.action * name=persistRateInfo * path=/preloadRateEditor * scope=session * input=RateEditor.jsp * validate=false * parameter= * * @struts.action-forward * name=failure * path=/main.jsp * * @struts.action-forward * name=success * path=/RateEditor.jsp * * */ public class PreloadRateEditorAction extends Action { // Obtain log instance for logging. private Log log = LogFactory.getLog( this.getClass( ) ); /* Our implementation of Action.execute(); */ public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { log.debug( PreloadRateEditorAction.execute() called. ); /* Grab an instance of RateStoreBD() to retrieve the current rates */ RateStoreBD store = new RateStoreBD(); /* Load the rates from storage */ RateDTO currentRates = store.loadRates(); // debug info log.debug( RateDTO retrieved from storage: + currentRates ); /* Here we cast the form we were passed into an instance of DynaActionForm, for easier * manipulation. */ DynaActionForm loadForm = (DynaActionForm) form; /* Obtain instance of Locale for use in NumberFormat. Used to format our doubles to strings */ Locale loc = Locale.US; NumberFormat fmt = NumberFormat.getInstance(loc); //get information from rates DTO and populate the form bean with them. loadForm.set( hazardInsRate, fmt.format( currentRates.getHazardInsRate() ) ); loadForm.set( dealOneIR, fmt.format( currentRates.getDealOneIR( ) ) ); loadForm.set( dealOneTerm, Integer.toString( currentRates.getDealOneTerm( ) ) ); loadForm.set( dealOnePercentageDown, fmt.format( currentRates.getDealOnePercentageDown() ) ); loadForm.set( dealTwoIR, fmt.format( currentRates.getDealTwoIR( ) ) ); loadForm.set( dealTwoTerm, Integer.toString(currentRates.getDealTwoTerm( ) ) ); loadForm.set( dealTwoPercentageDown, fmt.format( currentRates.getDealTwoPercentageDown() ) ); loadForm.set( dealThreeIR, fmt.format( currentRates.getDealThreeIR( ) ) ); loadForm.set(dealThreeTerm, Integer.toString(currentRates.getDealThreeTerm( ) ) ); loadForm.set( dealThreePercentageDown, fmt.format( currentRates.getDealThreePercentageDown() ) ); loadForm.set( pmiRanges, currentRates.getPmiRanges() ); /* Store the form bean in request scope so that the html custom taglib can access it */ //request.setAttribute( persistRateInfo, currentRates ); request.getSession().setAttribute( persistRateInfo, currentRates ); /* set the forward to be successful */ String myForward = success; /* return forward */ return mapping.findForward( myForward ); } } Here is the action that the form is posted to: /* * PersistRateInfo.java */ package com.dbo.struts.actions; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.dbo.bd.RateStoreBD; import com.dbo.dto.RateDTO; import com.dbo.struts.forms.RateEditorForm; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; 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.action.DynaActionForm; /** * Action which obtains an instance of RateStoreBD() and saves an instance of the current mortgage rates * for use in the application. * * === XDoclet Struts Action Config Tags === * * @struts.action *
multilingual app
hi all, I'm trying to build a multilingual application with struts. I have created 4 messages ressources named AppResources_fr.properties AppResources_uk.properties AppResources_de.properties AppResources.properties One file per country and the default(AppResources) for unknown user local. those file will be configured in the struts-config.xml file with a specific key for each. depending on user local, I would like to tell to the framework to load the corresponding Resource file. I have two questions about that : 1 : how could I tell to the framework to load resource file depending on the user local 2 : if I want to display values, could I use the bean write tag. 3 : for data comming from database, what is the best pratice to perfom the same thing. any suggestion would be greetly appreciated. Meissa L'integrite de ce message n'etant pas assuree sur internet, Natexis Banques Populaires ne peut etre tenu responsable de son contenu. Toute utilisation ou diffusion non autorisee est interdite. Si vous n'etes pas destinataire de ce message, merci de le detruire et d'avertir l'expediteur. The integrity of this message cannot be guaranteed on the Internet. Natexis Banques Populaires can not therefore be considered responsible for the contents.Any unauthorized use or dissemination is prohibited. If you are not the intended recipient of this message, then please delete it and notify the sender.
Struts as a framework
Hi This is a general question to understand Struts better. Is Struts a black-box or a gray-box framework ? Mohan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RE : Validator and Dispatch Actions
This being the case, say you had a situation where your form had a few fields that would be disabled/not displayed if a user didnt have a certain access level. If you wanted 2 separate validation schemes for this form (one that has all fields being validated, one that has all fields except for the disabled/not shown fields being validated) then you would need 2 action classes (or 2 dispatch methods in the case below)? If the actions will be executing similar, if not identical code based on the fields submitted, this seems like an awful lot of rework just to get the validation accomplished. From: thomas Sontheimer [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE : Validator and Dispatch Actions Date: Mon, 25 Aug 2003 15:21:47 +0200 you have to use (Dyna)ValitatorActionForm instead of (Dyna)ValidatorForm. Then in your validation.xml file for each new rule you specify you have to replace the name of the form by the name of the action using the form. And the rule will be applied to the form only if it's called from the action you gave the name. In your case you have to specify 1 form, 3 actions and 3 rules. thomas -Original Message- From: manglu [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2003 1:33 AM To: [EMAIL PROTECTED] Subject: Validator and Dispatch Actions Hi, I want to use the Struts Validator to do validation. The Same action form is used for SEARCH, CREATE and EDIT. The validation rules for each of them is different( from the other two) How do i go about defining such a config in the validation config file. Appreciate any help. TIA Manglu - 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] _ MSN 8: Get 6 months for $9.95/month http://join.msn.com/?page=dept/dialup - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DynaForm Beans and Indexed Text fields.
it should work with just.. form-property name=pmiRanges type=java.util.ArrayList / theForm.set(pmiRanges, (ArrayList) currentRates.getPmiRanges()); You dont need session.setAttribute.. and this can lead to you thinking that's life's great when its not.. and then ... ArrayList rateList = (ArrayList) theForm.get(pmiRanges); rates.setPmiRanges((List) rateList); I've been doing this okay using ArrayList so you could try that.I guess the class cast exception make have been thrown when you tried seting pmiRanges with an Object rather than list its stored as an object like with so many things in java. Cheers Mark On Monday, August 25, 2003, at 03:26 PM, Joel Wickard wrote: Mark Lowe wrote: That's more like it. Are all you fields of type string? Can I see the before and after actions? You sure can. The fields inside the PMIRateDTO ( the object that makes up each element of the List ) are all of type String. Here is the before action: /* * PreloadRateEditor.java */ package com.dbo.struts.actions; import java.text.NumberFormat; import java.util.Locale; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.dbo.bd.RateStoreBD; import com.dbo.dto.RateDTO; import com.dbo.struts.forms.RateEditorForm; 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.action.DynaActionForm; /** * Struts Action to Load current rates from xml, then preload a Struts Form Bean before sending request * to RateEditor.jsp to be displayed. * * === XDoclet Configuration Tags === * * @struts.action * name=persistRateInfo * path=/preloadRateEditor * scope=session * input=RateEditor.jsp * validate=false * parameter= * * @struts.action-forward * name=failure * path=/main.jsp * * @struts.action-forward * name=success * path=/RateEditor.jsp * * */ public class PreloadRateEditorAction extends Action { // Obtain log instance for logging. private Log log = LogFactory.getLog( this.getClass( ) ); /* Our implementation of Action.execute(); */ public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { log.debug( PreloadRateEditorAction.execute() called. ); /* Grab an instance of RateStoreBD() to retrieve the current rates */ RateStoreBD store = new RateStoreBD(); /* Load the rates from storage */ RateDTO currentRates = store.loadRates(); // debug info log.debug( RateDTO retrieved from storage: + currentRates ); /* Here we cast the form we were passed into an instance of DynaActionForm, for easier * manipulation. */ DynaActionForm loadForm = (DynaActionForm) form; /* Obtain instance of Locale for use in NumberFormat. Used to format our doubles to strings */ Locale loc = Locale.US; NumberFormat fmt = NumberFormat.getInstance(loc); //get information from rates DTO and populate the form bean with them. loadForm.set( hazardInsRate, fmt.format( currentRates.getHazardInsRate() ) ); loadForm.set( dealOneIR, fmt.format( currentRates.getDealOneIR( ) ) ); loadForm.set( dealOneTerm, Integer.toString( currentRates.getDealOneTerm( ) ) ); loadForm.set( dealOnePercentageDown, fmt.format( currentRates.getDealOnePercentageDown() ) ); loadForm.set( dealTwoIR, fmt.format( currentRates.getDealTwoIR( ) ) ); loadForm.set( dealTwoTerm, Integer.toString(currentRates.getDealTwoTerm( ) ) ); loadForm.set( dealTwoPercentageDown, fmt.format( currentRates.getDealTwoPercentageDown() ) ); loadForm.set( dealThreeIR, fmt.format( currentRates.getDealThreeIR( ) ) ); loadForm.set(dealThreeTerm, Integer.toString(currentRates.getDealThreeTerm( ) ) ); loadForm.set( dealThreePercentageDown, fmt.format( currentRates.getDealThreePercentageDown() ) ); loadForm.set( pmiRanges, currentRates.getPmiRanges() ); /* Store the form bean in request scope so that the html custom taglib can access it */ //request.setAttribute( persistRateInfo, currentRates ); request.getSession().setAttribute( persistRateInfo, currentRates ); /* set the forward to be successful */ String myForward = success; /* return forward */ return mapping.findForward( myForward ); } } Here is the action that the form is posted to: /* * PersistRateInfo.java */ package com.dbo.struts.actions; import
Re: ActionForm null after context restart?
Howdy ya'll, I posted this Friday but no one's biting so far... Has anyone had problems with session-scoped ActionForms being null after (de)Serialization (context restart). I have confirmed that running myForm.reset(...) on my ActionForm after restart throws a NullPointerException via debugging filter I've got set up. As soon as I try to request either action that utilizes the ActionForm, I get problems. If I request the forward action (which just forwards to the jsp with form tags), I get this: begin log javax.servlet.ServletException: Exception thrown by getter for property applicationDateMin of bean org.apache.struts.taglib.html.BEAN end log applictionDateMin is the FIRST form element in my jsp. Suspicious? If I request the action that processes the submitted form, I get this: begin log java.lang.NullPointerException at com.amfllc.web.forms.SearchPipelineActionForm.reset(Unknown Source) end log Please see below for further details. Thank you for any help. -Sasha On 8/22/03 17:54, Sasha Borodin [EMAIL PROTECTED] wrote: I've been beating my head against this for a couple of days now, if someone can help me out, that would really make my weekend :-) I am having a problem with an ActionForm after restarting the context. Here's some details: 1. I have a jsp with struts form tags. 2. This form has an ActionForm associated with it. 3. One forward action that takes you to the jsp. 4. One custom action that processes the submission of this form (has action form declared in action-mapping in struts-config.xml) If I have a fresh session, and play around, the ActionForm is bound to the session as an attribute. Everything works fine. If I reload the context, everything appears to get Serialized successfully (I get no exceptions anywhere, there's a SESSIONS.ser file created in the work dir). If I check the session after reload, my ActionForm is once again listed as one of the attributes. -BUT- As soon as I try to request either action that utilizes the ActionForm, I get problems. If I request the forward action (which just forwards to the jsp with form tags), I get this: begin log javax.servlet.ServletException: Exception thrown by getter for property applicationDateMin of bean org.apache.struts.taglib.html.BEAN end log applictionDateMin is the FIRST form element in my jsp. Suspicious? If I request the action that processes the submitted form, I get this: begin log java.lang.NullPointerException at com.amfllc.web.forms.SearchPipelineActionForm.reset(Unknown Source) end log To a newbie like me, it looks like Struts wants to use the ActionForm bound to the session, but it's null after context restart for some reason. I've got a debugging filter set up that does some logging of request and session properties - that's how I know that the form is there in session. I've even gone as far as to check it for being null - it appears not to be == null. I've marked all the usual suspects transient (logger, etc.). What am I missing here? Thanks so much for any help. -Sasha - 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: Struts as a framework
Struts is a *very* configurable framework. However, it's not a solution for everything, and it doesn't claim to be. FYI: The documentation generally answers these types of questions. -Original Message- From: Mohan Radhakrishnan [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 10:37 AM To: 'Struts Users Mailing List' Subject: Struts as a framework Hi This is a general question to understand Struts better. Is Struts a black-box or a gray-box framework ? Mohan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is singleton DAO acceptable? -- Best Practices
Hi Mick, I like your implementation od DAO , Can you send me a example for this? I would like use it. Fede - Original Message - From: Robert Taylor [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, August 25, 2003 3:07 PM Subject: RE: Is singleton DAO acceptable? -- Best Practices Mick, The design pattern doesn't states how DAO's are to be implemented, but rather what problem they are supposed to solve. One reason why you might not want a DAO to be a singleton is if you instantiate one with an Connection. This might be done to avoid having to pass the Connection to each method. I think your implementation is appropriate. It makes sense performance wise and it is also intuitively more OO. Why create a new instance of an object if it does not maintain state? My .02, robert -Original Message- From: news [mailto:[EMAIL PROTECTED] Behalf Of Mick Wever Sent: Sunday, August 24, 2003 12:59 PM To: [EMAIL PROTECTED] Subject: Is singleton DAO acceptable? -- Best Practices All the DAO examples I've read have DaoFactory classes that always return a new DAO instance, and typically the action using it keeps a handle to it for that session. The DAOs that I've created have no state or instance variables, and get their connections from a synchronized pool (and always returning the connection within the same method call). So, since they are multi-threaded, it makes sense to me performance wise it is better for the factory to always return a singleton instance of the DAO. This single instance of the DAO is shared across all sessions in the JVM. (Note this is not the traditional usage of singleton where the singleton itself is responsible for returning the single instance through a static method). My question is, is this such a good idea? Am I missing or misunderstanding something crucial about the DAO Design Pattern? Mick. -- BR/ We all may have come on different ships, but were in the same boat now. Martin Luther King. Jr. BR/ --- a href=http://www.harryspractice.com.auwww.harryspractice.com.au/a --- - 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: How to write a validator class
The validator framework is more for ensuring that the user supplies a value for the username and password. After they've successfully entered fields, it is then up to you to authenticate them against the database using whatever means you see fit. -jeff On Monday, August 25, 2003, at 05:10 AM, K.M.Prabhu wrote: Dear All, I am having an application, in which i want to check whether the userName is existing in the database. For that want to write a validator for checking the userName. The userName value will be obtained from the database. How can I write a validator. Please anyone help me. Rgds, Prabhu - 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]
[ANN] Model-driven Development for Struts/EJB
August 25, 2003 Alpharetta, GA - Metanology releases new Model-driven Development Environment (MDE) products Overview: MDE is a full featured, model-driven development environment that includes a UML modeler and MetaProgramTM editor that integrates with a Java IDE. MDE transforms a simple UML model of an application into the majority of the implementation by executing MetaPrograms. Applications are completed using traditional development techniques. MDE for EJB and MDE for J2EE enhance the company's existing MDE for Struts. MDE for EJB creates session beans, entity beans, message driven beans, business objects and value objects from simple UML models. MDE for J2EE enhances MDE for Struts and MDE for EJB by interfacing the Struts user interface to EJB services. Platform Independent Modeling Typical modeling techniques require a class for each element in the implementation resulting in complex models that are difficult to understand and maintain. MDE promotes modeling what the application does, not how it is built, making modeling fast, easy, and reusable across platforms. MetaPrograms A combination of Java and JSP-style syntax, MetaPrograms are easy to write, contain all the technical details of architecture, and create multiple files in the implementation from a single class in the model. MetaProgramming with MDE gives you complete control of how the model is turned into code. Rather than writing all the code by hand, MetaProgramming let's you write the code that writes the code.TM MDE Life Cycle Life cycle benefits are two fold. First, life cycle tools preserve your hand-written code from one generation to the next. Second, they replace existing MetaProgram generated code with updated MetaProgram code. Used to its fullest, MDE is ideal for iterative and incremental development methods, Agile and Extreme Programming. Learn more and download a free evaluation at www.metanology.com. Todd Fuller Metanology Corporation 4625 Alexander Dr., Ste 105 Alpharetta, GA 30022 770.475.1301 Office 404.561.0294 Cell www.metanology.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE : RE : Validator and Dispatch Actions
you don't need 2 action classes. you may declare 2 actions in the struts-config.xml file using the same class. but you have to declare 2 formset tags in the validation.xml file, setting up each form name with the action path instead of the form name. in the first formset tag you define validation rules for all the fields and in the second you do it only for a part of them. using the first action will validate all the fields and using the second will validate only a part of them. thomas -Original Message- From: Trent Fisher [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 4:05 PM To: [EMAIL PROTECTED] Subject: Re: RE : Validator and Dispatch Actions This being the case, say you had a situation where your form had a few fields that would be disabled/not displayed if a user didnt have a certain access level. If you wanted 2 separate validation schemes for this form (one that has all fields being validated, one that has all fields except for the disabled/not shown fields being validated) then you would need 2 action classes (or 2 dispatch methods in the case below)? If the actions will be executing similar, if not identical code based on the fields submitted, this seems like an awful lot of rework just to get the validation accomplished. From: thomas Sontheimer [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE : Validator and Dispatch Actions Date: Mon, 25 Aug 2003 15:21:47 +0200 you have to use (Dyna)ValitatorActionForm instead of (Dyna)ValidatorForm. Then in your validation.xml file for each new rule you specify you have to replace the name of the form by the name of the action using the form. And the rule will be applied to the form only if it's called from the action you gave the name. In your case you have to specify 1 form, 3 actions and 3 rules. thomas -Original Message- From: manglu [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2003 1:33 AM To: [EMAIL PROTECTED] Subject: Validator and Dispatch Actions Hi, I want to use the Struts Validator to do validation. The Same action form is used for SEARCH, CREATE and EDIT. The validation rules for each of them is different( from the other two) How do i go about defining such a config in the validation config file. Appreciate any help. TIA Manglu - 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] _ MSN 8: Get 6 months for $9.95/month http://join.msn.com/?page=dept/dialup - 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: suggestion needed
Have you try Ted's website? http://husted.com/struts/index.html -Original Message- From: Raju BSN [mailto:[EMAIL PROTECTED] Sent: Sunday, August 24, 2003 11:00 PM To: Struts Users Mailing List Subject: suggestion needed Hi, I'm a new bee to struts. I have tried some examples and now I'm able to understand a bit abt the framework, but still not sure of the complete steps needed to develop a web application using struts. It will be a great help for me, if any one of you suggest me a site with good examples. Thanks Regards, Raju BSN, This message and any attachments are for the intended recipient(s) only and may contain privileged, confidential and/or proprietary information about Downey Savings or its customers, which Downey Savings does not intend to disclose to the public. If you received this message by mistake, please notify the sender by reply e-mail and delete the message and attachments. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Design question
Hi, We are developing a application which will have number of create screens, as follows : Create Technology screen, Create Project screen, Create user screen. etc Each screen will have a asssociated formbean as follows. TechnologyForm for Create Technology screen ProjectForm for Create Project screen, UserForm for Create user screen etc. Each form will have the object of underlying dataobject, and each form will have a method getDataObject. e.g. Techonology form contains . . . . . private TechDBO tech; # TechDBO is underlying dataobject. . . . . TechDBO getDataObject(){ return this.tech; } . . . . execute method will have more or less same code as . . . dblayer.create(form.getDataObject()); . . . . So I am planning to club all the create in one action class and forward to appropriate jsp as per some parameter by in formbean. my struts-config.xml will be something like this. action path=/create type=CreateAction name= ??? input= ??? forward name=Tech path=successtech.jsp / forward name=user path=successuser.jsp / forward name=project path=successproject.jsp / Now my questions are : 1 I am doing write something wrong. 2 Validation errors are to be send to called jsp. Like validation error for create user has to be send to create user jsp, for that i need to dynamically change the value of input in my action mapping, how to do this. 3 Since the form beans are different for each jsp can i dynamically change the formbean of the actionmapping 4 can you suggest some alternate method so that i can not have to do copy past of my code in execute method of action class. TIA Deepak. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to write a validator class
Thanks jeff. Jeff Kyser wrote: The validator framework is more for ensuring that the user supplies a value for the username and password. After they've successfully entered fields, it is then up to you to authenticate them against the database using whatever means you see fit. -jeff On Monday, August 25, 2003, at 05:10 AM, K.M.Prabhu wrote: Dear All, I am having an application, in which i want to check whether the userName is existing in the database. For that want to write a validator for checking the userName. The userName value will be obtained from the database. How can I write a validator. Please anyone help me. Rgds, Prabhu - 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: Struts as a framework
Struts is an open-box framework, but not a out-of-box solution :-) Jing Netspread Carrier http://www.netspread.com - Original Message - From: Bradley Handy [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Monday, August 25, 2003 10:00 AM Subject: RE: Struts as a framework Struts is a *very* configurable framework. However, it's not a solution for everything, and it doesn't claim to be. FYI: The documentation generally answers these types of questions. -Original Message- From: Mohan Radhakrishnan [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 10:37 AM To: 'Struts Users Mailing List' Subject: Struts as a framework Hi This is a general question to understand Struts better. Is Struts a black-box or a gray-box framework ? Mohan - 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: multilingual app
If you use *_EN.properties test.string = hello!! *_FR.properties test.string = allo!! rather than lower case will work out the box, no need to specify in struts-config just in web.xml as you perhaps have done already. The internationalization is built in. Try it out by changing your browser locale.. bean:message key=test.string / Tiles defs have similar functionality. I'll leave the question on the model to someone else.. Cheers Mark On Monday, August 25, 2003, at 03:00 PM, [EMAIL PROTECTED] wrote: hi all, I'm trying to build a multilingual application with struts. I have created 4 messages ressources named AppResources_fr.properties AppResources_uk.properties AppResources_de.properties AppResources.properties One file per country and the default(AppResources) for unknown user local. those file will be configured in the struts-config.xml file with a specific key for each. depending on user local, I would like to tell to the framework to load the corresponding Resource file. I have two questions about that : 1 : how could I tell to the framework to load resource file depending on the user local 2 : if I want to display values, could I use the bean write tag. 3 : for data comming from database, what is the best pratice to perfom the same thing. any suggestion would be greetly appreciated. Meissa L'integrite de ce message n'etant pas assuree sur internet, Natexis Banques Populaires ne peut etre tenu responsable de son contenu. Toute utilisation ou diffusion non autorisee est interdite. Si vous n'etes pas destinataire de ce message, merci de le detruire et d'avertir l'expediteur. The integrity of this message cannot be guaranteed on the Internet. Natexis Banques Populaires can not therefore be considered responsible for the contents.Any unauthorized use or dissemination is prohibited. If you are not the intended recipient of this message, then please delete it and notify the sender. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Validator JavaScript and html:radio buttons
Hi all. I have two radio buttons on a page, one both named outcome one with the value of Accepted and one with the value of Rejected. In my validation.xml file, I say that outcome is required. The Javascript checking generated by the Validator framework doesn't give an error if neither on is selected, however the backend will, and produce an error I can see with the html:errors tag. How do I get the javascript to check the radio buttons to make sure one is selected? __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validator JavaScript and html:radio buttons
The Javascript checking generated by the Validator framework doesn't give an error if neither on is selected, however the backend will, and produce an error I can see with the html:errors tag. IIRC, it's invalid HTML unless exactly one of the radio button options is selected. In your case I'd pre-select whichever value makes sense and expect the user to change it if they don't like that choice. No idea about the JavaScript though, sorry! -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University, PA, IRM
RE: Struts as a framework
For those of us who think outside the box could you elaborate on what you are asking? My copy of struts was downloaded from the internet, it came with no box ;) -Original Message- From: Mohan Radhakrishnan [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 10:37 AM To: 'Struts Users Mailing List' Subject: Struts as a framework Hi This is a general question to understand Struts better. Is Struts a black-box or a gray-box framework ? Mohan This message and its contents (to include attachments) are the property of Kmart Corporation (Kmart) and may contain confidential and proprietary information. You are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on information contained herein is strictly prohibited. Unauthorized use of information contained herein may subject you to civil and criminal prosecution and penalties. If you are not the intended recipient, you should delete this message immediately. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [ANN] Model-driven Development for Struts/EJB
Cool! I receive email in plain text, so the Platform Independent, MetaPrograms, and Life Cycle weren't distinguished from the rest of their paragraphs, so it reads funny. It's probably better to use a separate line as a heading in the future, similar to the Overview, but without the colon. Dave -Original Message- From: Todd Fuller [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 11:12 AM To: [EMAIL PROTECTED] Subject: [ANN] Model-driven Development for Struts/EJB August 25, 2003 Alpharetta, GA - Metanology releases new Model-driven Development Environment (MDE) products Overview: MDE is a full featured, model-driven development environment that includes a UML modeler and MetaProgramTM editor that integrates with a Java IDE. MDE transforms a simple UML model of an application into the majority of the implementation by executing MetaPrograms. Applications are completed using traditional development techniques. MDE for EJB and MDE for J2EE enhance the company's existing MDE for Struts. MDE for EJB creates session beans, entity beans, message driven beans, business objects and value objects from simple UML models. MDE for J2EE enhances MDE for Struts and MDE for EJB by interfacing the Struts user interface to EJB services. Platform Independent Modeling Typical modeling techniques require a class for each element in the implementation resulting in complex models that are difficult to understand and maintain. MDE promotes modeling what the application does, not how it is built, making modeling fast, easy, and reusable across platforms. MetaPrograms A combination of Java and JSP-style syntax, MetaPrograms are easy to write, contain all the technical details of architecture, and create multiple files in the implementation from a single class in the model. MetaProgramming with MDE gives you complete control of how the model is turned into code. Rather than writing all the code by hand, MetaProgramming let's you write the code that writes the code.TM MDE Life Cycle Life cycle benefits are two fold. First, life cycle tools preserve your hand-written code from one generation to the next. Second, they replace existing MetaProgram generated code with updated MetaProgram code. Used to its fullest, MDE is ideal for iterative and incremental development methods, Agile and Extreme Programming. Learn more and download a free evaluation at www.metanology.com. Todd Fuller Metanology Corporation 4625 Alexander Dr., Ste 105 Alpharetta, GA 30022 770.475.1301 Office 404.561.0294 Cell www.metanology.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
validator returns blank page
I'm attempting to use the validator with a DynaValidatorForm and it returns a blank page if I don't fill the field. And if I fill the username field I'm redirected to the good page (/index.jsp). any idea? thomas here are some parts from my code: struts-config.xml: form-bean name=logonForm type=org.apache.struts.validator.DynaValidatorForm form-property name=username type=java.lang.String/ form-property name=password type=java.lang.String/ /form-bean actionpath=/logon/action/logon type=test.web.struts.action.logon.LogonAction name=logonForm scope=session input=/WEB-INF/jsp/logon/logon.jsp forward name=success path=/index.jsp/ /action validation.xml: formset form name=logonForm field property=username depends=required arg0 key=logon.data.username/ /field /form /formset logon.jsp: body html:errors/ html:form action=/logon/action/logon.do focus=username table border=0 width=100% tr th align=right Username: /th td align=left html:text property=username/ /td /tr tr th align=right Password: /th td align=left html:password property=password/ /td /tr tr td align=right html:submit property=submit value=Submit/ /td td align=left html:reset/ /td /tr /table /html:form /body - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles Definition problem
Thanks to everyone who responded. Everyone recommended doing this: Try this: forward name=defaulttile redirect=true path=default.layout/ Still doesn't seem to work. I get the feeling I'm missing something so insanely stupid that its tough to figure out. I'm not sure how to get any more debug information. The only thing I'm getting on the console that looks like its Struts related are these lines: Aug 25, 2003 1:32:08 PM org.apache.struts.util.PropertyMessageResources init INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true Aug 25, 2003 1:32:09 PM org.apache.struts.util.PropertyMessageResources init INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true Aug 25, 2003 1:32:10 PM org.apache.struts.util.PropertyMessageResources init INFO: Initializing, config='resources.application', returnNull=true Aug 25, 2003 1:32:10 PM org.apache.struts.tiles.TilesPlugin init INFO: Tiles definition factory loaded for module ''. Aug 25, 2003 1:32:11 PM org.apache.struts.validator.ValidatorPlugIn initResources INFO: Loading validation rules file from '/WEB-INF/validator-rules.xml' Aug 25, 2003 1:32:11 PM org.apache.struts.validator.ValidatorPlugIn initResources INFO: Loading validation rules file from '/WEB-INF/validation.xml' Aug 25, 2003 1:32:12 PM org.apache.coyote.http11.Http11Protocol start INFO: Starting Coyote HTTP/1.1 on port 8080 Aug 25, 2003 1:32:13 PM org.apache.jk.common.ChannelSocket init INFO: JK2: ajp13 listening on /0.0.0.0:8009 Aug 25, 2003 1:32:13 PM org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=30/331 config=C:\jtools\jakarta\jakarta-tomcat-4.1.2\conf\jk2.properties Aug 25, 2003 1:33:01 PM org.apache.struts.util.PropertyMessageResources init INFO: Initializing, config='org.apache.struts.taglib.logic.LocalStrings', returnNull=true I don't know if any of this will point to problems or not. Instead of reposting all my code again, It can be downloaded here: http://www.berzerker-soft.com/testtiles.zip here's the content of my previous email, in case you don't want to download. Thanks in advance... /WEB-INF/tiles-def.xml ?xml version=1.0 encoding=UTF-8? !DOCTYPE tiles-definitions PUBLIC -//Apache Software Foundation//DTD Tiles Configuration//EN http://jakarta.apache.org/struts/dtds/tiles-config.dtd; tiles-definitions definition name=default.layout path=/templates/defaultLayout.jsp put name=title value=Default Title/ put name=header value=/common/header.jsp/ put name=menubar value=/common/menubar.jsp/ put name=body-content value=/common/body-content.jsp/ put name=footer value=/common/footer.jsp/ /definition /tiles-definitions - /WEB-INF/struts-config.xml -- ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.1//EN http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd; struts-config form-beans/ global-exceptions/ global-forwards forward name=defaulttile redirect=true path=default.layout/ /global-forwards action-mappings /action-mappings controller processorClass=org.apache.struts.tiles.TilesRequestProcessor/ message-resources parameter=resources.application/ plug-in className=org.apache.struts.tiles.TilesPlugin set-property property=definitions-config value=/WEB-INF/tiles-defs.xml/ set-property property=definitions-debug value=2 / set-property property=moduleAware value=true/ set-property property=definitions-parser-validate value=true/ /plug-in plug-in className=org.apache.struts.validator.ValidatorPlugIn set-property property=pathnames value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/ /plug-in /struts-config index.jsp %@ taglib uri=/tags/struts-logic prefix=logic % logic:redirect forward=defaulttile/ -- Bryce Fischer [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: validator returns blank page
Hi Thomas Here what I would do. struts-config.xml: actionpath=/logon/action/logon type=test.web.struts.action.logon.LogonAction name=logonForm scope=request-- !!! validate=false -- !!! input=/WEB-INF/jsp/logon/logon.jsp forward name=success path=/index.jsp/ /action LogonAction.java: ActionErrors errors = new ActionErrors(); errors = form.validate(mapping, request); // Report any errors we have discovered back to the original form if (!errors.isEmpty()) { saveErrors(request, errors); return new ActionForward(mapping.getInput()); } And be sure that your Class extends DynaValidatorForm. Hope this helps Koni thomas Sontheimer wrote: I'm attempting to use the validator with a DynaValidatorForm and it returns a blank page if I don't fill the field. And if I fill the username field I'm redirected to the good page (/index.jsp). any idea? thomas here are some parts from my code: struts-config.xml: form-bean name=logonForm type=org.apache.struts.validator.DynaValidatorForm form-property name=username type=java.lang.String/ form-property name=password type=java.lang.String/ /form-bean actionpath=/logon/action/logon type=test.web.struts.action.logon.LogonAction name=logonForm scope=session input=/WEB-INF/jsp/logon/logon.jsp forward name=success path=/index.jsp/ /action validation.xml: formset form name=logonForm field property=username depends=required arg0 key=logon.data.username/ /field /form /formset logon.jsp: body html:errors/ html:form action=/logon/action/logon.do focus=username table border=0 width=100% tr th align=right Username: /th td align=left html:text property=username/ /td /tr tr th align=right Password: /th td align=left html:password property=password/ /td /tr tr td align=right html:submit property=submit value=Submit/ /td td align=left html:reset/ /td /tr /table /html:form /body - 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]
Probs migrating custom ActionMapping from 1.0.2 to 1.1
Ladies and gents, Having an issue with migrating our application over from 1.0.2 to 1.1. Specifically, we have a problem in the following line from our ActionServlet: ModuleConfig modCfg = RequestUtils.getModuleConfig(request, getServletContext()); SecureActionMapping secAMapping = (SecureActionMapping) modCfg.findActionConfig(path); The second line gives a ClassCastException whenever a request is made. The hierarchy for SecureActionMapping is: ActionConfig +- ActionMapping +- SecureActionConfig +- PackagingActionMapping +- SecureActionMapping Further, the mapping init-param in web.xml points to this SecureActionMapping class. The class type being returned by the findActionConfig(String) method is ActionConfig, although the servlet appears to be configuring itself properly during the initModuleConfig(String, String) method of ActionServlet. So my question is this: Is there a different mechanism for specifying the default ActionMapping class than doing so in web.xml? Thanks in advance, -= James - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Probs migrating custom ActionMapping from 1.0.2 to 1.1
For 1.1, I believe you'd use: action-mappings type=pkg.SecureActionMapping action .../ ... /action-mappings The mapping init-parameter is deprecated in 1.1. You could also customize the actions on an individual basis with: action-mappings action className=pkg.SecureActionMapping .../ ... /action-mappings Quoting James Childers [EMAIL PROTECTED]: Ladies and gents, Having an issue with migrating our application over from 1.0.2 to 1.1. Specifically, we have a problem in the following line from our ActionServlet: ModuleConfig modCfg = RequestUtils.getModuleConfig(request, getServletContext()); SecureActionMapping secAMapping = (SecureActionMapping) modCfg.findActionConfig(path); The second line gives a ClassCastException whenever a request is made. The hierarchy for SecureActionMapping is: ActionConfig +- ActionMapping +- SecureActionConfig +- PackagingActionMapping +- SecureActionMapping Further, the mapping init-param in web.xml points to this SecureActionMapping class. The class type being returned by the findActionConfig(String) method is ActionConfig, although the servlet appears to be configuring itself properly during the initModuleConfig(String, String) method of ActionServlet. So my question is this: Is there a different mechanism for specifying the default ActionMapping class than doing so in web.xml? Thanks in advance, -= James -- Kris Schneider mailto:[EMAIL PROTECTED] D.O.Tech http://www.dotech.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Checkboxes
Hi, I have the following problem: I have a list of 71 Checkboxes and want to have one checkbox to select all of them at once. This works fine but I cannot uncheck this checkbox if it was checked once in order to uncheck all other checkboxes. Can anybody help me on this. Any code samples would be very helpful. Thanks in advance, Filip - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionForm null after context restart?
If it works okay after restart rather than just reload, i'd suggest it would be the container not maintaining sessions across reloads. And that I guess would be the nature of your question. I know that tc 4.127 has this as a fix from 4.124. Cheers Mark On Monday, August 25, 2003, at 03:53 PM, Sasha Borodin wrote: Howdy ya'll, I posted this Friday but no one's biting so far... Has anyone had problems with session-scoped ActionForms being null after (de)Serialization (context restart). I have confirmed that running myForm.reset(...) on my ActionForm after restart throws a NullPointerException via debugging filter I've got set up. As soon as I try to request either action that utilizes the ActionForm, I get problems. If I request the forward action (which just forwards to the jsp with form tags), I get this: begin log javax.servlet.ServletException: Exception thrown by getter for property applicationDateMin of bean org.apache.struts.taglib.html.BEAN end log applictionDateMin is the FIRST form element in my jsp. Suspicious? If I request the action that processes the submitted form, I get this: begin log java.lang.NullPointerException at com.amfllc.web.forms.SearchPipelineActionForm.reset(Unknown Source) end log Please see below for further details. Thank you for any help. -Sasha On 8/22/03 17:54, Sasha Borodin [EMAIL PROTECTED] wrote: I've been beating my head against this for a couple of days now, if someone can help me out, that would really make my weekend :-) I am having a problem with an ActionForm after restarting the context. Here's some details: 1. I have a jsp with struts form tags. 2. This form has an ActionForm associated with it. 3. One forward action that takes you to the jsp. 4. One custom action that processes the submission of this form (has action form declared in action-mapping in struts-config.xml) If I have a fresh session, and play around, the ActionForm is bound to the session as an attribute. Everything works fine. If I reload the context, everything appears to get Serialized successfully (I get no exceptions anywhere, there's a SESSIONS.ser file created in the work dir). If I check the session after reload, my ActionForm is once again listed as one of the attributes. -BUT- As soon as I try to request either action that utilizes the ActionForm, I get problems. If I request the forward action (which just forwards to the jsp with form tags), I get this: begin log javax.servlet.ServletException: Exception thrown by getter for property applicationDateMin of bean org.apache.struts.taglib.html.BEAN end log applictionDateMin is the FIRST form element in my jsp. Suspicious? If I request the action that processes the submitted form, I get this: begin log java.lang.NullPointerException at com.amfllc.web.forms.SearchPipelineActionForm.reset(Unknown Source) end log To a newbie like me, it looks like Struts wants to use the ActionForm bound to the session, but it's null after context restart for some reason. I've got a debugging filter set up that does some logging of request and session properties - that's how I know that the form is there in session. I've even gone as far as to check it for being null - it appears not to be == null. I've marked all the usual suspects transient (logger, etc.). What am I missing here? Thanks so much for any help. -Sasha - 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: suggestion needed
Here are some of my bookmarks http://www.reumann.net/do/struts/main http://forum.exadel.com/viewtopic.php?t=120 http://jakarta.apache.org/struts/faqs/ http://husted.com/struts/resources/example-spec.html http://developer.novell.com/tech/1126.html and I would also recommend buying a book: http://jakarta.apache.org/struts/index.html Koni Raju BSN wrote: Hi, I'm a new bee to struts. I have tried some examples and now I'm able to understand a bit abt the framework, but still not sure of the complete steps needed to develop a web application using struts. It will be a great help for me, if any one of you suggest me a site with good examples. Thanks Regards, Raju BSN, -- visit us at: http://www.rothweb.ch http://www.rothconsulting.com Jump and the earth will rise to meet you! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
struts and flash
i saw a thread on using flash with struts from about a year ago, and i was wondering what the current state of affairs was. i was a good doobie and wrote my application in pretty strict MVC form, but now i'm looking at refactoring it to use a flash front-end (with dynamic communication back to the server), and it's looking like a complete mess. basically, i want my Model layer to remain as it is (java / jdbc / mysql), and the View layer to be flash - i'd prefer to leave the Controller as a struts application. is this possible, while still allowing the front-end to talk to the server dynamically? daniel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
using tiles...
Since I couldn't find a separate mailing list for Tiles, I am posting here. I started using Tiles recently ( bundled with Struts 1.1 ). I am having problem using definitions. I get this error: javax.servlet.ServletException: Can't get definitions factory from context. at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp l.java:530) at org.apache.jsp.testTemplate_jsp._jspService(testTemplate_jsp.java:59) ... I am following exactly as the tiles-examples are defined. M struts-config file is: plug-in className=org.apache.struts.tiles.TilesPlugin set-property property=definitions-config value=/WEB-INF/tiles-test-defs.xml / set-property property=moduleAware value=true / /plug-in The tiles-test-defs.xml file is: definition name=mainPage path=classicLayout.jsp tiles:put name=title value=Hello Tiles/ tiles:put name=header value=/jsp/header.jsp/ tiles:put name=footer value=/jsp/footer.jsp/ tiles:put name=body value=/jsp/main.jsp/ /definition And my sample jsp file: tiles:insert definition=mainPage flush=true / Any help is appreciated. Thanks -- pady [EMAIL PROTECTED]
Re: suggestion needed
Here some of my bookmarks http://www.reumann.net/do/struts/main http://forum.exadel.com/viewtopic.php?t=120 http://www.ninsky.com/struts/ http://jakarta.apache.org/struts/faqs/ http://husted.com/struts/resources/example-spec.html http://developer.novell.com/tech/1126.html and I would also recommend buying a book: http://jakarta.apache.org/struts/resources/books.html Koni Raju BSN wrote: Hi, I'm a new bee to struts. I have tried some examples and now I'm able to understand a bit abt the framework, but still not sure of the complete steps needed to develop a web application using struts. It will be a great help for me, if any one of you suggest me a site with good examples. Thanks Regards, Raju BSN, -- visit us at: http://www.rothweb.ch http://www.rothconsulting.com Jump and the earth will rise to meet you! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tiles Definition problem
Bryce, To show a tile inside an independent, externally usable JSP, you're going in the wrong direction. I also suggested this broken path so let me help you get on the right path. These below 2 lines are all you need in your index.jsp to invoke your tile. I have included some explanations below on why the other methods didn't work. Your taglib URL might be different, so be sure to check your web.xml file. %@ taglib uri=/tags/struts-tiles prefix=tiles % tiles:insert definition=default.layout/ You were using a logic:redirect tag. I even wrote to you to take out the 'redirect=true' and use the forward. I didn't think it out clearly. A logic redirect tag forces the container to kick out a redirect which tells your browser to try the URL: http://localhost:8080/default.layout The problem is, that url isn't real. It is a tile and tiles cannot be accessed over the web that way. They can only be accessed within Struts or within pages in a way that is very different from the struts-logic tags. I was next going to suggest the more logical logic:forward tag, but the documents on Struts 1.1 note it cannot be used with tiles: Note: forwarding to Tiles definitions is not supported from this tag. You should forward to them from an Action subclass. From my perspective, you can either setup an action such as '/testtiles.do' to go to the tile: action path=/testtiles type=org.apache.struts.actions.ForwardAction parameter=default.layout/ Or force the JSP to import the tile definition and display it using a JSP made of two simple lines: %@ taglib uri=/tags/struts-tiles prefix=tiles % tiles:insert definition=default.layout/ I might use this method for my application's main homepage /index.jsp, just to remove the initial redirect that I might otherwise use (as it slows the user down a second or two as they get the HTTP redirect and ask for the new /index.do page). For everything else, I think I'll be consistent and use actions (*.do) for external access, not JSPs. Regards, David -Original Message- From: Bryce Fischer [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 1:45 PM To: Struts Users Mailing List Subject: Re: Tiles Definition problem Thanks to everyone who responded. Everyone recommended doing this: Try this: forward name=defaulttile redirect=true path=default.layout/ Still doesn't seem to work. I get the feeling I'm missing something so insanely stupid that its tough to figure out. I'm not sure how to get any more debug information. The only thing I'm getting on the console that looks like its Struts related are these lines: Aug 25, 2003 1:32:08 PM org.apache.struts.util.PropertyMessageResources init INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true Aug 25, 2003 1:32:09 PM org.apache.struts.util.PropertyMessageResources init INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true Aug 25, 2003 1:32:10 PM org.apache.struts.util.PropertyMessageResources init INFO: Initializing, config='resources.application', returnNull=true Aug 25, 2003 1:32:10 PM org.apache.struts.tiles.TilesPlugin init INFO: Tiles definition factory loaded for module ''. Aug 25, 2003 1:32:11 PM org.apache.struts.validator.ValidatorPlugIn initResources INFO: Loading validation rules file from '/WEB-INF/validator-rules.xml' Aug 25, 2003 1:32:11 PM org.apache.struts.validator.ValidatorPlugIn initResources INFO: Loading validation rules file from '/WEB-INF/validation.xml' Aug 25, 2003 1:32:12 PM org.apache.coyote.http11.Http11Protocol start INFO: Starting Coyote HTTP/1.1 on port 8080 Aug 25, 2003 1:32:13 PM org.apache.jk.common.ChannelSocket init INFO: JK2: ajp13 listening on /0.0.0.0:8009 Aug 25, 2003 1:32:13 PM org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=30/331 config=C:\jtools\jakarta\jakarta-tomcat-4.1.2\conf\jk2.properties Aug 25, 2003 1:33:01 PM org.apache.struts.util.PropertyMessageResources init INFO: Initializing, config='org.apache.struts.taglib.logic.LocalStrings', returnNull=true I don't know if any of this will point to problems or not. Instead of reposting all my code again, It can be downloaded here: http://www.berzerker-soft.com/testtiles.zip here's the content of my previous email, in case you don't want to download. Thanks in advance... /WEB-INF/tiles-def.xml ?xml version=1.0 encoding=UTF-8? !DOCTYPE tiles-definitions PUBLIC -//Apache Software Foundation//DTD Tiles Configuration//EN http://jakarta.apache.org/struts/dtds/tiles-config.dtd; tiles-definitions definition name=default.layout path=/templates/defaultLayout.jsp put name=title value=Default Title/ put name=header value=/common/header.jsp/ put name=menubar value=/common/menubar.jsp/ put name=body-content value=/common/body-content.jsp/ put name=footer value=/common/footer.jsp/ /definition /tiles-definitions -
Re: Checkboxes
Hi Filip See example on the really cool page of Matt Kruse: http://www.mattkruse.com/javascript/checkboxgroup/ Koni Filip Polsakiewicz wrote: Hi, I have the following problem: I have a list of 71 Checkboxes and want to have one checkbox to select all of them at once. This works fine but I cannot uncheck this checkbox if it was checked once in order to uncheck all other checkboxes. Can anybody help me on this. Any code samples would be very helpful. Thanks in advance, Filip - 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: RE : RE : Validator and Dispatch Actions
In this case, if I have one Save button on my page, and want either Action A or Action B to get executed, is the preferred method to set the action of the form dynamically in a function, something like: fnSetAction() { myForm.action=actionA; myForm.submit(); } Or is there a different preferred way of accomplishing this? Thanks From: thomas Sontheimer [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE : RE : Validator and Dispatch Actions Date: Mon, 25 Aug 2003 17:04:35 +0200 you don't need 2 action classes. you may declare 2 actions in the struts-config.xml file using the same class. but you have to declare 2 formset tags in the validation.xml file, setting up each form name with the action path instead of the form name. in the first formset tag you define validation rules for all the fields and in the second you do it only for a part of them. using the first action will validate all the fields and using the second will validate only a part of them. thomas -Original Message- From: Trent Fisher [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 4:05 PM To: [EMAIL PROTECTED] Subject: Re: RE : Validator and Dispatch Actions This being the case, say you had a situation where your form had a few fields that would be disabled/not displayed if a user didnt have a certain access level. If you wanted 2 separate validation schemes for this form (one that has all fields being validated, one that has all fields except for the disabled/not shown fields being validated) then you would need 2 action classes (or 2 dispatch methods in the case below)? If the actions will be executing similar, if not identical code based on the fields submitted, this seems like an awful lot of rework just to get the validation accomplished. From: thomas Sontheimer [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE : Validator and Dispatch Actions Date: Mon, 25 Aug 2003 15:21:47 +0200 you have to use (Dyna)ValitatorActionForm instead of (Dyna)ValidatorForm. Then in your validation.xml file for each new rule you specify you have to replace the name of the form by the name of the action using the form. And the rule will be applied to the form only if it's called from the action you gave the name. In your case you have to specify 1 form, 3 actions and 3 rules. thomas -Original Message- From: manglu [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 26, 2003 1:33 AM To: [EMAIL PROTECTED] Subject: Validator and Dispatch Actions Hi, I want to use the Struts Validator to do validation. The Same action form is used for SEARCH, CREATE and EDIT. The validation rules for each of them is different( from the other two) How do i go about defining such a config in the validation config file. Appreciate any help. TIA Manglu - 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] _ MSN 8: Get 6 months for $9.95/month http://join.msn.com/?page=dept/dialup - 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] _ Get MSN 8 and help protect your children with advanced parental controls. http://join.msn.com/?page=features/parental - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles Definition problem
David. Thank you very much. I knew I was missing something very simple. I had 2 books I had been referencing, Programming Jakarta Struts and Struts In Action. I guess I missed the forward thing in those docs. Thanks again, its working great. -- Bryce Fischer [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Checkboxes
The attached JSP may help you, I posted it a couple weeks ago to help solve a similar problem. HTH, mike jasnowski -Original Message- From: Filip Polsakiewicz [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 4:58 AM To: Struts Users Mailinglist Subject: Checkboxes Hi, I have the following problem: I have a list of 71 Checkboxes and want to have one checkbox to select all of them at once. This works fine but I cannot uncheck this checkbox if it was checked once in order to uncheck all other checkboxes. Can anybody help me on this. Any code samples would be very helpful. Thanks in advance, Filip - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Paging through DB ResultSets
Any suggestions or ideas on how I can page through a DB ResultSet? Thanks in advance. - Mitesh
[OT] Re: Small request...
What is it that makes you think our dates time are not correct? --- Keith Pemberton [EMAIL PROTECTED] wrote: I know that this is way off topic but it would be a bit help for my inbox. Could the people associated with this list please check the clock on there computers and set the correct date and time? I really would appreciate this small request. -- Keith Pemberton [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: testing
test2 Emerson Cargnin wrote: just testing... -- Emerson Cargnin Analista de Sistemas Setor de Desenvolvimento de Sistemas - TRE-SC tel : (048) - 251-3700 - Ramal 3181 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: using tiles...
Pady, I didn't see you set your controller line set to use a Tiles RequestProcessor such as: controller processorClass=org.apache.struts.tiles.TilesRequestProcessor/ I had a problem a little like that over the weekend with my tiles. I put that in but forgot my TilesPlugIn. Regards, David -Original Message- From: Pady Srinivasan [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 3:11 PM To: [EMAIL PROTECTED] Subject: using tiles... Since I couldn't find a separate mailing list for Tiles, I am posting here. I started using Tiles recently ( bundled with Struts 1.1 ). I am having problem using definitions. I get this error: javax.servlet.ServletException: Can't get definitions factory from context. at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp l.java:530) at org.apache.jsp.testTemplate_jsp._jspService(testTemplate_jsp.java:59) ... I am following exactly as the tiles-examples are defined. M struts-config file is: plug-in className=org.apache.struts.tiles.TilesPlugin set-property property=definitions-config value=/WEB-INF/tiles-test-defs.xml / set-property property=moduleAware value=true / /plug-in The tiles-test-defs.xml file is: definition name=mainPage path=classicLayout.jsp tiles:put name=title value=Hello Tiles/ tiles:put name=header value=/jsp/header.jsp/ tiles:put name=footer value=/jsp/footer.jsp/ tiles:put name=body value=/jsp/main.jsp/ /definition And my sample jsp file: tiles:insert definition=mainPage flush=true / Any help is appreciated. Thanks -- pady [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
html in ActionMessage resource keys?
Hi, I am wondering if html tags, such as br, be used in the message resource bundle keys? I want to have some formatting for an ActionMessage, similar to what one gets using the ActionErrors and the errors.prefix, errors.header and errors.footer keys (by default = BR, UL, /UL respectively). When I create a message key in my resource bundle, such as messages.warning.general=Warning,the following problem occurred BR {0} and use the following type of tag to display the message: html:messages message =true property=warning id=msg libean:write name=msg/ /html:messages I get the following in the html source: liWarning,the following problem occurred:lt;BRgt; access problem What I want is the following: liWarning,the following problem occurred:BR access problem Thanks, Nancy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html in ActionMessage resource keys?
Hi! Try to do the bean:write like this bean:write filter=false name=msg / The filter=false tells it to not replace special characters to entities. Regards Mikael At 17:04 2003-08-25 -0400, you wrote: Hi, I am wondering if html tags, such as br, be used in the message resource bundle keys? I want to have some formatting for an ActionMessage, similar to what one gets using the ActionErrors and the errors.prefix, errors.header and errors.footer keys (by default = BR, UL, /UL respectively). When I create a message key in my resource bundle, such as messages.warning.general=Warning,the following problem occurred BR {0} and use the following type of tag to display the message: html:messages message =true property=warning id=msg libean:write name=msg/ /html:messages I get the following in the html source: liWarning,the following problem occurred:lt;BRgt; access problem What I want is the following: liWarning,the following problem occurred:BR access problem Thanks, Nancy - 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]
reloading page from array of checkbox
I'm creating checkboxes like this: html:checkbox property=abc value=xx/html:checkbox html:checkbox property=abc value=yy/html:checkbox html:checkbox property=abc value=zz/html:checkbox I define it in my form (DynaForm) like this: form-property name=abc type=java.lang.String[] / This submits to the server fine, all the checkboxes have their value set in the array. However, when reloading the page with the form in the session, the checkboxes don't get set. All my other controls get set from the values in the form, but struts doesn't understand the array of values to set the checkboxes. Is there some trick to doing this? Am I going to have to give each checkbox its own property to get it to set on page load? I know this would work, but I'd rather keep in array if possible. Darrel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Java Question
I've been trying to compile my BLB (Business Logic Bean) and have been getting errors during compilation. I haven't a clue as to how I could debug this. Any assistance would be appreciated. Thanks in advance. - Mitesh Error Messages during compilation: [javac] Compiling 2 source files to C:\jakarta-tomcat-4.1.27\webapps\benchmark\WEB-INF\classes [javac] C:\jakarta-tomcat-4.1.27\webapps\benchmark\WEB-INF\src\net\reumann\OrgIdService.java:56: stmt is already defined in execute(net.reumann.DataHash) [javac] Statement stmt = conn.createStatement(); [javac] ^ [javac] C:\jakarta-tomcat-4.1.27\webapps\benchmark\WEB-INF\src\net\reumann\OrgIdService.java:57: rs is already defined in execute(net.reumann.DataHash) [javac] ResultSet rs = stmt.executeQuery(SELECT FACIL_ID, FACIL_NAME, FACIL_NAME_SHORT, ORG_ID FROM FACILITY WHERE FACIL_ID = ' + facilId + '); [javac] ^ [javac] 2 errors Here is the code from my BLB: package net.reumann; import java.io.*; import java.util.ArrayList; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; import javax.sql.*; import net.reumann.*; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.log4j.*; import org.apache.commons.beanutils.BeanUtils; public class OrgIdService implements Serializable { //Declare and initialize variables Connection conn = null; Statement stmt = null; ResultSet rs = null; ArrayList facilList = new ArrayList(); //The execute() method of OrgIdService is called by OrgIdAction to execute a query against the SS Test DB public ArrayList execute(DataHash beanHash) { //Get mode from DataHash int mode = beanHash.getMode(); try{ switch (mode) { case 0: Class.forName(oracle.jdbc.driver.OracleDriver); conn = DriverManager.getConnection(jdbc:oracle:thin:@sources:1521:TEST,Test1234,Test1234); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(SELECT DISTINCT FACIL_ID FROM FACILITY); //Read ResultSet into instance of FacilBean and add to facilList Array object while (rs.next()) { FacilBean facil = new FacilBean(); facil.setFacilId(rs.getString(FACIL_ID)); facilList.add(facil); } //Close ResultSet and Connection objects rs.close(); conn.close(); case 1: //Extract the facilId from the DataHash to query the FACILITY table String facilId = (String) beanHash.get(FacilId); Class.forName(oracle.jdbc.driver.OracleDriver); conn = DriverManager.getConnection(jdbc:oracle:thin:@sources:1521:TEST,Test1234,Test1234); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(SELECT FACIL_ID, FACIL_NAME, FACIL_NAME_SHORT, ORG_ID FROM FACILITY WHERE FACIL_ID = ' + facilId + '); //Read ResultSet into instance of FacilBean and add to facilList Array object while (rs.next()) { FacilBean facil = new FacilBean(); facil.setFacilId(rs.getString(FACIL_ID)); facil.setFacilName(rs.getString(FACIL_NAME)); facil.setFacilName(rs.getString(FACIL_NAME_SHORT)); facil.setOrgId(rs.getString(ORG_ID)); facilList.add(facil); } //Close ResultSet and Connection objects rs.close(); conn.close(); default: return null;
Re: Java Question
The error messages says that stmt/rs already have been declared. This is done in these lines in the beginning of the method //Declare and initialize variables Connection conn = null; Statement stmt = null; ResultSet rs = null; Change the later lines and remove the Statement and ResultSet words respectively and it should compile Regards Mikael At 13:20 2003-08-24 -0500, you wrote: I've been trying to compile my BLB (Business Logic Bean) and have been getting errors during compilation. I haven't a clue as to how I could debug this. Any assistance would be appreciated. Thanks in advance. - Mitesh Error Messages during compilation: [javac] Compiling 2 source files to C:\jakarta-tomcat-4.1.27\webapps\benchmark\WEB-INF\classes [javac] C:\jakarta-tomcat-4.1.27\webapps\benchmark\WEB-INF\src\net\reumann\OrgIdService.java:56: stmt is already defined in execute(net.reumann.DataHash) [javac] Statement stmt = conn.createStatement(); [javac] ^ [javac] C:\jakarta-tomcat-4.1.27\webapps\benchmark\WEB-INF\src\net\reumann\OrgIdService.java:57: rs is already defined in execute(net.reumann.DataHash) [javac] ResultSet rs = stmt.executeQuery(SELECT FACIL_ID, FACIL_NAME, FACIL_NAME_SHORT, ORG_ID FROM FACILITY WHERE FACIL_ID = ' + facilId + '); [javac] ^ [javac] 2 errors Here is the code from my BLB: package net.reumann; import java.io.*; import java.util.ArrayList; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; import javax.sql.*; import net.reumann.*; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.log4j.*; import org.apache.commons.beanutils.BeanUtils; public class OrgIdService implements Serializable { //Declare and initialize variables Connection conn = null; Statement stmt = null; ResultSet rs = null; ArrayList facilList = new ArrayList(); //The execute() method of OrgIdService is called by OrgIdAction to execute a query against the SS Test DB public ArrayList execute(DataHash beanHash) { //Get mode from DataHash int mode = beanHash.getMode(); try{ switch (mode) { case 0: Class.forName(oracle.jdbc.driver.OracleDriver); conn = DriverManager.getConnection(jdbc:oracle:thin:@sources:1521:TEST,Test1234,Test1234); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(SELECT DISTINCT FACIL_ID FROM FACILITY); //Read ResultSet into instance of FacilBean and add to facilList Array object while (rs.next()) { FacilBean facil = new FacilBean(); facil.setFacilId(rs.getString(FACIL_ID)); facilList.add(facil); } //Close ResultSet and Connection objects rs.close(); conn.close(); case 1: //Extract the facilId from the DataHash to query the FACILITY table String facilId = (String) beanHash.get(FacilId); Class.forName(oracle.jdbc.driver.OracleDriver); conn = DriverManager.getConnection(jdbc:oracle:thin:@sources:1521:TEST,Test1234,Test1234); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(SELECT FACIL_ID, FACIL_NAME, FACIL_NAME_SHORT, ORG_ID FROM FACILITY WHERE FACIL_ID = ' + facilId + '); //Read ResultSet into instance of FacilBean and add to facilList Array object while (rs.next()) { FacilBean facil = new FacilBean(); facil.setFacilId(rs.getString(FACIL_ID)); facil.setFacilName(rs.getString(FACIL_NAME)); facil.setFacilName(rs.getString(FACIL_NAME_SHORT)); facil.setOrgId(rs.getString(ORG_ID)); facilList.add(facil); } //Close ResultSet and Connection objects rs.close(); conn.close();
RE: Java Question
[javac] Compiling 2 source files to C:\jakarta-tomcat-4.1.27\webapps\benchmark\WEB-INF\classes [javac] C:\jakarta-tomcat-4.1.27\webapps\benchmark\WEB-INF\src\net\reu mann\OrgIdService.java:56: stmt is already defined in execute(net.reumann.DataHash) [javac] Statement stmt = conn.createStatement(); You are kidding, right? -TPP - This email may contain confidential and privileged material for the sole use of the intended recipient(s). Any review, use, retention, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message. Also, email is susceptible to data corruption, interception, tampering, unauthorized amendment and viruses. We only send and receive emails on the basis that we are not liable for any such corruption, interception, tampering, amendment or viruses or any consequence thereof. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: Small request...
One person sent a post to the list with a sent date of Aug 21, 2004. This obviously hasn't happened yet. On Mon, 2003-08-25 at 15:24, Michael Ruppin wrote: What is it that makes you think our dates time are not correct? --- Keith Pemberton [EMAIL PROTECTED] wrote: I know that this is way off topic but it would be a bit help for my inbox. Could the people associated with this list please check the clock on there computers and set the correct date and time? I really would appreciate this small request. -- Keith Pemberton [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Keith Pemberton [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: Small request...
hi Derek, ajdust your date :) Derek Richardson wrote: My application allows you to download files. This is done by opening a new browser window (separate from the main application) which walks the user through a wizard to select a download. In the final action of this wizard, I set the mime type to application\download and the Content-Disposition header to attachment; file=file.txt, write the file being downloaded to the ServletOutputStream that I obtain from the HttpServletResponse, and flush the buffer. All very simple. The problem is that, after the file is downloaded, the browser window is just left hanging there with the last contents displayed. I need a way to close that window. The best solution would be to display a confirmation page in the window after the download and then allow a user to click a button to close the window. Second best would be to just close the window. I tried returning an ActionForward, both a regular forward and a redirect, from my action and it seems that it is simply ignored. I tried setting onsubmit=window.close() on the form that starts the download, but then the download doesn't happen. I searched the archives, with no success. Any help is appreciated. Derek Richardson Keith Pemberton wrote: One person sent a post to the list with a sent date of Aug 21, 2004. This obviously hasn't happened yet. On Mon, 2003-08-25 at 15:24, Michael Ruppin wrote: What is it that makes you think our dates time are not correct? --- Keith Pemberton [EMAIL PROTECTED] wrote: I know that this is way off topic but it would be a bit help for my inbox. Could the people associated with this list please check the clock on there computers and set the correct date and time? I really would appreciate this small request. -- Keith Pemberton [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Emerson Cargnin Analista de Sistemas Setor de Desenvolvimento de Sistemas - TRE-SC tel : (048) - 251-3700 - Ramal 3181 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Java Question
Since you have already Defined the conn and stmt you no need to defined again . public class OrgIdService implements Serializable { //Declare and initialize variables Connection conn = null; Statement stmt = null; ResultSet rs = null; ArrayList facilList = new ArrayList(); Just remove Statement and ResultSet from line 56 and 57 Compile again it will work fine. Eg : stmt = conn.createStatement(); rs = stmt.executeQuery(SELECT Thanks Nazeer -Original Message- From: Kapadia Mitesh-C23457 [mailto:[EMAIL PROTECTED] Sent: Sunday, August 24, 2003 2:21 PM To: [EMAIL PROTECTED] Subject: Java Question I've been trying to compile my BLB (Business Logic Bean) and have been getting errors during compilation. I haven't a clue as to how I could debug this. Any assistance would be appreciated. Thanks in advance. - Mitesh Error Messages during compilation: [javac] Compiling 2 source files to C:\jakarta-tomcat-4.1.27\webapps\benchmark\WEB-INF\classes [javac] C:\jakarta-tomcat-4.1.27\webapps\benchmark\WEB-INF\src\net\reumann\OrgId Service.java:56: stmt is already defined in execute(net.reumann.DataHash) [javac] Statement stmt = conn.createStatement(); [javac] ^ [javac] C:\jakarta-tomcat-4.1.27\webapps\benchmark\WEB-INF\src\net\reumann\OrgId Service.java:57: rs is already defined in execute(net.reumann.DataHash) [javac] ResultSet rs = stmt.executeQuery(SELECT FACIL_ID, FACIL_NAME, FACIL_NAME_SHORT, ORG_ID FROM FACILITY WHERE FACIL_ID = ' + facilId + '); [javac] ^ [javac] 2 errors Here is the code from my BLB: package net.reumann; import java.io.*; import java.util.ArrayList; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; import javax.sql.*; import net.reumann.*; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionForm; import org.apache.log4j.*; import org.apache.commons.beanutils.BeanUtils; public class OrgIdService implements Serializable { //Declare and initialize variables Connection conn = null; Statement stmt = null; ResultSet rs = null; ArrayList facilList = new ArrayList(); //The execute() method of OrgIdService is called by OrgIdAction to execute a query against the SS Test DB public ArrayList execute(DataHash beanHash) { //Get mode from DataHash int mode = beanHash.getMode(); try{ switch (mode) { case 0: Class.forName(oracle.jdbc.driver.OracleDriver); conn = DriverManager.getConnection(jdbc:oracle:thin:@sources:1521:TEST,Test1 234,Test1234); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(SELECT DISTINCT FACIL_ID FROM FACILITY); //Read ResultSet into instance of FacilBean and add to facilList Array object while (rs.next()) { FacilBean facil = new FacilBean(); facil.setFacilId(rs.getString(FACIL_ID)); facilList.add(facil); } //Close ResultSet and Connection objects rs.close(); conn.close(); case 1: //Extract the facilId from the DataHash to query the FACILITY table String facilId = (String) beanHash.get(FacilId); Class.forName(oracle.jdbc.driver.OracleDriver); conn = DriverManager.getConnection(jdbc:oracle:thin:@sources:1521:TEST,Test1 234,Test1234); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(SELECT FACIL_ID, FACIL_NAME, FACIL_NAME_SHORT, ORG_ID FROM FACILITY WHERE FACIL_ID = ' + facilId + '); //Read ResultSet into instance of FacilBean and add to facilList Array object while (rs.next()) { FacilBean facil = new FacilBean(); facil.setFacilId(rs.getString(FACIL_ID)); facil.setFacilName(rs.getString(FACIL_NAME)); facil.setFacilName(rs.getString(FACIL_NAME_SHORT)); facil.setOrgId(rs.getString(ORG_ID)); facilList.add(facil); } //Close ResultSet and Connection objects
RE: Tiles Definition problem
Bryce, You're welcome. -David -Original Message- From: Bryce Fischer [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 3:55 PM To: Struts Users Mailing List Subject: Re: Tiles Definition problem David. Thank you very much. I knew I was missing something very simple. I had 2 books I had been referencing, Programming Jakarta Struts and Struts In Action. I guess I missed the forward thing in those docs. Thanks again, its working great. -- Bryce Fischer [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: struts and flash
wish I knew ActionScript well enough to write all my pages in Flash. Anyway, I found this link online: http://www.smartwebby.com/Flash_and_ASP/Flash_sends_data.asp It tells you how to send a request to an ASP page. The basic should be the same. Worth a try:). -Original Message- From: Daniel Blumenthal [mailto:[EMAIL PROTECTED] Sent: August 25, 2003 1:02 PM To: Struts Users Mailing List Subject: struts and flash i saw a thread on using flash with struts from about a year ago, and i was wondering what the current state of affairs was. i was a good doobie and wrote my application in pretty strict MVC form, but now i'm looking at refactoring it to use a flash front-end (with dynamic communication back to the server), and it's looking like a complete mess. basically, i want my Model layer to remain as it is (java / jdbc / mysql), and the View layer to be flash - i'd prefer to leave the Controller as a struts application. is this possible, while still allowing the front-end to talk to the server dynamically? daniel - 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]
Html-el:hidden tag!?!?!
Why is it that the html-el:hidden tag has no styleId attribute? -- Tim Slattery [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connector or Apache and Tomcat
Mohan, What are you looking to do? Write one Struts-based webapp (probably with modules) to merge and replace all of that on one IP? I'm developing the same way: 2 sites, different looks controlled with Tiles, both on one IP. The trouble is if you need SSL on multiple sites then they need their own IP's for their SSL certificates. Regards, David -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, August 25, 2003 4:32 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Reg: Connector or Apache and Tomcat Hi I am running a few struts-based webapp using tomcat. I access them using www.xyz.org/webappA, www.xyz.org/webappB, www.xyz.org/webappC. We have an old website consisting of static html. we want to merge this old website to the tomcat. The old webiste had stuff something in this format www.old.org/ModA, www.old.org/ModB, www.old.ModC etc..I would like it to be so that i can all the entire content from one IP like www.xyz.org/webappA,www.xyz,org/webappB, www/xyz.org/modA(static HTML module), www.xyz.org/modB(static HTML module. Plz. let me know how i can do this. I dont even know if i should use connectors for this. I am not getting any resources on this plz. help me Thank you Mohan - 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]