RE: RE: Grid
dbForms looks good...put have you tested it? or someone else? is it easy to use? Yes it is very easy to use, but I don't like it, 'cause it does too much and it is not very flexible. But for prototyping it's quite good and it is pretty fast to built db frontends with it. -- Aapo Laakkonen, +358 (50) 33 99 682, Giro Consulting Oy. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: URL rewriting and cookies
I still have not got any answers for the problem described below. Is there some problems with struts custom img-tag? Why it is generating tags like this? img src=/images/blue.gif;jsessionid=0001CEAAQCTISJFXCZWNZLC2WNA Where does this ';' came from and why there it is not '?' instead? Do I have to add ? on every picture if I like to use URL rewriting instead of cookies? Could you post an example of the type of URLs you're seeing? Here is the struts html:img-tag: html:img srcKey=img.pixel.blue altKey=img.pixel.blue.alt width=715 height=7 border=0/ And it generates output like this: img src=/images/blue.gif;jsessionid=0001CEAAQCTISJFXCZWNZLC2WNA alt= height=7 width=715 border=0 As you see ;jsessionid=0001CEAAQCTISJFXCZWNZLC2WNA is absolutely crap that I don't want to have in src-attribute. This occurs only when I enable URL-rewriting and disable cookies in my application server (WAS 3.5.4 on AIX). I have WAS modified struts package installed. My client likes to use URL-rewriting and disable cookies... I'm not sure if this problem occurs even if both URL rewriting and Cookies are enabled. But again my client wants to use only URL-rewriting, because they have quite strict deployment standards. Images are not served by WAS as my client uses separate Web Server for serving static content and they don't want to have any overhead that is generated by WAS layer if the files can be served directly by Apache or some other Web Server as it is the case with images in this app. Can someone at least confirm me if the problem exists in struts framework or somewhere else so I can point my finger to the source of the problem... and leave you to think how you can improve this great framework. Have you heard anything about WebWare for Python? I think that Struts developers should look at the ideas implemented in WebWare... if you already have not. It's really nice app server ... at least in developer's point of view, imho. Original message: - I have some small problems with struts on WebSphere 3.5.4 on AIX. Everything works fine, if I enable cookies and disable URL rewriting. But when I enable URL rewriting and disable cookies (or maybe I just need to enable URL rewriting) struts is generating (or is it because of struts)strange URL's. For example if I have used html:img srcKey=image.logo... / tag then struts generates the tag correctly but adds session id at the end of HTML's img-tags source attribute. And then the image is not displayed to the user because the generated URL points to wrong place. How can I remove struts from adding session ids at the end of the src attribute? -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Usage of struts in financial institutions
Is struts framework used in any of the financial firms ? Been there done that. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Weird problem (WAS)
Seems like my struts installation doesn't work anymore as expected. All my forms do not have .do added to the end of action url anymore. It's interesting because html:links does work. What can cause this behavior? I did not do anything except updated my own jar-package. The problem was not struts related, sorry. It was because WAS corrupted itself somehow.
Weird problem (WAS)
Seems like my struts installation doesn't work anymore as expected. All my forms do not have .do added to the end of action url anymore. It's interesting because html:links does work. What can cause this behavior? I did not do anything except updated my own jar-package.
WebSphere 3.5.4
What steps are required to install Struts application on WebSphere 3.5.4 Application server? Is there something that need to be done? How did you deploy struts application on WebShere 3.5.4? Kind Regards Aapo -- Aapo Laakkonen, +358 (50) 33 99 682, ProjectCast Ltd, Helsinki, Finland.
Re: A Few questions about struts and WebSphere
1) You need to use flush=true on your template:get tags in the template. Thank you very much. Actually this did not solve my problem, because flush is only useful with get tags, but not with template:insert. I know that jsp:include has capability to flush, but I like using template tags. Is it possible to have flush attribute in template:insert tag in future? 2) Did you deploy your WAR correctly? That do you mean about this? All the files are in correct places, but WebSphere always puts an extra folder in those redirects. I do not use html:base tag because my jsp files are under WEB-INF/web directory, so it doens't work. It seems that this problem occurs using forms: I have form like this: html:form action=update focus=name ... /html:form update mapping is defined like this: action path=/update type=com.projectcast.UpdateAction name=UpdateForm scope=request input=/edit.do validate=true forward name=success path=/list.do redirect=true/ forward name=cancel path=/list.do redirect=true/ /action When I run this form I get this code: form name=FundForm method=POST action=/app/updatefund.do When I submit or cancel this form the redirect is processed to: http://localhost/app/app/list.do. I included the error message in this post. Check to make sure you don't have an extra folder app folder under app in default_host. No I don't have extra app folder. 3) Haven't used Struts' DataSource functionality, I'm afraid I can't help you there - it doesn't look like it should be a problem, but I can't make any guarantees. :) Then maybe you can tell me how do I get DataSource object from WebSphere JNDI (Code would be great). So how to replace this: (InitialContext something, but not sure how). DataSource ds = (DataSource)servlet.getServletContext() .getAttribute(Action.DATA_SOURCE_KEY); Kind Regards Aapo Laakkonen Error 400 An error has occured while processing request:http://localhost/app/app/list.do Message: Invalid path /app/list was requested Target Servlet: action StackTrace: Root Error-1: Invalid path /app/list was requested com.ibm.servlet.engine.webapp.WebAppErrorReport: Invalid path /app/list was requested at javax.servlet.ServletException.init(ServletException.java:107) at com.ibm.websphere.servlet.error.ServletErrorReport.init(ServletErrorReport.java:31) at com.ibm.servlet.engine.webapp.WebAppErrorReport.init(WebAppErrorReport.java:19) at com.ibm.servlet.engine.webapp.WebAppDispatcherResponse.sendError(WebAppDispatcherResponse.java:100) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1556) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:491) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code)) at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager.java:626) at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycleServlet.java:160) at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServlet.java:287) at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycleServlet.java:105) at com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:360) at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletManager.java:775) at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManager.java:701) at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:478) at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:234) at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:138) at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:77) at com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:67) at com.ibm.servlet.engine.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:106) at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:160) at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener.java:300) at com.ibm.servlet.engine.oselistener.SQEventListenerImp$ServiceRunnable.run(SQEventListenerImp.java:230) at com.ibm.servlet.engine.oselistener.SQEventListenerImp.notifySQEvent(SQEventListenerImp.java:104) at com.ibm.servlet.engine.oselistener.serverqueue.SQEventSource.notifyEvent(SQEventSource.java:212
Re: Wrong ordering of rendered html elements when using templates under WAS 3.5.x
Title: FW: Wrong ordering of rendered html elements when using templates under WAS 3.5.x I don't know if this helps, but I use something like this: html:html locale="true" template:insert template="templates/head.jsp" template:put name="title" direct="true" bean:message key="title.sometitle"/ /template:put /template:insert template:insert template="templates/body_begin.jsp"/ !-- PUT YOUR CONTENT HERE -- template:insert template="templates/body_end.jsp"/ /html:html - Original Message - From: Nik Malenovic To: [EMAIL PROTECTED] Sent: Thursday, August 02, 2001 1:11 AM Subject: FW: Wrong ordering of rendered html elements when using templates under WAS 3.5.x Hello personable people, We've got a live one over here - I've dug up an issue when using templates under WebSphere 3.5.4 (don't ask) with struts 1.0 (plus a fix or two that is required to get struts functioning properly under WAS3.5.x). The issue is that my JSP produces misordered html snippets. Here's what I mean: Actors: --- Home.jsp Home_content.jsp Home_template.jsp Home.jsp: - [%@ taglibs here % ] !-- home.jsp:My Title -- template:insert template="home_template.jsp" template:put name="title" direct="true"My Title/template:put template:put name="content" content="home_content.jsp" / /template:insert Home_content.jsp: -- [%@ taglibs here % ] table width="100%" border="0" cellspacing="0" cellpadding="0" tr tdfoo/td /tr /table Home_template.jsp -- [%@ taglibs here % ] html:html locale="true" head titletemplate:get name="title" / /title /head body bgcolor="#FF" text="#00" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" table width="100%" border="0" cellspacing="0" cellpadding="0" height="24" tr SOME MORE WILD TEXT HERE /tr /table !-- begin content -- template:get name="content" / !-- end content -- /body /html:html Output of glorious home.jsp hosted by WAS3.5.x (notice out of order rendering!): - table width="100%" border="0" cellspacing="0" cellpadding="0" tr tdfoo/td /tr /table html lang="en" head title My Title /title /head body bgcolor="#FF" text="#00" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" table width="100%" border="0" cellspacing="0" cellpadding="0" height="24" tr SOME MORE WILD TEXT HERE /tr /table !-- begin content -- !-- end content -- /body /html !-- home.jsp:My Title -- See the problem? :-) I'd appreciate anyone with a clue to send me one. Thanks, Nik -- Nik Malenovic mailto:[EMAIL PROTECTED]
Re: Pre-Populating ActionForm (again)
Here is the work flow: 1. select user from list - executes SelectUserAction that places UserBean in request scope. - forwards to edituser.jsp. 2. Populate form that is in edituser.jsp from UserBean - that form has action mapping to UpdateUserAction. 3. Submit form (Update) - UserForm gets populated and then it's validated by struts by calling validate method. - If validation fails then go back to edituser.jsp and the problem arises: there is not anymore UserBean in request scope, because SelectUserAction is responsible of that and it does not get executed, so I get error: No xxx bean in scope null. So how do I write that form so I can populate it automatically? I mean that what code I should put in SelectUserAction so I can use tag like this: I got it to work. Thanks for everyone who replied to this issue! Would you care to elaborate on your solution? Ok here it goes. Instead of populating custom UserBean I populate UserForm Bean in EditUserAction. The form is the same that is also used in UpdateUserAction and InsertUserAction. I know that struts guidelines say that reuse you action classes, but I like separating these different actions in different action classes because I'm quite new to this Java World and I'm not using EJBs. This works for me. If you are planning bigger application then it is recommended to use EJBs, but the timeframe in this project is so tight so I have no time to learn all those fancy Java APIs and Patterns. My Mappings looks like this: form-beans form-bean name=UserForm type=com.projectcast.sfundm.UserForm/ /form-beans action-mappings action path=/userlist type=com.projectcast.sfundm.UserListAction name=UserForm scope=request validate=false forward name=success path=/WEB-INF/web/userlist.jsp/ !-- this is redundant as it forwards to same place as success, but it is here so I can change it if I want and Action class remains unchanged -- forward name=failure path=/WEB-INF/web/userlist.jsp/ /action action path=/edituser type=com.projectcast.sfundm.UserSelectAction name=UserForm scope=request validate=false forward name=success path=/WEB-INF/web/edituser.jsp/ /action action path=/updateuser type=com.projectcast.sfundm.UserUpdateAction name=UserForm scope=request input=/edituser.do validate=true forward name=success path=/userlist.do redirect=true/ forward name=cancel path=/userlist.do redirect=true/ /action action path=/insertuser type=com.projectcast.sfundm.UserInsertAction name=UserForm scope=request input=/userlist.do validate=true forward name=success path=/userlist.do redirect=true/ /action action path=/deleteuser type=com.projectcast.sfundm.UserDeleteAction scope=request input=/userlist.do validate=false forward name=success path=/userlist.do/ /action /action-mappings Pretty weird, huh!
Re: Pre-Populating ActionForm (again)
if u have overridden validate method in the actionForm then ActionServlet automatically take u to the mapping.getInput() ( i.e ur input jsp file ) where u can show the errors using html:errors tag . Basicallly ActionErrors are kept in the request scope which are retrieved in the html:errors tag I know that. Else if u want to do validation even in ur action class , then create a instance of ActionErrors in the action class and add errors to it . save the errors using saveErrors(request , actionErrros) method available in the Struts- Action class . So errors will be kept in the request scope and again use same html:errors tag to display them I know this too... but it's not the problem what I'm having. Here is the work flow: 1. select user from list - executes SelectUserAction that places UserBean in request scope. - forwards to edituser.jsp. 2. Populate form that is in edituser.jsp from UserBean - that form has action mapping to UpdateUserAction. 3. Submit form (Update) - UserForm gets populated and then it's validated by struts by calling validate method. - If validation fails then go back to edituser.jsp and the problem arises: there is not anymore UserBean in request scope, because SelectUserAction is responsible of that and it does not get executed, so I get error: No xxx bean in scope null. So how do I write that form so I can populate it automatically? I mean that what code I should put in SelectUserAction so I can use tag like this: html:text property=userName size=14 maxlength=14/ to automatically pre-populate that form, instead of writing code like this: html:text name=userBean property=userName size=14 maxlength=14/. Is there some way to put pre-populated form in some scope so that struts automatically finds it and populates the form (I bet there is, but don't know how to do it). I also included my first mail in this so you can get more specific detail on this problem. I know that this have been asked several times, but I did not find answer for this little problem. I have list of lets say users. Each user has a link that maps to edituser action. That action then gets executed and it places userbean to request scope. Then struts forwards action to edituser.jsp. Edituser.jsp has form that has action mapping set to updateuser. When user submits that form which binds to userform action form the validate method of that actionform gets executed. If validation errors occurred then we get back to input form (which is edituser.jsp or edituser.do -- which to use?). And this is the point when I do not really understand what I should do, because when user gets back to edituser.jsp or edituser.do then there is not anymore that userbean is request scope. And because edituser.do does not have any forms associated with it then I should instead use edituser.jsp as input for updateuser action. But how I then write that form (jsp-page)? I have several options: 1. put userbean in session scope (might be problem in multiserver environment also the modifications that user entered are not visible). 2. Have another jsp-page that does not populate the form from userbean. Not good option because almost the same form needs to be written second time. 3. Use logic tags to check the existence of userbean and if it does not exist then do not populate and let the form populate itself from posted form. Same problems as in 2. 4. Somehow prepopulate the form with no manual population, but automatically. So do I pre-populate the form. What code I need to put in edituser action that previously placed userbean in request scope. I want to place the form object in that same scope, but don't know how. This is the best option and has no problems or at least I have not found a one. Thanks again! Aapo Laakkonen
Cutom Tag request
html:label/ tag would be nice. What others think? Here is some uses: html:form action=someAction html:label property=someProperty/ /html:form html:form action=someAction html:label key=someKey/ /html:form It just prints string values like bean:write tag but does not require name attribute and cannot be used and associated with form. It also could have bean:message functionality. I know that this isn't a big issue, but sometimes you want to display something in form that is not editable (e.g. Primary Key). I know that I can use html:text readonly=true for most cases, but html:label tag could give you more flexibility.
Re: Cutom Tag request
It just prints string values like bean:write tag but does not require name attribute and cannot be used and associated with form. Of course I meant: It just prints string values like bean:write tag but does not require name attribute and can be used and associated with form.
Mappings, bloody mappings
I have problem... It might be in my understanding, but here it goes... I have these mappings: form-beans form-bean name=FundUpdateForm type=com.projectcast.sfundm.FundForm/ /form-beans global-forwards forward name=funds path=/fundlist.do/ /global-forwards action-mappings action path=/fundlist type=com.projectcast.sfundm.FundListAction scope=request forward name=success path=/WEB-INF/web/fundlist.jsp/ forward name=failure path=/WEB-INF/web/fundlist.jsp/ /action action path=/editfund type=com.projectcast.sfundm.FundSelectAction scope=request forward name=success path=/WEB-INF/web/editfund.jsp/ forward name=failure path=/WEB-INF/web/editfund.jsp/ forward name=cancel path=/funds.do/ /action action path=/updatefund type=com.projectcast.sfundm.FundUpdateAction name=FundUpdateForm scope=request input=/WEB-INF/web/editfund.jsp validate=true forward name=success path=/editfund.do/ forward name=cancel path=/funds.do/ !-- I have also tried this forward name=cancel path=/fundlist.do/ -- /action action-mappings Then some explanation. I have fundlist action that displays all the funds, ok. Then when user selects one fund on the list struts executes editfund action and gets all needed information about that fund. Everything works correctly at this point. Then editfund.jsp has a form that has action mapped to updatefund action and also has an cancel button. If cancel button is pressed the updatefund action gets executed, am I right? Here is first two lines from UpdateAction class: if (isCancelled(request)) return (mapping.findForward(cancel)); Then it should go back to fundlist.do action, but all what I get is HTTP 400 Bad Request error. What I am doing wrong? Or should I do something different to get the same results? And I'm running struts on Apache Test Environment 3.2.1 for Visual Age 3.5.3. Thanks, Aapo Laakkonen -- Aapo Laakkonen, +358 (50) 33 99 682, ProjectCast Ltd, Helsinki, Finland.
Re: URL mapping
I want to be able to map a URL to certain JSPs which may or may not have an action involved with them e.g map /logon to logon.jsp which also has as action also called logon also /tour to tour.jsp which has no associated action. How can I do this with struts? action path=/logon forward=/logon.jsp/
Re: URL mapping
Of course. But with this action-forward approach, you can forward only *.do URLs. Please correct me, if I am wrong. It depends on what you specify as an extension for struts controller in your web.xml file.
Re: Has anyone used KONA? and how diffierent is it from struts?
I am sorry if I have confused everyone. But this is the Kona that I am talking about, http://www.aki.com/kona I guess this is another MVC frameworks created by aki. Seems interesting, at least for me. In my opinion the struts framework is too complicated and requires too many steps to code some simple things. I have found myself writing JSP scriptlets too often. I know that struts fits best on larger projects where programmers have good knowledge of java and J2EE technologies. I would like to know if there is someone who has done some real work with both struts and kona. How do they compare? I think that struts has better support for localization, but doesn't give very many tools for example for db access (Bring Your Own Model or something). So what do you think?
Re: Has anyone used KONA? and how diffierent is it from struts?
take a look at www.dbforms.org It is built on top of struts and has tons of database support. I know this doesn't answer your kona question, but it is something to think about for database access. Thanks... quick question: Is dbForms intended to use as a replacement for struts or is it designed to use along with struts? Or something else?
Re: offtopic question
message: transaction isolation levels not supported. That let me suppose that both MS Access and MySql jdbc drivers do not support yet well the rowset package. I think that access and mysql doesn't support transactions or they do not support the isolation level that was requested by your application. ANSI SQL defines 4 isolation levels and if application wants to have let's say committed read isolation level and db doesn't support it or doens't support higher isolation levels (e.g. repeatable read or serializable) then they need to abort the transaction. Access is kind of one man db and it doesn't support transactions I think, but I'm not sure about MySQL, but what I can remember is that it doesn't support transactions.
Database Access
I'm currently using Struts connection pooling facilities from Action classes. Now I'm going to implement data access logic in my data access components, but I'm not sure that how can I still use struts based connection pooling. Do I have to transfer DataSource object or servlet ocject from Action to data access component, or can I get that directly from my data access component? I'm not using EJBs right now, because I'm still learning the basics. Can someone give me an example how to coordinate moving data from dao to value objects. Some class examples would be great. Or how in general is the best way to implement database interactions in struts (not using ejbs)? I know that it may depend on what you are doing, but is there some common pattern that can be used? -- Aapo Laakkonen, +358 (50) 33 99 682, ProjectCast Ltd, Helsinki, Finland.
RE: Custom tag question
Is it possible to have custom tags that can have both child elements and attributes? I mean that in some cases it would be more elegant to use elements instead of attributes: If your question is just - Is it possible? Then the answer is Yes. However, if you are asking for the current tags to implement this, that is a totally separate question. That would take some re-work. Hey, good idea: +1 :P But I imagine it'd have to me more like: bean:message key=text.welcome bean:message-arg0bean:write name=un property=firstname//bean:message-arg0 bean:message-arg1bean:write name=un property=firstname//bean:message-arg1 /bean:message Is this necessary? I think that child elements should be able to adapt the namespace from the mother element. Here is couple more examples, what I meant about this custom tag question: bean:message key=text.welcome argbean:write name=un property=firstname//arg argbean:write name=un property=lastname//arg /bean:message or bean:message key=text.welcome arg name=un property=firstname/ arg name=un property=lastname/ /bean:message or maybe even like this bean:message name=un key=text.welcome argfirstname/arg arglastname/arg /bean:message or bean:message key=text.welcome argun.firstname/arg argun.lastname/arg /bean:message or bean:message key=text.welcome arg name=unfirstname/arg arg name=unlastname/arg /bean:message I think that those who design custom tags for struts should consider on how to make those custom tags most flexible and then implement them. Everything as attributes on every custom tag is not always the best way to do it. Reusable tags is also one thing to consider. ex. there might be a need to define something like bean:arg tag that can be used with several elements: bean:message bean:arg name=keytext.welcome/bean:arg /bean:message html:form bean:arg name=nameLogon/bean:arg /html:form Kind Regards Aapo Laakkonen