Re: Populate two fields with one value
You should probably be doing this in your action class, not your JSP. If it should always be set to acc.firstName, then you could just hardcode a hidden field: input type=hidden value=${acc.firstName}/ On 5/18/07, Mansour [EMAIL PROTECTED] wrote: how to populate 2 fields in my action with one value ? for example I need to populate the first name and last name with one value for searching: s:form action=searchAccount method=post theme=xhtml h4 Search Account /h4 s:textfield label=id name=acc.id / s:textfield label=AccountName Contains name=acc.firstName id=fn / s:hidden name=acc.lastName value=${fn} / I tried this. This is not working. Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IDE for struts-enabled web application
I agree with Dave, MyEclipse is a decent/good IDE, and unbeatable for the price, if you're paid by the hour you'll make back the $50 quickly. You might also want to take a look at the Eclipse WTP, I have not used it personally but I believe it has tools for JSP editing. Also, you can probably get away with using Tomcat for development and deploying the war/ear to ServletExec occasionally to verify correct functioning. -ed On 3/30/07, Dave Newton [EMAIL PROTECTED] wrote: --- [EMAIL PROTECTED] wrote: I don't want to use MyEclipse too as my company won't be paying for it. Spend the $50; good grief. AFAIK nothing really supports S2 yet, although I don't know what the state of WW support was in any of the IDEs. d. Never miss an email again! Yahoo! Toolbar alerts you the instant new Mail arrives. http://tools.search.yahoo.com/toolbar/features/mail/ - 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: Book recommendations for performance tuning
I'd second that book recommendation. I've read it and there's a lot of good tips in there. On 3/22/07, Karr, David [EMAIL PROTECTED] wrote: One I like is Pro Java EE 5 Performance Management and Optimization, by Steven Haines. Note that Steven Haines is associated with Quest Software and Jprobe (and related products). Although the book uses some pictures from those products, it is not in any way a veiled ad for those products. In the one section where he discusses actual products, he clearly discloses his relationship, and gives a very even survey (not really a review) of the products on the market. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Time of displaying data on the page
Hi- Do you mean to say that the time difference is much less than the time from when you click the mouse, to when page is rendered in browser? In your code below, since you are using %=scriptlets% you are only going to measure the time that the Java servlet itself takes. This will not take into account the time for: - an action servlet to execute and forward to this JSP - any database access to generate the 'users' collection - translating the JSP to Java code (first time JSP is called) - the Java to be compiled to a servlet .class file (first time JSP is called) - streaming the generated HTML across your network to your browser - browser to load main.css - browser to render the page The best way to trace these is lots of debugging statements at strategic places in your code. However, the simple way is to use endTime to store the time that the JSP is executed. If you are using an Action class, store a Date into the session or request scope, and then in your JSP page, have Javascript code that stores a datestamp as well. By comparing these figures you can get an idea of how long some of these steps take. If you had a lot of data being displayed you could also get a fourth javascript function to run in body onload= so you could get a timestamp of how long it takes for the browser to render your page. Good luck, -ed On 3/20/07, puchacz [EMAIL PROTECTED] wrote: Hi Hi If anybody could tell me, how can I measure the time of displaying some data on the screen? code %@ include file=/WEB-INF/jsp/include.jsp% [EMAIL PROTECTED] import=bus.TimeHold% [EMAIL PROTECTED] import=java.util.Date% html link type=text/css href=./css/main.css rel=stylesheet media=screen head script language=JavaScript type=text/javascript function displayName(){ var myVar = document.getElementById(startTime).value; var myVary = document.getElementById(endTime).value; alert(Value is: + myVar + + myVary + + (myVary-myVar)); } /script % java.util.Date begin = new Date(); long pomocnicza; pomocnicza = begin.getTime(); % /head body onload=displayName(); c:out value=${startTime} / input type=text value=%=pomocnicza % id=startTime table width=100% tr td center display:table name=users export=false id=currentRowObject requestURI=listOfUsers.do decorator=view.Wrapper display:column property=name title=Name / display:column property=lastName title=Last name / display:column property=school title=School headerClass=table_head / /display:table /center /td /tr /table % java.util.Date end = new Date(); pomocnicza2 = end.getTime(); % input type=text value=%=pomocnicza2 % id=endTime/ /body /html /code The thing is that the time which in the pomocnicza2 is much more smaller then the time of displaying the page. How to check time after display the page? If anybody has any idea, please tell me!!! I sit on this problem for a such a long time, and nothing :(. Thnx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please help: Struts tags don't evaluate any expressions
I've done EL expressions like you want to do. Try using the -el version of the html tag: html-el:text property=num_linea[${i}]/ On 3/16/07, irene [EMAIL PROTECTED] wrote: Hi, I have a problem with Struts tags. I can't use any expression (EL, runtime) in the tag attributes : html:text property=num_linea[${i}] / html:text property=num_linea[%=i%] / The result is an error: Invalid argument looking up property: num_linea[%=i%] I suppose i have something wrong in my webapp configuration... I use tomcat 5, struts 1.2.9 Please help!!! -- View this message in context: http://www.nabble.com/Please-help%3A-Struts-tags-don%27t-evaluate-any-expressions-tf3413607.html#a9511739 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need Help -Urgent
Textarea doesn't support the maxlength attribute: http://www.w3.org/TR/html4/interact/forms.html#h-17.7 On 3/14/07, Sachin [EMAIL PROTECTED] wrote: Hi , i am using below snippet and i am getting the following error : TR TH class=tRightCP Description/TH TDhtml:textarea readonly=${isReadOnly} property=cpDesc *maxlength=** 2* //TD /TR Error: [3/14/07 14:57:52:094 EST] 715b61a9 WebGroup E SRVE0026E: [Servlet Error]-[/Pages/adjustReporting.jsp#40;139,8#41; *Attribute maxlength invalid according to the specified TLD]: org.apache.jasper.compiler.CompileException: /Pages/adjustReporting.jsp(139,8) Attribute maxlength invalid according to the specified TLD* please help me on this. -- Satheesh.C - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Two Struts validation problems
Chris is right, the zero occurs in the java.lang.Integer(String) constructor when it is passed a non-numeric string value. You would see this happen in your ActionForm and action class if you weren't using the validator. The same thing happens with a non-numeric in a java.lang.Double(String) constructor. For Struts 1.x, the question of Strings vs. native types in formbeans comes up about every 6 months, judging from the questions this week it seems it's that time again. The general consensus is that Strings preserve incorrect input for redisplay and don't do mysterious conversions like above, but if native types are used then the formbean can also be used as a data transfer object for the database layer, removing a set of DTO (a.k.a. DO, VO, etc) classes. Of course, using LazyDynaBeans and their ilk let you have the best of both worlds :-) -ed On 3/3/07, Christopher Schultz [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Oren, Oren Livne wrote: Dear Chris: Yes, other validations are working. For instance, I also have an intRange validation on the same integer field. If I type a letter for the integer field, it sets it to 0, displays it as 0, and says it's outside the permissible range (which happens to be 1-4). No errors on startup. Any idea what could go wrong? :( Should I use a String instead of int in my form for that field? I pretty much always use strings. If you have your field type set to java.lang.Integer, then its value will be either null of an actual number. It's possible that the converter used by the validator will set an invalid input to new Integer(0) just as a default value. So, for instance, if you enter foo in for a number, it comes back 0, when it should have been foo (at least, I would expect it to say foo and an error message). IMHO, a rejected form should come back to the user in exactly the same way it was submitted (plus error messages, of course). Using strings for all form fields /will/ work, but I'm not entirely sure it's necessary to make that happen. I just know that it works for me. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFF6c0b9CaO5/Lv0PARAt6qAJ49qun09ehwDYu0lpva3Cvyy0c7EACglUF2 fLHeh3/nKs3iQ2sgPG5XBXA= =jdT/ -END PGP SIGNATURE- - 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: DynaValidatorForm and BigDecimal problem
It has nothing to do with Struts, the error message is saying that commons BeanUtils cannot convert the string from the form submit into a BigDecimal. Turns out that your issue is BigDecimal is not as permissive as Double when it converts a non-numeric string to a BigDecimal. If a string is not a number, Double converts it to 0.0, but BigDecimal will throw an exception, even for an empty string. Struts copies screen fields to formbean fields in RequestUtils.populate() before it does anything else including validation. So, even though there's not a value in the field (actually *because* there's no numeric value!) populate() re-throws the exception that you are seeing. To get it to work you could create and register a custom converter that will do some checking on the string before it passes it to the BigDecimal(String) constructor. You will need a class that extends org.apache.commons.beanutils.converters.BigDecimalConverter, and register your custom converter by calling ConvertUtils.register(new your class(), BigDecimlal.class); Or, you could instead use an alternate approach that many (me included) recommend, of having all formbean fields be Strings. You would have a String display field and a second field that is a non-string, and have this populated by your action after validation succeeds. -ed On 3/1/07, Gundersen, Richard [EMAIL PROTECTED] wrote: Hi Has anyone had problems with BigDecimal and DynaValidatorForms? I've got a form with two fields (advisorFee and grossIncome) defined as java.lang.Double. I want to change them to java.math.BigDecimal because they are money fields. If I change advisorFee to BigDecimal, the validation fails when I enter a value into grossIncome, even though this is still a Double. This is the error I get: javax.servlet.ServletException: BeanUtils.populate org.apache.struts.util.RequestUtils.populate(RequestUtils.java:453) [Caused by]... org.apache.commons.beanutils.ConversionException org.apache.commons.beanutils.converters.BigDecimalConverter.convert(BigD ecimalConverter.java:117) This doesn't make any sense to me. Is it possible that it's a bug in 1.3.5? Why should changing the definition of one field change the behaviour of another (they are not linked in any way e.g. in the validation rules) Regards Richard Gundersen Java Developer Email: [EMAIL PROTECTED] Phone: 01618302398 Fax: 01618342536 London Scottish Bank plc 24 Mount Street Manchester M2 3LS - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation Framework and DispatchAction
Use a page field in your form (set this in your action class before you call form.validate()) and set page=x in your validation.xml file. The example below shows using a HTML hidden field page, which is a different way to set this page variable. http://struts.apache.org/1.x/struts-extras/dispatchValidator.html HTH, -ed On 12/28/06, Andy Foster [EMAIL PROTECTED] wrote: Thanks Wendy, Switching validation off in struts-config and invoking manually in each method where required will work. This can be done as follows: // validate ActionMessages errors = form.validate(mapping,request); if ( errors != null !errors.isEmpty() ) { saveErrors(request, errors); return mapping.getInputForward(); } This should solve my problem as each submitaction that requires validation validates the same set of data. However this will not work if there are three methods create and update both need to validate but each validate against a different set of parameters and the third submitaction does not validate. Regards Andy -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: 28 December 2006 16:46 To: Struts Users Mailing List Subject: Re: Validation Framework and DispatchAction On 12/28/06, Andy Foster [EMAIL PROTECTED] wrote: This validates at the action mapping level so in the above case it validates on update as well as create. How do you validate just against the create submitaction of the DispatchAction mapping? I would suggest turning off the automatic validation, and calling it manually when needed. Here's an article about it (though the motivation here is different): http://www.learntechnology.net/validate-manually.do -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -MY Original Message- Hi all, This is probably a common question but have struggled to find an answer so apologies if I have missed the obvious. Below is an example of issue: I have a page that uses a single form to hold all the display data but can perform the following multiple submit actions: Create - create as a new object Update - update the original The page calls /process_object.do which is represented by a DispatchAction that has a method for each submit action. This is simple to implement and is all working fine. I now turn to the validation framework I want to specify a rule to validate the name to 3 characters only when the submitaction is create and this is my problem. So the basic validation.xml entry is: form name=/process_object field property=name depends=minlength arg0 key=name.heading/ arg1 key=${var:minlength} name=minlength resource=false/ var var-nameminlength/var-name var-value3/var-value /var /field /form This validates at the action mapping level so in the above case it validates on update as well as create. How do you validate just against the create submitaction of the DispatchAction mapping? Regards, Andy Foster - 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: Preprocessing of request
On 12/15/06, Anil Kumar T [EMAIL PROTECTED] wrote: Hi ... Thanks to Ed and Frank for explaining this.. I understand it. One more question was .. is there a way to avoid mandatory calling it in all the sub actions, instead the call should happen automatically. For Ex : I believe .. when we instantiate a sub class by saying code SubClass subcls = new SubClass();/code, the base class constructor is called and then the sub class constructor is called (hope am correct). Some thing like this am looking at method level. I think am moving out of struts and getting into the concepts etc.. Use Frank's suggestion of declaring execute() in the base action (I would also declare it final so it can't be extended) and then define 'public abstract ActionForward realExecute(ActionForm form, ...)' which is called by the base action's execute() method. Since it's declared abstract, any class extending the base action MUST define the method. Coming to the actual point. I want to have the user name to be available in all the action class instances with less effort. During the login time I can get it from DB and then put it in session. And then in all the actions I need the user name/id for my processing. So as of now am getting the user name from session in all the actions. But looking for a better handling This is what I usually do, if it's just a user name it's not that big to worry about storing it in the session. There can even be a method in the base class, protected String getUserName() { ... }. You could also pass it as a cookie to the browser, but unless you encrypt it, someone could just change their cookie to a different user id. Browsers don't have any access to session variables and don't have to get sent back and forth to the client. -ed Any thoughts on this point.? Thanks regards, Anil. -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Thursday, December 14, 2006 9:03 PM To: Struts Users Mailing List Cc: Struts Users Mailing List Subject: Re: Preprocessing of request I'm glad Ed replied because I missed your reply Anil... I wasn't ignoring you :) Ed covered it well... when I do this, I tend to do it slightly different... I write an Action that has an extra empty method, realExecute()... execute() calls realExecute(), and any common code, like your transformation logic, is in execute()... then I extent this class to create the Actions for my application, I override realExecute(), and that's that. Same basic concept, just a slightly different structure. Still saying filter though :) Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Thu, December 14, 2006 9:59 am, Ed Griebel wrote: You would define a base action that extends org.apache.struts.action.Action and includes a method execute() or maybe a helper method doSetup(). Your action classes would then extend this BaseAction class and then one of the first things you would do in execute() would be to call super.execute() or super.doSetup(). But, like Frank said, it would be better to decouple your logic from Struts by implementing a servlet filter which will work regardless if using struts 1.2, 1.3, 2.0, or just plain old servlets+JSPs. HTH, -ed On 12/14/06, Anil Kumar T [EMAIL PROTECTED] wrote: Hi Frank, Referring to your response.. you might also be able to have a base Action that all your Actions extend from, and the base action does the transformation before the real work happens. This might work if you don't need the transformation to happen before that point. How does this works ? Theoretically I understand this, but how to implement this? I mean where do we mention our CustomizedBaseAction class name? some where in properties ? Can you tell me..? Anil. -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 13, 2006 1:03 AM To: Struts Users Mailing List Cc: 'user@struts.apache.org' Subject: Re: Preprocessing of request Your best bet most likely is a servlet filter. Do the transformation and stuff the transformed content in request as an attribute, then grab it later in your Actions. Which version of Struts are you using? If pre-1.3, modifying the RP is one of the few other options as Dave mentioned... you might also be able to have a base Action that all your Actions extend from, and the base action does the transformation before the real work happens. This might work if you don't need the transformation to happen before that point. If using 1.3.x, you could write a command to do it and modify the RP chain. If 2.x, an interceptor is probably the right answer. However, in all
Re: Preprocessing of request
You would define a base action that extends org.apache.struts.action.Action and includes a method execute() or maybe a helper method doSetup(). Your action classes would then extend this BaseAction class and then one of the first things you would do in execute() would be to call super.execute() or super.doSetup(). But, like Frank said, it would be better to decouple your logic from Struts by implementing a servlet filter which will work regardless if using struts 1.2, 1.3, 2.0, or just plain old servlets+JSPs. HTH, -ed On 12/14/06, Anil Kumar T [EMAIL PROTECTED] wrote: Hi Frank, Referring to your response.. you might also be able to have a base Action that all your Actions extend from, and the base action does the transformation before the real work happens. This might work if you don't need the transformation to happen before that point. How does this works ? Theoretically I understand this, but how to implement this? I mean where do we mention our CustomizedBaseAction class name? some where in properties ? Can you tell me..? Anil. -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 13, 2006 1:03 AM To: Struts Users Mailing List Cc: 'user@struts.apache.org' Subject: Re: Preprocessing of request Your best bet most likely is a servlet filter. Do the transformation and stuff the transformed content in request as an attribute, then grab it later in your Actions. Which version of Struts are you using? If pre-1.3, modifying the RP is one of the few other options as Dave mentioned... you might also be able to have a base Action that all your Actions extend from, and the base action does the transformation before the real work happens. This might work if you don't need the transformation to happen before that point. If using 1.3.x, you could write a command to do it and modify the RP chain. If 2.x, an interceptor is probably the right answer. However, in all these cases, a servlet filter would work, and would keep your transformation logic abstracted out of Struts itself, so one less thing to worry about if you upgrade versions later :) Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Tue, December 12, 2006 1:17 pm, O'Toole, Joe wrote: Hi My application receieves an xml request. I need to perform some transformation of this xml before performing business logic etc. Is there anyway I can configure through struts that I can invoke a java class that does this task as I don't want to perform it in the action or the model. Something like the plug-in element in the struts-config.xml that invokes a java class that adheres to correct interface for performing tasks when the app is starting/stopping. I cannot see where I can do this and I would really to make this task configurable and push it out from the action or model Thanks Joe - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Information transmitted by this e-mail is proprietary to Infinite Computer Solutions and / or its Customers and is intended for use only by the individual or the entity to which it is addressed, and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please notify us immediately at [EMAIL PROTECTED] and delete this email from your records. - 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: log4j configurations?
I've never used Exadel, but you can try to look for a WEB-INF/classes or WEB-INF/lib directory in your project, they are usually included in IDE-based execution. HTH, -ed On 12/13/06, Mallik [EMAIL PROTECTED] wrote: Hi friends i am working on struts in Exadel studio i am getting the error: -- log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.ConvertUtils). log4j:WARN Please initialize the log4j system properly. --- i go through google and every where saying that add log4j.properties to classpath but i don't know how to add to classpath in exadel studio please let me know how to overcome this problem thanks in advance ur's Mallik -- View this message in context: http://www.nabble.com/log4j-configurations--tf2813547.html#a7851592 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Query
Start here, it doesn't get much clearer than this, and google for unfamiliar terms: http://www.learntechnology.net/struts-lesson-1.do On 12/5/06, Jagaran Bubai Das [EMAIL PROTECTED] wrote: I hav done that... but how to install and run the sample application i am not clear.. it would be great if could get some simple steps and some simple application Narayanaswamy, Mohan [EMAIL PROTECTED] wrote: First download the struts from http://struts.apache.org/downloads.html and play with the sample programs. -Original Message- From: Jagaran Das [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 05, 2006 5:04 PM To: user@struts.apache.org Subject: Query Hi all, How to install a simple application in Struts? I am new to this field. Please let me know what is good way to start exploring STRUTS. Thanks in Advance Jagaran CAUTION - Disclaimer * This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system. ***INFOSYS End of Disclaimer INFOSYS*** This email is confidential. If you are not the addressee tell the sender immediately and destroy this email without using, sending or storing it. Emails are not secure and may suffer errors, viruses, delay, interception and amendment. Standard Chartered PLC and subsidiaries (SCGroup) do not accept liability for damage caused by this email and may monitor email traffic. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Find out what India is talking about on - Yahoo! Answers India Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it NOW - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Displaying a JSP in a pop-up window
The trick is to use the target=xx parameter in the generated a tag. Try something like this: In your jsp you will have html:link target=_blank action=SomeAction/. In your struts-config you will have action path=SomeAction forward=/mypage.jsp/action http://struts.apache.org/1.2.7/userGuide/struts-html.html#link http://www.onjava.com/pub/a/onjava/2002/10/30/jakarta.html?page=3 -ed On 12/5/06, Pierre Goupil [EMAIL PROTECTED] wrote: Hello, Strusters ! My question is quite simple. As you should have guessed : is there a way, in Struts / Tomcat to display a JSP, not in the main browser window but rather in a pop-up window ? This would but great for confirm requests, errors displaying and such. Regards, Pierre -- L'une des raisons pour lesquelles la vie est complexe C'est qu'elle a une partie réelle et une partie imaginaire. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to get a dynaform in the Action class ?
I prefer dynaforms as I don't need *any* explicit formbean classes. With a good-sized application there's 30 classes I don't need to maintain. For a further reduction, use Lazy-flavor Dyna beans, then no changes to XML are required, just change the action class and JSP. -ed On 12/1/06, Thomas Thomas [EMAIL PROTECTED] wrote: If u add a property in a bean, or remove ... I think u will have to change the code anyway and recompile ... 2006/12/1, Dave Newton [EMAIL PROTECTED]: From: Thomas Thomas [mailto:[EMAIL PROTECTED] There is not much code for a FormBean in Java ... I don't see the point to have it in XML Okay. Dave - 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: VALIDATION
The easiest way to do this is to turn off automatic validation in your struts-config.xml and manually call validation in your desired methods. Something like: ActionMessages errors = form.validate(mapping, request); if ( errors != null errors.size() 0 ) { LOG.warn(Errors detected!!); return mapping.getInputForward(); } HTH, -ed On 11/30/06, Juan Espinosa [EMAIL PROTECTED] wrote: hi to all, im having some problems with validation i have an action named RegisterCustomer with three methods and an object RegisterCustomer implements ModelDriven Customer customer = null; getModel showCustomerRegistrationView registerCustomer I want to know if could use validation in this way, telling validation to be used only in the medthod registercustomer and the results for this method validationOk - result registrationView validationFail - result registrationEnd I dont want to use the methods input and success, also in this action im using the interceptor Modeldriven the get the customer The customer is created upon a session parameter, if parameter is personal i create a Personal customer, if the parameter is enterprise i create a EnterpriseCustomer, both extends Customer class. This parameter class is loaded by another action SelectCustomer, that based in a pair of radio buttons load the parameter in the session. I had all working but i cant do the validation work Please help me ! Regards Juan - 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: VALIDATION
Sorry, I assumed you were using S1, I don't know how for s2. On 11/30/06, Juan Espinosa [EMAIL PROTECTED] wrote: Im using struts2, doing in this way works in struts2 In struts2 i have the object mapping and form?? -Mensaje original- De: Ed Griebel [mailto:[EMAIL PROTECTED] Enviado el: Jueves, 30 de Noviembre de 2006 10:51 a.m. Para: Struts Users Mailing List Asunto: Re: VALIDATION The easiest way to do this is to turn off automatic validation in your struts-config.xml and manually call validation in your desired methods. Something like: ActionMessages errors = form.validate(mapping, request); if ( errors != null errors.size() 0 ) { LOG.warn(Errors detected!!); return mapping.getInputForward(); } HTH, -ed On 11/30/06, Juan Espinosa [EMAIL PROTECTED] wrote: hi to all, im having some problems with validation i have an action named RegisterCustomer with three methods and an object RegisterCustomer implements ModelDriven Customer customer = null; getModel showCustomerRegistrationView registerCustomer I want to know if could use validation in this way, telling validation to be used only in the medthod registercustomer and the results for this method validationOk - result registrationView validationFail - result registrationEnd I dont want to use the methods input and success, also in this action im using the interceptor Modeldriven the get the customer The customer is created upon a session parameter, if parameter is personal i create a Personal customer, if the parameter is enterprise i create a EnterpriseCustomer, both extends Customer class. This parameter class is loaded by another action SelectCustomer, that based in a pair of radio buttons load the parameter in the session. I had all working but i cant do the validation work Please help me ! Regards Juan - 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: need help in Tag-lib
Propertiesid is probably a java.lang.Long, and at some point datain is this URL above, and the URL cannot be converted to a Long to be assigned to propertesid. To figure out which one it is, you could iterate thru the collection and log each element inside your action before the JSP is called. As far as having iterated fields populate into a vector (usable in your Action via a formbean, I assume?), there are many examples on the internet of how to do this, you could start with http://struts.apache.com or http://www.learntechnology.net/ HTH, -ed On 11/24/06, Prashant Saraf [EMAIL PROTECTED] wrote: Hi all.. I had following problem c:forEach var=data items=${requestScope.List} tr c:forEach var=datain items=${data} c:choose c:when test='${datain0}' c:set value=${datain} scope=session var=propertiesid/ tda href=edit?id=${datain}Edit/a/td /c:when c:otherwise tdc:out value=${datain} //td /c:otherwise /c:choose /c:forEach /tr /c:forEach It gives following error An exception occured trying to convert String http://localhost:7003/cctc/pic1; to type java.lang.Long (null) I am having one more problem.. can i assign value came from forEach which iterate from vector of bean to my useBean. if yes how. Thanks in advance -- Cup of Java + Suger of XML = Secure WebApp - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validation XMl entity
Struts validation is generally used only for validations of fields from HTTP submissions, check out http://struts.apache.org/1.x/faqs/validator.html If you need to validate an XML file, you may be able to use the Apache Digester classes (http://jakarta.apache.org/commons/digester/) or some of the J2SE java XML libraries. -ed On 11/24/06, Vishal Seth [EMAIL PROTECTED] wrote: Hi, Does struts validation support XML entity. Thanks Vishal MASTEK Making a valuable difference Mastek in NASSCOM's 'India Top 20' Software Service Exporters List. In the US, we're called MAJESCOMASTEK ~~ Opinions expressed in this e-mail are those of the individual and not that of Mastek Limited, unless specifically indicated to that effect. Mastek Limited does not accept any responsibility or liability for it. This e-mail and attachments (if any) transmitted with it are confidential and/or privileged and solely for the use of the intended person or entity to which it is addressed. Any review, re-transmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. This e-mail and its attachments have been scanned for the presence of computer viruses. It is the responsibility of the recipient to run the virus check on e-mails and attachments before opening them. If you have received this e-mail in error, kindly delete this e-mail from all computers. ~~ - 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: html form
In short, no. You should create hidden fields for each of the params you want to pass. On 11/22/06, temp temp [EMAIL PROTECTED] wrote: I have a html form form method=post action=/firegrant/jsp/fire_admin/awards/spec/check_out.jsp?sortFlag= ASCdisplay=50app_num=nullorg_name=nullfedShare1=nullfedShare2=nullrequest_nego=nullprog_name=nullcategoryCode=nulldept_type=nullstate=nullstatus=nullsys_program_id=4sortBy= 1changeOrder=N select name=display option value=10Display Options/optionoption value=10Show 10/option option value=20Show 20/option option value=50Show 50/option option value=100Show 100/option option value=200Show 200/option /select input type=submit name=go value=Go /td/form When I receive request posted from this form I don't get the parameter value display why? Is it safe to create url with several parameters as in the example above and post to that url ? - Sponsored Link Mortgage rates near 39yr lows. $420,000 Mortgage for $1,399/mo - Calculate new house payment - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: can not reach the jsp file
Does Welcome.do work correctly? I would first try to get that working because then you will know that your jsp's are in the correct directory and you are calling the do from the correct directory. If Welcome.do doesn't work, check out: - check that you have defined that *.do is mapped to Struts servlet in your web.xml file. There should be a servlet section which references org.apache.struts.action.ActionServlet and /WEB-INF/struts-config.xml, and a servlet-mapping that maps *.do to the action servlet. - check that your URL is to the correct path, e.g. if you deploy in test.war and your app server is on your machine listening on 8080, your url should be http://localhost:8080/test/Welcome.do and that should bring up your JSP If those are set up right, then: - You want to be able to tell where the problem is, if your action is not being called, or if it's not forwarding to your JSP - put some kind of logging (or a breakpoint if debugging) in your action to verify that your action class is being executed - print out the mapping you get (mapping.findForward()) to make sure that it exists and you haven't made a typo, and see what JSP it's going to forward to. - You have probably already done this, but make your jsp very simple, just htmlbodyh1hello/h1/body/html will do HTH, -ed On 11/16/06, Ken Hu [EMAIL PROTECTED] wrote: Dear All: I'm doing a simple strus test, but all I can see after I try to visit ShowDocs.do is a blank page. struts-config.xml: action-mappings action path=/Welcome forward=/welcomeStruts.jsp/ action path=/ShowDocs type=com.kenhu.cdms.servlet.ShowDocsAct forward name=success path=showDocs.jsp / /action /action-mappings My Action class: public ActionForward execute(ActionMapping mapping, ActionForm form, ServletRequest request, ServletResponse response) throws Exception{ return mapping.findForward(success); } I can not find anything wrong , could someone please tell me what's going on here ? Thanks -- 研發部 胡重威 Ken Hu [EMAIL PROTECTED] 孟華科技股份有限公司 http://www.mmti.com.tw 地址: 高雄市802苓雅區中正一路120號4F-7 電話: 07-7279337 分機: 120 傳真: 07-7279377 行動: 0937083880 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamically adding row!
It's worked for me using a LazyDynaBean as the formbean and java.util.Map as the contained object for a given property, and the framework does populate new records into the contained map for me. -ed On 11/15/06, Lance Semmens [EMAIL PROTECTED] wrote: I realize your field names have to comply with the struts naming (ie so that BeanUtils.setProperty() will work. But if your form has a collection that you are adding a record to, struts will not create a new record, add it to your form's collection then set the properties on it. Once you do the create and add, struts will then do the populate. That's why I suggested the ajax call to add the record to the server side struts form so that the subsequent post will populate the fields. -Original Message- From: Ed Griebel [mailto:[EMAIL PROTECTED] Sent: 14 November 2006 14:24 To: Struts Users Mailing List Subject: Re: Dynamically adding row! You can have a form auto-populate from the javascript-generated fields, you just need to be careful what you call the generated field names. It will be hard-coded and none too attractive, but it will work. Look at the rendered HTML to see what format the field names are as an example. HTH, -ed On 11/14/06, Lance Semmens [EMAIL PROTECTED] wrote: The least messy way is to post to an addRecord action which adds a blank record to your form. Form must be in session scope. This requires a page redraw so is less responsive but this is the approach I often use. If you add a row to your table using javascript, struts will not automatically populate your form with the new record(s) upon save so you will need to handle this in your action. Unless of course you use ajax (which you have said you don't want to do) to add the record to your struts form on the server. Display tags will work for both suggestions. The javascript option usually involves cloning an existing row and blanking out the fields. Lance. -Original Message- From: Balwinder [mailto:[EMAIL PROTECTED] Sent: 14 November 2006 10:05 To: Struts Users Mailing List Subject: Dynamically adding row! Hi All! I am trying to add a row in a table dynamically to add new record in Struts web application. Iam using struts 1.1 and need to implement non-Ajax solution. Will display tags has solution to this situation? Any help will be appreciated. Thanks and Regards, Balwinder Kumar - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 1.3.5 and Eclipse 3.2
YOu don't need to (and never should) extract TLD files from jars and put them into a WEB-INF directory in your war. Web app servers that follow servlet version 2.3 and up have been able to extract TLDs from jars. See for more information: http://struts.apache.org/1.2.9/userGuide/configuration.html#dd_config_taglib_23 -ed On 11/10/06, robin bajaj [EMAIL PROTECTED] wrote: Or actually you can just get it from your project structure, depending upon your jsp and tld location. Say your jsp is in WebRoot/ [[ webRoot/abc.jsp ]] and your tld is lying in web-Inf/struts-logic.tld {usual tooling/user practice} Then you can access the .tld as %@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic % I wonder why you dont have the actual .tld files in the web-inf folder of your webApp. If you actually don't then you can get them from Struts download site. Hope it helps, regards, robin Paul Benedict wrote: The taglib URI should be the the http:// address, not the /META-INF location. If you are unsure what the address is, open up the TLD files and see. -- Paul Bruno Melloni wrote: I have a strange problem, with Struts 1.3.5 in Eclipse 3.2. - struts-taglib-1.3.5.jar is in the classpath. - Inside the jar, in /META-INF/tld are the struts tld files. - I have the following in index.jsp: %@ taglib uri=/META-INF/tld/struts-logic.tld prefix=logic % logic:redirect forward=welcome / - Eclipse whines about the tag not being known. I even tried replacing the URI with http://struts.apache.org/tags-logic;, but no cigar. Any idea what is going on, and how to fix it? Thanks, Bruno - 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: Validation + multiple Submit buttons
You could turn off automatic validation in struts-config.xml and call it manually in the action method when you need validation. If you are using a recent version of Struts you can use LookupDispatchAction that will call a given method based on which button was pressed. http://struts.apache.org/1.2.7/api/org/apache/struts/actions/LookupDispatchAction.html HTH, -ed On 11/14/06, Andrew Martin [EMAIL PROTECTED] wrote: JS Free, clunky UI you don't have to tell us! But those are the restrictions we are working on. It basically means additional actions/forms/JSP's when we want to do anything of consequence. Usability is a big issue, but we can't do anyting about it. I don't think wrapping (nested) forms will actually work. certain form buttons are located in the middle of the 'main' form as they cater for a select option to another page. -Oorspronkelijk bericht- Van: Lance Semmens [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 14 november 2006 14:54 Aan: 'Struts Users Mailing List' Onderwerp: RE: Validation + multiple Submit buttons A JS free application? You can assume today's browsers have javascript, the web would break otherwise. Sure there are some cross platform issues but to go JS free is a tall order and will limit you to a clunky UI. If JS free is your direction, you could wrap your back button in a html:form that posts to a different action to your save. Lance. -Original Message- From: Andrew Martin [mailto:[EMAIL PROTECTED] Sent: 14 November 2006 13:36 To: Struts Users Mailing List Subject: Validation + multiple Submit buttons Hi, I have just begun to add validation to my forms using struts validator, which is quite nice. I have however a problem when I have more than one submit button on a form. For example I have a Save button and a Back button. The Back button is also a submit (instead of a standard button - basically because we are creating a JS free applciation!) Within the struts configuration the validate is set to true for this action with an input page defined. The validation is set to check certain fields are not empty. As both buttons call the same action the validation is called on both, but I do not want validation to occur on certain submit actions (namely the Back button) Ideally I would like to configure this in the XML Struts-config.xml or validation.xml but I am not sure if this is actually possible (I fear the worst) If anyone has any tips, much appreciated. Andrew - 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: Dynamically adding row!
You can have a form auto-populate from the javascript-generated fields, you just need to be careful what you call the generated field names. It will be hard-coded and none too attractive, but it will work. Look at the rendered HTML to see what format the field names are as an example. HTH, -ed On 11/14/06, Lance Semmens [EMAIL PROTECTED] wrote: The least messy way is to post to an addRecord action which adds a blank record to your form. Form must be in session scope. This requires a page redraw so is less responsive but this is the approach I often use. If you add a row to your table using javascript, struts will not automatically populate your form with the new record(s) upon save so you will need to handle this in your action. Unless of course you use ajax (which you have said you don't want to do) to add the record to your struts form on the server. Display tags will work for both suggestions. The javascript option usually involves cloning an existing row and blanking out the fields. Lance. -Original Message- From: Balwinder [mailto:[EMAIL PROTECTED] Sent: 14 November 2006 10:05 To: Struts Users Mailing List Subject: Dynamically adding row! Hi All! I am trying to add a row in a table dynamically to add new record in Struts web application. Iam using struts 1.1 and need to implement non-Ajax solution. Will display tags has solution to this situation? Any help will be appreciated. Thanks and Regards, Balwinder Kumar - 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 1.3.5 and Eclipse 3.2
I use the NitroX 2.x plugin for Eclipse (now BEA Web developer or somesuch) and I too have this problem occasionally. Usually when this happens doing Project-Clean... will clear it up as this forces the NitroX plugin to rebuild its internal database. It doesn't always work, though. -ed On 11/14/06, Bruno Melloni [EMAIL PROTECTED] wrote: I think I am being misunderstood. The problem is not related to building a WAR/EAR and running on an application server. Using the TLDs from the jars nor using the URI (thanks for the clarification Wendy) are fine for running in an application server. The problem is the annoying error message from the Eclipse editor. It is the Eclipse editor (or the WTP plug-in) that is not smart enough to recognize the taglibs unless they are physically in WEB-INF. From the messages in this thread that does not appear to be a problem with the pre-packaged MyEclipse distribution, but it does affect the vanilla Eclipse + manually added plugins - even if they are the latest versions. Hopefully this problem will go away in a future version of Eclipse and the WTP. Maybe they'll copy the MyEclipse solution, and if I understood James' comment correctly, it might just be a question of a simple rebuild. bruno -Original Message- From: Ed Griebel [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 14, 2006 9:54 AM To: Struts Users Mailing List Subject: Re: Struts 1.3.5 and Eclipse 3.2 YOu don't need to (and never should) extract TLD files from jars and put them into a WEB-INF directory in your war. Web app servers that follow servlet version 2.3 and up have been able to extract TLDs from jars. See for more information: http://struts.apache.org/1.2.9/userGuide/configuration.html#dd_config_ta glib_23 -ed On 11/10/06, robin bajaj [EMAIL PROTECTED] wrote: Or actually you can just get it from your project structure, depending upon your jsp and tld location. Say your jsp is in WebRoot/ [[ webRoot/abc.jsp ]] and your tld is lying in web-Inf/struts-logic.tld {usual tooling/user practice} Then you can access the .tld as %@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic % I wonder why you dont have the actual .tld files in the web-inf folder of your webApp. If you actually don't then you can get them from Struts download site. Hope it helps, regards, robin Paul Benedict wrote: The taglib URI should be the the http:// address, not the /META-INF location. If you are unsure what the address is, open up the TLD files and see. -- Paul Bruno Melloni wrote: I have a strange problem, with Struts 1.3.5 in Eclipse 3.2. - struts-taglib-1.3.5.jar is in the classpath. - Inside the jar, in /META-INF/tld are the struts tld files. - I have the following in index.jsp: %@ taglib uri=/META-INF/tld/struts-logic.tld prefix=logic % logic:redirect forward=welcome / - Eclipse whines about the tag not being known. I even tried replacing the URI with http://struts.apache.org/tags-logic;, but no cigar. Any idea what is going on, and how to fix it? Thanks, Bruno --- -- 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] - 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: setting an an html:text value with another html:text
This general approach would work, but if you can use JSTL, it could be written much cleaner as: c:set var=isReadOnlyc:out value=${editable} default=true//c:set ... html-el:text property=foo readonly=${isReadOnly}/ You may be able to get away with not even having the c:set statement and using just ${editable} On 11/14/06, Puneet Lakhina [EMAIL PROTECTED] wrote: On 11/14/06, Adam K [EMAIL PROTECTED] wrote: Hi all , I am attempting to do the following, and it obviously isn't working, but I was hoping someone on the list would point me to something that might work instead: I have this text field and I want to be able to alternate the readonly property from true and false. I tried to put in the below which is bolded html:text name=OrderForm property=shipTo readonly=WANTTOTOGGLE /html:text html:text name=OrderForm property=shipTo readonly=html:text name=OrderForm property=readonly/html:text /html:text Any thoughts or ideas as to how I could do that in a nice manner would be greatly appreciated. What is going to happen is that the action is going to toggle the value depending on a parameter comming in from the URL. so supposing your url has something like this http://foo.com/bar.do?editable=true Then you could have in your JSP logic:present parameter=editable logic:equal parameter=editable value=true bean:define id=isReadOnly scope=pagefalse/bean:define /logic:equal logic:notEqual bean:define id=isReadOnly scope=pagetrue/bean:define /logic:notEqual /logic:present logic:notPresent parameter=editable bean:define id=isReadOnly scope=pagetrue/bean:define /logic:notPresent So now your text box would have html:text property=foo readonly='%=new Boolean(pageContext.getAttribute(isReadOnly).toString()).booleanValue()%' / I know this is unclean but just doing bean write instead of the scriptlet thing didnt work for me. You could probably clean up the logic tags also. But i havent ever done JSTL so... thanks in advance for any thoughts or ideas. Hope it helps -- Puneet - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html messages tag
The error message is not related to the logic:messagesPresent tag. This error is caused by having an html:xxx form field tag (checkbox, file, text, textarea, password, etc.) that is not inside an html:form/html:form tag. Look at the erroring jsp's to see where this is the case. Often exception traces (if the JSP is compiled with debugging support) will contain the line in the JSP that caused the exception which can help a lot in localizing the problem. -ed On 11/13/06, Puneet Lakhina [EMAIL PROTECTED] wrote: I am using html messages tag to do custom formatting of my error messages on different pages. I have something like this logic:messagesPresent html:messages id=error bean:write name=error filter=false / /html:messages /logic:messagesPresent This usually works fine but under certain conditions I get Cannot find bean error in any scope javax.servlet.jsp.JspException: Cannot find bean error in any scope at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:938) at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:286) ... I don't understand this. If there are no messages then it shouldn't even come to bean write isn't it? I am using struts 1.1 and any errors are added in the validate method of the form bean. Thanks -- Puneet - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DispatchAction help?
You should do validation manually in your action. Set validation='false' in your struts-config.xml and call form.validate in the action methods that need to be validated on. For example, do something like this in a method: ActionMessages errors = form.validate(mapping,request); if ( errors != null errors.size() 0 ) { saveErrors(request, errors); return mapping.getInputForward(); // if action defines input= in struts-config.xml } -ed On 11/13/06, Mallik [EMAIL PROTECTED] wrote: HI friends i am using DispatchAction but i don't want to validate for some buttons and i want validate the data for some another buttons like suppose i have save (to add the data and go to view details page) for this validation should work Add more (to add the data and back to same page) for this validation should work cancel (just go back) for this validation should not work View (just go to View page) for this validation should not work how can i do this help me please Ur's Mallik -- View this message in context: http://www.nabble.com/DispatchAction--help--tf2620433.html#a7312355 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: logging initialization order
On 11/10/06, Ping Yu [EMAIL PROTECTED] wrote: Nov 9, 2006 2:35:23 PM org.apache.catalina.startup.HostConfig deployWAR INFO: Deploying web application archive test.war log4j:WARN No appenders could be found for logger (org.apache.commons.digester.Digester). log4j:WARN Please initialize the log4j system properly. digester.jar is in my classpath and I didn't use any log4j.property file in my application directly. This is exactly why you are getting the warnings. As I said last week, you need a log4j.xml or log4j.properties somewhere in your WAR classpath (under WEB-INF will work). I have the following questions: 1) Who initializes Digester logger? Tomcat or Struts? How to get to know? 2) When is Digester loaded? How can I get to know? I am using MyEclipse. Are there any ways to trace the loading of Digester logger? 3) Since I am not using log4j or Digester directly in my application, are there any ways that I can load my own log class before Tomcat/Struts load Digester logger? The digester is used by Struts to load XML configuration information for your web application, so therefore is instantiated when an app is deployed (as web.xml is procesed IIRC). Some apps use Jakarta Commons logging which allows one to change the logger that is used. Off the top of my head I don't know what Digester or Struts uses, you can probably google for this answer. But I think this is beyond the scope of your question. If you are not using log4j for your own application logging and don't care about messages from the Struts infrastructure, then just put a log4j.xml file with a minimum of info in it, see http://logging.apache.org/log4j/docs how to do this. You could create a context listener which is fired when the application starts up, but it is much simpler to just put a minimal log4j.xml file in your classpath, which would solve your problems with this. HTH, -ed - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: object[] to string[]
Maybe I'm just being pendantic, but this isn't really related to Struts at all. java.util.Arrays and java.util.Collections provide a lot of methods to transform between arrays and collections. You will find your answer after some reading and some experimentation. On 11/10/06, temp temp [EMAIL PROTECTED] wrote: I want contents of java.util.list as string array Object aObject[]= list.toArray(); How can I cast this to string []? Thanks Regards Miro - Everyone is raving about the all-new Yahoo! Mail beta. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: iterate through two collections
Try using bean:write name=collection2[indexId] /. indexId should be replaced with 0, 1, 2, ... as it iterates and the underlying BeanUtils will extract the n-th element from the collection. I don't think this will if you are using an unsorted collection (set, map) because they don't support get(int) On 11/10/06, Van Nguyen [EMAIL PROTECTED] wrote: Hi, I have two ArrayList that I need to iterate through: logic:iterate id=line indexId=indexId name=collection1 bean:write name=line / // write info contained in collection2 // something like this… but not working?? bean:write name=collection2[indexed] / /logic collection1 and collection2 will always have the same number of records… Any ideas? United Rentals Consider it done.™ 800-UR-RENTS unitedrentals.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: object[] to string[]
On 11/10/06, Martin Gainty [EMAIL PROTECTED] wrote: I dont know 'pendantic' so I would suggest System.arrayCopy as in (Sorry for being pedantic...) LOL, TGI Friday! :-) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem with moving jsp pages under web-inf/ folder
What happens when the JSP is converted to HTML, it is sent to the browser. The browser then tries to access the css and js files from the webserver, but since the HTML points to web-inf, it won't serve them. One way to do it is to create an action mapping that is just defined as a ForwardAction, e.g. action path=/css type=org.apache.struts.actions.ForwardActions parameter=/WEB-INF/css/my.css/ However, why do you need to protect the CSS and javascript files? Why not have them outside of the WAR files's WEB-INF directory, then your http would just have a simple script type=text/css file=${context_root}/css/my.css/ ? You are not going to keep anything secret by keeping them in WEB-INF because they are simple text files and anyone who looks at the generated HTML will see where the CSS comes from. On 11/9/06, robin bajaj [EMAIL PROTECTED] wrote: Hi Everybody, - SUMMARY - Can anyone tell me as to how can I make my jsp lying in Web-inf/jsp/ folder pick the stylesheet and javascript lying in Web-inf/scripts and Web-inf/css ?? - DETAILS - I have SSL enabled my web-app this morning using SSLext release 0 . I am using Struts 1.2.x with Tiles. Now I can switch from http to https etc. So,everything is working fine except that my jsp pages (and other images, css and javascript files) are still lying under WebRoot\ folder. To be specific - webRoot\jsp , webRoot\css, webRoot\images, webRoot\scripts have the corresponding resources. I want to avoid direct access to the jsp (and the static resources) from the browser (foreg: since my jsp pages are currently in webRoot\jsp, user can still access them using http://hostname:port//context-name/jsp/abc.jsp ) So I tried moving my jsp folder (and images, css, scripts folders) to webRoot\WEB-INF\ from webRoot. Since I am using tiles, I also updated the references to the jsps from /jsp/abc.jsp to --- /WEB-INF/jsp/abc.jsp Now when i go to my home page. My images, javascripts and css are not being applied to the jsp pages. I get plain white jsp page with contents. Just to make sure, that Tiles is not messing things up. I created a new JSP page - Web-inf\jsp\non-tiles.jsp And copied the contents of another jsp that uses javascript and css stylesheets. And forwarded my index.jsp to an actionForward that points to this non-tiles.jsp. Even this .jsp shows up without applying the css and javascript. So I thought its a path issue. I am accessing my javascript and css as script src=../scripts/oBCTS_scripts.js language=javascript type=text/javascript/script link rel=stylesheet type=text/CSS HREF=../css/styles.css Since my non-tiles.jsp is in Web-inf/jsp/ folder , and oBCTS.js file is in Web-inf/scripts/ folder (similary .css file is in Web-inf/css/styles.css) I think the above paths should resolve correctly. But they DO NOT and hence even my non-tiles.jsp shows up without applying the .css stylesheet and .js javascript effects. Just to prove it for myself, I copy-pasted the contents .css and .js files into the jsp itself and now access them as script type=text/javascript [...] /script style type=text/css [...] /style So this works fine. (After all... :-( Can anyone tell me as to how can I make my jsp lying in Web-inf/jsp/ folder pick the stylesheet and javascript lying in Web-inf/scripts and Web-inf/css ?? Thanks in advance, robin - 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: problem with moving jsp pages under web-inf/ folder
You're getting blank pages or no styles because ${context_root} is not a real variable, the string ${context_root} may even be in your generated HTML, which would be way wrong. Actually, ${context_root} was a placeholder for the correct variable that I didn't know the exact value of off the top of my head, you probably want to use ${requestScope.contextPath}. If you're not in a JSTL 2.0 environment you'll have to surround it with c:out value=.../. Also, the path after the ${} will have to match what directory you put it into when you build your war file. -ed On 11/9/06, robin bajaj [EMAIL PROTECTED] wrote: Hi Ed, Thanks for the suggestion, I agree with you. But when I changed my JSP Web-inf/jsp/non-tiles.jsp to point to my .css and .js in your suggested way, I get weird behaviour in the browsers. In IE 6, I get a blank page *(yes a totally white blank page) In Mozilla firefox 2.0 , I get simple content (as before making this changes) without applying the stylesheets... what am I doing wrong now. Here's non-tiles.jsp code , may be you can spot the culprit. -- %@ page language=java% %@ taglib uri=http://struts.apache.org/tags-bean; prefix=bean % %@ taglib uri=http://struts.apache.org/tags-html; prefix=html % %@ taglib uri=http://struts.apache.org/tags-logic; prefix=logic % %@ taglib uri=http://struts.apache.org/tags-tiles; prefix=tiles % html:html head titleadfasdf/title script src=${context_root}/scripts/oBCTS_scripts.js language=javascript type=text/javascript/script script type=text/css src=${context_root}/css/styles.css/ /head body class=sidebar dl id=menu %-- html:button property=Back onclick=location.href='default.do'Back/html:button --% dt onclick=javascript:show();a href=navigatePatient.do?do=getFirstPatientAdd New Patient/a/dt dt onclick=javascript:show();a href=listPatients.doView Working List/a/dt %--dt class=level1Menu onclick=javascript:show('smenu3');Access Patient Roster/dt--% dt onclick=javascript:show();a href=myAction.do?do=addBookAccess Patient Roster/a/dt dd id=smenu3 ul lia href=myAction.do?do=addBookHistory/a/li lia href=myAction.do?do=addBookClinical Presentations/a/li lia href=myAction.do?do=addBookFamily Malignancies/a/li lia href=myAction.do?do=addBookComorbidities/a/li dl id =menu2 dt style=text-align:right; onclick=javascript:show('ssmenu1'); Treatments*/dt dd id=ssmenu1 ul lia href=myAction.do?do=addBookNeo Adjuvant/a/li lia href=myAction.do?do=addBookSurgery/a/li lia href=myAction.do?do=addBookAdjuvant Chemo/a/li lia href=myAction.do?do=addBookHormonal/a/li lia href=myAction.do?do=addBookBiologic Agents/a/li lia href=myAction.do?do=addBookClinical Trial/a/li /ul /dd /dl %-- lia href=myAction.do?do=addBookImages/a/li --% %-- robin: Check with M if this is required here. --% lia href=myAction.do?do=addBookPathologies/a/li lia href=myAction.do?do=addBookBiopsies/a/li lia href=myAction.do?do=addBookClinical Evaluation/Follow-ups/a/li /ul /dd %--dt onclick=javascript:show('smenu4');View Images/dt--% dt onclick=javascript:show();a href=myAction.do?do=addBookView Images/a/dt dd id=smenu4 ul lia href=myAction.do?do=addBookMammograms/a/li lia href=myAction.do?do=addBookX-Rays/a/li lia href=myAction.do?do=addBookBone Scans/a/li lia href=myAction.do?do=addBookCT Scans/a/li lia href=myAction.do?do=addBookUltrasound Scans/a/li lia href=myAction.do?do=addBookMRI Studies/a/li /ul /dd /dl /body /html:html - Original Message - From: Ed Griebel [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, November 09, 2006 4:44 PM Subject: Re: problem with moving jsp pages under web-inf/ folder What happens when the JSP is converted to HTML, it is sent to the browser. The browser then tries to access the css and js files from the webserver, but since the HTML points to web-inf, it won't serve them. One way to do it is to create an action mapping that is just defined as a ForwardAction, e.g. action path=/css type=org.apache.struts.actions.ForwardActions parameter=/WEB-INF/css/my.css/ However, why do you need to protect the CSS and javascript files? Why not have them outside of the WAR files's WEB-INF directory, then your http would just have a simple script type=text/css file=${context_root}/css/my.css/ ? You are not going to keep anything secret by keeping them in WEB-INF because they are simple text files and anyone who looks at the generated HTML will see where the CSS comes from. On 11/9/06, robin bajaj [EMAIL PROTECTED] wrote: Hi Everybody, - SUMMARY - Can anyone tell me as to how can I make my jsp lying in Web-inf/jsp/ folder pick the stylesheet and javascript lying in Web-inf/scripts and Web-inf/css ?? - DETAILS - I have SSL enabled my web-app this morning using SSLext release 0 . I am using Struts 1.2.x with Tiles. Now I can switch from http to https etc. So,everything is working fine except that my jsp pages (and other images, css
Re: Struts problem, random properties after every restart of server
I have never experienced this problem, so this is a guess. Since it always comes up in German, it seems like the German locale is set somewhere either in the app server or operating system configuration. Did you check the locale setting on your client's machine and for the user that Orion is running under? In Redhat there's about 3 places that Locale can be set too. A problem like this could be caused by a web server or an OS configuration, so if you don't have Orion-specific code, you could try running it on another open-source app server on your client's system to try to isolate that problem. -ed On 11/8/06, Philippe Schober [EMAIL PROTECTED] wrote: Hi, I am using Struts on Orion 2.0.5 and have some languages (de, sv, en, tr and so on). en is the default language (ApplicationResources.properties). The problem I have only occurs on the clients online system. It is not reproducable on our test systems, his test systems or locally. After each restart of the server some texts are in english, some in german. It just mixes up. Those texts are always the same until the next restart. So changing the locale, reloading the page or whatever doesn't change the result. Only restarting the server does. So it seems to be a caching problem. I am aware of bug STR-2925 but think that I have avoided that problem. The strange thing is that it always seems to be german that mixes up with other languages and none of the others. We mirrored the server and tried to reproduce it but the problem just didn't show up. Does anyone have any ideas? Our client is very upset and we are forced to act. The last resort would be to replace Struts but that would be something we all want to avoid at all costs. Cheers, Philippe Schober - 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 recover a map of a bean in a select list of the jsp and to post the data ?
You need to use either logic:iterate or c:forEach to iterate over your beans. This deals with arrays but is useful for how to use the iterator and how to populate a select list: http://husted.com/struts/tips/006.html HTH, -ed On 11/6/06, nalimoussa [EMAIL PROTECTED] wrote: Hi everybody, I have to create a map in a bean which recovers the data of a table, I would like post(integrate) these data in a select list of a JSP? Regards, Nabil. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DynaActionForm indexed properties
If you are using basic arrays you need to create an array for the item before the JSP is displayed. You might want to use a java.util.List instead, you don't need to pre-allocate when using Dyna forms. HTH, -ed On 11/2/06, Puneet Lakhina [EMAIL PROTECTED] wrote: Hi, This is the first time I am trying to use indexed properties with DynaActionForm. Now the number of fields that I will have is not certain. So does that mean I cant use DynaActionForm. And i don't have normal strings in my list. I have a custom object. so what i have currently is something like this form-bean name=dynaForm type=org.apache.struts.action.DynaActionForm form-property name=number type=mypackage.Number[] / /form-bean I cant specify any size because I don't know the size before hand. So this has no problems loading the page, but on submit it throws an ArrayIndexOutOfBoundsException. -- Puneet - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: logging system initialization
For a WAR file you are going to deploy: create a log4j.properties or a log4j.xml file and get it into your warfile under WEB-INF/classes. The actual process of doing this differs if you are using Maven, an IDE deployer (e.g. JDeveloper or WSAD), or Ant to generate and deploy a WAR. For a webapp running within an IDE, you will need to put the file in a directory in your deployed application's classpath. This is highly specific based on what IDE and plugins you are using, but usually this will be the WEB-INF/classes directory. It could also be placed in an arbitrary directory and the webapp's classpath should then include this arbitrary classpath. If this has nothing to do with a webapp, then it is not even tangentially a Struts issue but you will still want to create a log4j.properties or log4j.xml file and have that on the classpath when executing whatever app you are using. HTH, -ed On 10/30/06, Ping Yu [EMAIL PROTECTED] wrote: People in the list, I have my own log.java, and I would like to make a call to my own log definitions before initialize/using the digester (org.apache.commons.digester.Digester). However, I have no idea how to call my own log first. Any suggestions? Thank you very much! Right now, I am always getting the log4j warning. Ping - Get your email and see which of your friends are online - Right on the new Yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: logging system initialization
...but note that unless you are dong something fancy, log4j doesn't need any separate initialization steps as long as the log4j config file is set up properly and in the classpath so log4j's static initializer can find it. One problem I have run into before is when there are two log4j.xml files in the classpath, the first one log4j finds is what is used, which is probably not the one intended. -ed On 10/30/06, Chris Pratt [EMAIL PROTECTED] wrote: If you need to initialize anything before the rest of the system gets a hold of it (like logging), use a javax.servlet.ServletContextListener and process the contextInitialized() event. It gets called before anything else in the context gets initialized. (*Chris*) On 10/30/06, Ed Griebel [EMAIL PROTECTED] wrote: For a WAR file you are going to deploy: create a log4j.properties or a log4j.xml file and get it into your warfile under WEB-INF/classes. The actual process of doing this differs if you are using Maven, an IDE deployer (e.g. JDeveloper or WSAD), or Ant to generate and deploy a WAR. For a webapp running within an IDE, you will need to put the file in a directory in your deployed application's classpath. This is highly specific based on what IDE and plugins you are using, but usually this will be the WEB-INF/classes directory. It could also be placed in an arbitrary directory and the webapp's classpath should then include this arbitrary classpath. If this has nothing to do with a webapp, then it is not even tangentially a Struts issue but you will still want to create a log4j.properties or log4j.xml file and have that on the classpath when executing whatever app you are using. HTH, -ed On 10/30/06, Ping Yu [EMAIL PROTECTED] wrote: People in the list, I have my own log.java, and I would like to make a call to my own log definitions before initialize/using the digester ( org.apache.commons.digester.Digester). However, I have no idea how to call my own log first. Any suggestions? Thank you very much! Right now, I am always getting the log4j warning. Ping - Get your email and see which of your friends are online - Right on the new Yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session tracking in struts?
To answer your question: 1) create a filter that does your tests for a valid session but only check it if the isNewSession flag in a session is not set. When you find a bad session, call session.invalidate() and forward to an action-forward for the login page. You should add redirect=true to the action-forward so that the browser will load the login page as if they were coming in the first time. If you need to have the sessionExpire page you can have it display and either embed a button that will bring user to the login page or have a meta redirect tag that redirects them after x seconds. The real question is, why are you going to re-check authentication every time they go in, is there anything more you need to check for it to be a valid session? Remember that a given browser's requests will always go to the same session; so once they are validated, you can set a flag in the session that they have been validated and don't worry about re-authentication. -ed On 10/28/06, Mallik [EMAIL PROTECTED] wrote: HI friends In my application i want to test session valid or not before affaring any service to the user. that means, once the user logon, i will maintain a session and for any request thenafter upto logout i need to test that session is valid, otherwise i need to display sessionExpire page and requires relogin. please let me know that how to do it? ur's Mallik -- View this message in context: http://www.nabble.com/Session-tracking-in-struts--tf2527634.html#a7045712 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tags nested
Or in a JSP 1.0 environment, use the EL Struts libraries: html-el:link action= ... On 10/27/06, Mikolaj Rydzewski [EMAIL PROTECTED] wrote: Juanjo Cuadrado wrote: html:link action=bean:write name='dataQueries' property='action' / bean:write name=dataQueries property=name / /html:link I think that JSP spec firbids this. The inner bean.. is ok, however. I'd use JSTL because it is much shorter. html:link action=${dataQueries.action${dataQueries.name}/html:link -- Mikolaj Rydzewski [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: new line char in xml
To generate a blank line I've used xsl:text /xsl:text HTH, -ed On 10/26/06, Chris Pratt [EMAIL PROTECTED] wrote: You can't specify a newline character in XML. XML specifically normalizes all whitespace out of the data. If you need to handle data that contains specific formatting, you need to apply that formatting yourself, either using a technique like HTML (inserting br/ elements in the XML) or using something like XSL-T (and the xsl:preserve-whitespace element). (*Chris*) On 10/26/06, Martin Gainty [EMAIL PROTECTED] wrote: CR LF -or- #0D #0A M- This e-mail communication and any attachments may contain confidential and privileged information for the use of the designated recipients named above. If you are not the intended recipient, you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it or its conte - Original Message - From: temp temp [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Thursday, October 26, 2006 1:53 PM Subject: Re: new line char in xml Here is my xml could you tell me how to put new line char?. Here is my xml amendment-letter pop letter= You are requesting a one-year, no-cost extension to the period frrf of performance for agreement number ? until ?. \n Retain this document in your official grant file. / /amendment-letter Li [EMAIL PROTECTED] wrote: have you tried \n? it should work On 10/27/06, temp temp wrote: I have some text in xml file which I will show in a text area to edit . I don't know how to specify a new line char in xml. Currently I am using tag instead of a new line char .Using works in jsp but a text area displays them as which would confuse user .So I need to put the new line char in xml which will be understood by the browser as new line .Please somebody guide me how to put new line char in xml. regards Miro - Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min. -- When we invent time, we invent death. - Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to show downloadable link using FormFile class .
What I have done in this situation is - obtain a list of valid files and create an identifier or token for each one (usually as simple as the name of the file) corresponding with the identifier expected in the action described below - throw the list of files into a List in the request/session/formbean - iterate thru this list in the jsp, displaying a hyperlink for each one with html:link - each hyperlink points to the action below, with the file ID as a param on the hyperlink, likely with an embedded target='_blank' in the link so it is displayed in its own page - Extend DownloadAction and implement getStreamInfo method. The getStreamInfo method should instantiate and return a StreamInfo class that will retrieve and stream a file to the browser, setting MIME type in the header appropriately. This method will read an application-specific identifier from the form bean to know what file to serve up. In your situation, your method or StreamInfo class will likely pull the blob from the database as a byte array and set up this byte array as an InputStream. your DownloadAction superclass will automatically hand this stream to the browser. - Add an action-mapping to the action HTH, -ed On 10/25/06, Anuraag Shinde [EMAIL PROTECTED] wrote: Hi, In my application i need to allow user to upload files, View list of uploaded files and download a specific file. I have sucessfully configured my application to upload the file using FormFile as type for my file field. Now the problem is how to Get data from database and show a downloadable link. There are n number of examples for file upload but none of them cover the download part. i.e Getting file from database which is stored as blob and display a downloadable link on browser. Any suggetion will be a great help - Thanks and Regards Anurag Shinde. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to show downloadable link using FormFile class .
For 1.1, you could try extending Servlet or a generic Action which will redirect the InputStream to the servlet response writer. You will have to do some of the busywork yourself like getting the writer and setting up the InputStream yourself. Can't help you with the blob stuff, but my guess is that there is a way to transform resultsset.getBlobl(), maybe even java.sql.Blob.getBinaryStream() would suit your purposes? http://java.sun.com/j2se/1.3/docs/api/java/sql/Blob.html -ed On 10/25/06, Anuraag Shinde [EMAIL PROTECTED] wrote: Thanks a lot friend for ur detailed explanation, But the problem is DownloadAction came with struts 1.2 and i am using 1.1 :( And i am saving the file in databse as blob. I can get content using resultset.getblob(file) but what after that ? How can i transfer this to my formbean's file field ?? On 10/25/06, Ed Griebel [EMAIL PROTECTED] wrote: What I have done in this situation is - obtain a list of valid files and create an identifier or token for each one (usually as simple as the name of the file) corresponding with the identifier expected in the action described below - throw the list of files into a List in the request/session/formbean - iterate thru this list in the jsp, displaying a hyperlink for each one with html:link - each hyperlink points to the action below, with the file ID as a param on the hyperlink, likely with an embedded target='_blank' in the link so it is displayed in its own page - Extend DownloadAction and implement getStreamInfo method. The getStreamInfo method should instantiate and return a StreamInfo class that will retrieve and stream a file to the browser, setting MIME type in the header appropriately. This method will read an application-specific identifier from the form bean to know what file to serve up. In your situation, your method or StreamInfo class will likely pull the blob from the database as a byte array and set up this byte array as an InputStream. your DownloadAction superclass will automatically hand this stream to the browser. - Add an action-mapping to the action HTH, -ed On 10/25/06, Anuraag Shinde [EMAIL PROTECTED] wrote: Hi, In my application i need to allow user to upload files, View list of uploaded files and download a specific file. I have sucessfully configured my application to upload the file using FormFile as type for my file field. Now the problem is how to Get data from database and show a downloadable link. There are n number of examples for file upload but none of them cover the download part. i.e Getting file from database which is stored as blob and display a downloadable link on browser. Any suggetion will be a great help - Thanks and Regards Anurag Shinde. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- - Thanks and Regards Anurag Shinde. Ph : 9823014942 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Drag-and-drop struts-aware IDE?
Yes, this is the issue with Struts, it's hard for an OSS product to compete with the .Net marketing juggernaut. MS seems to be happy trotting out their dog-and-pony show to anyone who will look at it. The source control, code checking, etc. components in Eclipse match closely to what VisualStudio has, just not out of the box unfortunately, and there's nobody going around giving demos of Struts + Eclipse, at least not for free. -ed On 10/25/06, Bruno Melloni [EMAIL PROTECTED] wrote: Probably because managers are always looking for the famous silver bullet that will allow them to use untrained developers in half the time... Yes, it is a dream, but it is the dream being sold by Micro$oft for .NET, and showing a tool that does it for Struts is the first step to avoid the miriad of problems caused by using .NET and Visual Studio. The lesser of two evils and all that. Anyway, the Exadel Studio mentioned by Juan looks promising. It seems to allow drag-and-drop layout while preserving the basic coding model. bruno -Original Message- From: Leon Rosenberg [mailto:[EMAIL PROTECTED] Sent: Monday, October 23, 2006 6:43 AM To: Struts Users Mailing List Subject: Re: Drag-and-drop struts-aware IDE? snip... I'm. Drag and Drop may save you some time at the beginning and will cost you thrice the time later. Why are people so hot for drag and drop and are ignoring the evidence that it never works? regards Leon - 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: Performance of my code
On 10/24/06, Daniel Chacón Sánchez [EMAIL PROTECTED] wrote: Hi all, this is not a question about struts, but is a question about java, Well then it probably shouldn't be asked here :-) Is there a tool that let me check performance issues in my code, like example the variables that I declared but never used? Anyway, your example is more about static analysis than [speed or memory] performance; Eclipse will do some basic static analysis, also look at: http://findbugs.sourceforge.net/ http://pmd.sourceforge.net/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Debugging struts applications with eclipse
This should answer all your questions: http://tomcat.apache.org/faq/development.html Google is your friend, this is the first link for tomcat eclipse debugging search. -ed On 10/24/06, Joe Yuen [EMAIL PROTECTED] wrote: Can anyone tell me how to debug an application running under tomcat? Is there any special setup I have to do in eclipse? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Validation DTD
(Redirecting response to user list where this type of question belongs...) You can swap in the new validator version without any changes to the rest of your application; the commons-validator team run a regression test at the binary level. This page has a complete list of what jars need to be updated: http://wiki.apache.org/jakarta-commons/ValidatorVersion120 We upgraded to 1.2 validator in struts 1.2.8 and only had to update 2 JARs, collections and beanutils. Note that the MANIFEST.MF in the 1.7 version of beanutils says that it is 1.6.2, the best way to see what version you have is to either compare the size of the jar file with that on an official commons-beanutils download site, or run 'sum' or 'md5sum' on the jar file and compare it to the md5sum on the commons-beanutils download site. -ed On 10/23/06, Enzo [EMAIL PROTECTED] wrote: Excuse my dropping in the matter... I am not so experienced on the versions of the various jars, but I have got the same problem with struts custom validator, tiles ecc... my question is: is it possible to raise the commons validator version to solve this problem and not to raise also the struts version ? without impacts ? is there a sort of compatibility matrix for the various jars? - 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: Forward Action to Action
The easiest is to put your data as attributes in the request scope with request.setAttribute( name, value), and then extract them in the second action with 'MyClass value = (MyClass) request.getAttribute(name)'. You can also put the attributes in the session scope, but you need to remember to remove them when you are done with them. If the second action is to be called as a regular action and therefore need params in the formbean, you could try creating a formbean of the type the second action is expecting and then store it in the request scope under the name expected. The problem with this is that hardcoding a name/class is involved and now your implementation is tightly coupled to the class and name of the second action's formbean. As long as you are doing this kind of hardcoding you could in the second action see if the first action's formbean is in the request/session and extract params from there. HTH, -ed On 10/21/06, Jean-Marie Pitre [EMAIL PROTECTED] wrote: Hi, I would like to forward an Action to another one. My problem is : I want to pass a data from my first first action to my second formbean (second action). I tried to do a setattribute in my first action before calling mappingfindforward and in my second formbean to create an acessor but the formbean is never populated. Have you got and idea ? is it possible and correct to do that ? Thanks, Regards JMP. --- Email Disclaimer http://www.cofidis.be/emaildisclaimer.php - 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: html form instantiating form bean
You should not instantiate manually your own formbean nor put it into the request scope, you must use the formbean passed into your action class via the ActionForm object. When you get the handle to the formbean you can either cast the formbean to it's real class or you can use BeanUtils.populate(formbean, param_1, value1) to get your values into the formbean. Hopefully I have not missed the point of your question. HTH, -ed On 10/11/06, Puneet Lakhina [EMAIL PROTECTED] wrote: Hi, This has to be one of the most bewildering thing I have faced in my 3 months of learning struts. Now I have an action(PreapreAction) which I use to prepare a page for display. This for fetches values from a Database and creates an instance of the formbean and puts values into the form bean. Now i do request.setAttribute(formBeanName,formBeanObject). And then forwards to the page which has something like this html:form action=/fooAction .. /html:form the fooAction has formBeanName as its form bean defined in the struts config. But Im not able to get any values into the fields in my form. However if I do this bean:write name=formBeanName property=someProperty /. It prints the correct value i.e. the value that I set in the PrepareAction. Does this mean that there are two form bean in the request scope. but theere cant be two attributes with the same name. So i printed all the attribute names and their class in my jsp page. Turns out there is another attribute of type formBeanObject in my request under the key org.apache.struts.taglib.html.BEAN Why is this happening?? I even tried using they key org.apache.struts.taglib.html.BEAN in my PrepareAction but still ti does not work. SO i printed a message from the default constructor of my form bean. Thats printed twice, once when i instantiate it in PrepareAction and again when the page is loaded. Plz plz help me sort this out. -- Puneet - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: render trademark symbol
You could create a filter and put it in the chain that would display that page. You would do something like: - get a handle to the original response writer - extend HttpServletResponseWrapper to capture the output - pass in an instance of above to chain.doFilter() - parse the response, looking for (TM) and replace it. + This could be as simple for prototyping as String out = wrapper.toString().replaceAll( /*unicode for TM*/(TM), trade;); - write the string above to the original response writer There are more efficient ways to change the (TM), but the above will get the job done, at least as a proof-of-concept. If you can limit the filter to only a few pages in the app and the page generated is not big, you may get away with the above code. -ed On 10/11/06, Van Nguyen [EMAIL PROTECTED] wrote: OK... so I've been playing around with this for the pass day. 1. I don't want to store the trademark symbol as trade; in my lucene index. 2. I could write a method to detect the TM symbol and then encode it to trade; and then use the filter=false in the bean:write tag. But is there a more elegant way about this? -Original Message- From: Van Nguyen Sent: Tuesday, October 10, 2006 11:59 AM To: Struts Users Mailing List Subject: RE: render trademark symbol Ok... setting the filter to false works. Thanks! -Original Message- From: Ed Griebel [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 11:26 AM To: Struts Users Mailing List Subject: Re: render trademark symbol Sorry, escapeXml is for c:out /, Nuawn is right, filter=false is what you are looking for. On 10/10/06, Nuwan Chandrasoma [EMAIL PROTECTED] wrote: hi, set the filter attribute of bean:write tag to false and try - Original Message - From: Van Nguyen [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, October 10, 2006 6:14 PM Subject: RE: render trademark symbol Is escapeXml an attribute for the bean:write tag? I do not see that in the Struts 1.2.9 API. -Original Message- From: Ed Griebel [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 11:05 AM To: Struts Users Mailing List Subject: Re: render trademark symbol bean:write may be escaping the amp; so maybe you could try adding escapeXml=false inside the bean:write tag. -ed On 10/10/06, Van Nguyen [EMAIL PROTECTED] wrote: That displays: (r) We need it to display: (tm) -Original Message- From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 10:33 AM To: Struts Users Mailing List Subject: Re: render trademark symbol use #174; HTH M- This e-mail communication and any attachments may contain confidential and privileged information for the use of the designated recipients named above. If you are not the intended recipient, you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it or its contents - Original Message - From: Van Nguyen To: user@struts.apache.org Sent: Tuesday, October 10, 2006 1:13 PM Subject: render trademark symbol Hi, I'm using struts 1.2.9 and am running into a problem rendering the trademark symbol using the bean taglib. I have this string stored in my lucene index as: W.RoseT Convex Jointer It stores it in my bean as such. but when I use the bean:write tag, it displays it as: W.Rose? Convex Jointer I added some breakpoints in the WriteTag class inside the struts library, and I see that it comes in as W.RoseT Convex Jointer And it is being returned as the same string. Is there anything else that needs to be done to render the Trademark symbol as T? I've read online that HTML needs it to be trade; to render correctly. But I've tried changing the text in the bean to: W.Rosetrade; Convex Jointer But that did not work either. the bean:write tag just displays it as W.Rosetrade; Convex Jointer Any suggestions? -- United Rentals Consider it done.⢠800-UR-RENTS unitedrentals.com -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] United Rentals Consider it done.(tm) 800-UR-RENTS unitedrentals.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail
Re: content management system
http://opensourcecms.com will tell you all you need to know, it even has demos set up for every CMS. Now, as this has absolutely nothing to do about Struts, can further conversations occur offline? Thanks. -ed On 10/10/06, Stein Erik Berget [EMAIL PROTECTED] wrote: On Tue, 10 Oct 2006 14:12:05 +0200, Gomathi [EMAIL PROTECTED] wrote: hai, I want to use content management system in my project .We dont know about this much. Which content management tool is best one.whether it is possible to use struts and ajax and hibernate and all those things. we need very urgent thanks in advance Depending on your requirements, you could check out http://www.escenic.com/ -- Stein Erik - 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: render trademark symbol
bean:write may be escaping the amp; so maybe you could try adding escapeXml=false inside the bean:write tag. -ed On 10/10/06, Van Nguyen [EMAIL PROTECTED] wrote: That displays: (r) We need it to display: (tm) -Original Message- From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 10:33 AM To: Struts Users Mailing List Subject: Re: render trademark symbol use #174; HTH M- This e-mail communication and any attachments may contain confidential and privileged information for the use of the designated recipients named above. If you are not the intended recipient, you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it or its contents - Original Message - From: Van Nguyen To: user@struts.apache.org Sent: Tuesday, October 10, 2006 1:13 PM Subject: render trademark symbol Hi, I'm using struts 1.2.9 and am running into a problem rendering the trademark symbol using the bean taglib. I have this string stored in my lucene index as: W.RoseT Convex Jointer It stores it in my bean as such. but when I use the bean:write tag, it displays it as: W.Rose? Convex Jointer I added some breakpoints in the WriteTag class inside the struts library, and I see that it comes in as W.RoseT Convex Jointer And it is being returned as the same string. Is there anything else that needs to be done to render the Trademark symbol as T? I've read online that HTML needs it to be trade; to render correctly. But I've tried changing the text in the bean to: W.Rosetrade; Convex Jointer But that did not work either. the bean:write tag just displays it as W.Rosetrade; Convex Jointer Any suggestions? -- United Rentals Consider it done.⢠800-UR-RENTS unitedrentals.com -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] United Rentals Consider it done.™ 800-UR-RENTS unitedrentals.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: render trademark symbol
Sorry, escapeXml is for c:out /, Nuawn is right, filter=false is what you are looking for. On 10/10/06, Nuwan Chandrasoma [EMAIL PROTECTED] wrote: hi, set the filter attribute of bean:write tag to false and try - Original Message - From: Van Nguyen [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, October 10, 2006 6:14 PM Subject: RE: render trademark symbol Is escapeXml an attribute for the bean:write tag? I do not see that in the Struts 1.2.9 API. -Original Message- From: Ed Griebel [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 11:05 AM To: Struts Users Mailing List Subject: Re: render trademark symbol bean:write may be escaping the amp; so maybe you could try adding escapeXml=false inside the bean:write tag. -ed On 10/10/06, Van Nguyen [EMAIL PROTECTED] wrote: That displays: (r) We need it to display: (tm) -Original Message- From: Martin Gainty [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 10:33 AM To: Struts Users Mailing List Subject: Re: render trademark symbol use #174; HTH M- This e-mail communication and any attachments may contain confidential and privileged information for the use of the designated recipients named above. If you are not the intended recipient, you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it or its contents - Original Message - From: Van Nguyen To: user@struts.apache.org Sent: Tuesday, October 10, 2006 1:13 PM Subject: render trademark symbol Hi, I'm using struts 1.2.9 and am running into a problem rendering the trademark symbol using the bean taglib. I have this string stored in my lucene index as: W.RoseT Convex Jointer It stores it in my bean as such. but when I use the bean:write tag, it displays it as: W.Rose? Convex Jointer I added some breakpoints in the WriteTag class inside the struts library, and I see that it comes in as W.RoseT Convex Jointer And it is being returned as the same string. Is there anything else that needs to be done to render the Trademark symbol as T? I've read online that HTML needs it to be trade; to render correctly. But I've tried changing the text in the bean to: W.Rosetrade; Convex Jointer But that did not work either. the bean:write tag just displays it as W.Rosetrade; Convex Jointer Any suggestions? -- United Rentals Consider it done.⢠800-UR-RENTS unitedrentals.com -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] United Rentals Consider it done.(tm) 800-UR-RENTS unitedrentals.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] United Rentals Consider it done.T 800-UR-RENTS unitedrentals.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: session management
It is not clear what you are asking. Is the problem that - the session is not being maintained even when setting the timeout to 30 minutes - even after 1/2 hour the session does not timeout An observation, pinging the server every 10 seconds will create a lot of unnecessary work on the server. You can probably change it to a 30-50 second ping and set the session timeout to around a minute if you want to maintain the session. Since you are pinging the server regularly, as long as the user has a window up their session will never expire, even if they walk away or leave their computer on and browser window up all nite. An alternate solution would be to keep track of non-ping activity and terminate the user's session after n minutes of only ping activity, maybe redirect them to a idle too long screen without the AJAX ping when this occurs. An alternative approach would be to be able to re-establish the user's session if they happen to time out, but that is no small task. good luck, -ed On 10/3/06, sowjanya chimmani [EMAIL PROTECTED] wrote: Hi All, In our webapplication (struts based) we are using Ajax code (as part of header in all jsp)which will hits the server for every 10 sec so every time session will be updated so it is not possible to maintain the session (sesstion will not expires though after the session time out value ) .Please can any one help me to mintain the session(iam setting the session time out value as 30 min) -- sowjanya - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: jsession id in url
http://www.junlu.com/msg/287317.html As stated in above response to (your) similar question, the first request that is returned will have jsessionid= appended. To get rid of it you can try having the first page of the application be a dummy page that merely redirects to the real page. The reason why the jsessionid is appended the first time is that the web server cannot know _a priori_ if a browser has enabled cookies. Only when the web server gets a second request from the browser with a jsession id cookie can it assume that it has cookies and will strip the jsessionid from future requests. -ed On 10/4/06, sunil virmani [EMAIL PROTECTED] wrote: Hi All, In my application in each request jsessionid is passed both in cookie as well as in url. I have enabled the cookie then why it is appearing in the URL also. Regards, Sunil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Avoiding multiple validation messages
In your form's onclick=validate() method (or whatever it may be called in your case), it may work to add return to the javascript method call. The validate method will return false if validation fails, and the form will not be submitted back to the server. HTH, -ed On 10/3/06, priya [EMAIL PROTECTED] wrote: I am using client-side and server-side validation in my login form. Both work and when I dont enter the required fields I recieve a javascript alert box saying that the fields username or password are required. After I click okay it does a serverside validation as well and prints on the screen that the username or password are required.. I was wondering if its possible to show username or password are required only once. When there is javascript enabled on the browser, to show the client side version only and when javascript is disabled use the serverside version? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Avoiding multiple validation messages
Let me clarify, in your html:form statement, try adding a return like so: html:form action=/login method=post onsubmit=return validateLoginForm(this) On 10/3/06, priya [EMAIL PROTECTED] wrote: Hi Ed, Thank you for your response! Since I am using Struts client side validation, I am not creating the validate method.. Struts is creating it for me.. Do you mean I should create another method ? I am not sure if I can add return to the javascript which Struts creates for me? %@ taglib uri=/WEB-INF/tld/struts-html.tld prefix=html % %@ taglib uri=/WEB-INF/tld/struts-bean.tld prefix=bean % html:html HEAD/HEAD BODY html:errors/ TABLE html:form action=/login method=post onsubmit=validateLoginForm(this) TR TDUsername:/TD TDhtml:text property=userName //TD /TR TR TDPassword:/TD TDhtml:password property=password //TD TR TDSubmit/TD TDhtml:submit value=Login onclick=anotherValidateHere?() //TD /TR /html:form html:javascript formName=loginForm/ /BODY /html:html Priya On 10/3/06, Ed Griebel [EMAIL PROTECTED] wrote: In your form's onclick=validate() method (or whatever it may be called in your case), it may work to add return to the javascript method call. The validate method will return false if validation fails, and the form will not be submitted back to the server. HTH, -ed On 10/3/06, priya [EMAIL PROTECTED] wrote: I am using client-side and server-side validation in my login form. Both work and when I dont enter the required fields I recieve a javascript alert box saying that the fields username or password are required. After I click okay it does a serverside validation as well and prints on the screen that the username or password are required.. I was wondering if its possible to show username or password are required only once. When there is javascript enabled on the browser, to show the client side version only and when javascript is disabled use the serverside version? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Session Timeout
[moving to struts-user list] A new session is created when you request a new session somewhere, it's not created automatically. However, there could be a filter, request processor, action, or JSP somewhere that does a request.getSession() or .getSession(true) (or '... session=true...' in JSP), which all will create a session if none exists. If it's buried deep enough in a chain of filters it could *appear* to be magic :-) There is a method isNew() on the session that you can check to see if it's a new session that might help in your case. -ed On 8/30/06, Nuwan Chandrasoma [EMAIL PROTECTED] wrote: hi, I think a new session is created if you invoke an action mapping. this code will not work. what you have to do is, add some attribute to the session.. and check if that attribute is on the session. if not you can redirect to your session timeout page. Correct me if i am worng in here. Thanks, Nuwan John De Lello [EMAIL PROTECTED] wrote: The mandate is no JS. I'd prefer to not use a filter either for this. I was just wondering why I was getting a valid session when the session was indeed expired. -Original Message- From: faisal abdallah [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 29, 2006 2:30 PM To: Struts Developers List; [EMAIL PROTECTED] Subject: RE: Session Timeout This can be done easily with javascript inside the main layout email me on [EMAIL PROTECTED] and I will send you the code skillipedia.com -Original Message- From: John De Lello [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 29, 2006 11:15 AM To: dev@struts.apache.org Subject: Session Timeout Hey Everyone, I am trying to use a custom session timeout JSP. To do this, I extended RequestProcessor and overrode processPreprocess and added the following code: HttpSession sess = req.getSession(false); if(sess == null){ // even when the session IS timed out, I never get here. String uri = /myapp/sessiontimeout.jsp; try{ doForward(uri, req, resp); }catch(Exception ex){} return false; } The problem is, even when I know the session was expired, I never get a null session. Am I missing something? Thanks John - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Has anyone had this problem? Getting 3 question marks ??? at top of HTML page using action class and rendering JSP in browser
There's not much to go on, but check to see that all keys referenced in bean:message are defined in the appropriate message properties files. Look at message-resources in your struts-config.xml file to see what properties files are included. -ed On 8/2/06, Patterson, Marie E [CPB] [EMAIL PROTECTED] wrote: Has anyone had this problem? Getting 3 question marks ??? at top of HTML page using action class and rendering JSP in browser Thank you - 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: Some JSP Taglib help needed
You could try something like: html:form action= c:foreach begin='0' end='${endval}' varStatus='idx' html-el:text property='student_name_${idx.count}'/ /c:foreach But, why not make the student_name an array? The code below should work, I havent' compiled it and I usually iterate thru a list of beans not scalar Strings, but it should be close. - Declare the element in the formbean as form-property name=student_name type=java.util.List/ or create student_name as a java.util.List if using a POJO for an ActionForm - Create a setup action that is called before the JSP is initially rendered which does a '((MyFormType)form).student_name = new java.util.ArrayList();' - In the JSP form: html:form action=... c:foreach begin='0' end='${endval}' varStatus='idx' html-el:text property=student_name[${idx.index}]/ /c:foreach ... /html:form -ed On 8/1/06, Bart Busschots [EMAIL PROTECTED] wrote: I want to do some thing that I think should be simple but I can't figure out how to do it with the Struts taglibs. So far I've never used a single scriptlet and I don't want to start now. I have a number stored in a bean which I can get at just fine (tested with bean:write). What I need to do is loop from 1 to that number and print a text area for each element in that range. Were the number three I should get the following output: input type=text name=student_name_1 / input type=text name=student_name_2 / input type=text name=student_name_3 / Can I do that easily with a taglib? To put this into context, I have a two-step form, on the first form the user enters the number of students in their class (as well as other info) and then on the second page the user is presented with the appropriate number of text areas to allow them to enter the names of each of their students. Because I'm can't think of a better way to do it I'm submitting the list of names in a single hidden form field separated by :. I was going to use Java Script to suck all the names from the text areas, encode them and then stick the details in the hidden form field in an onsubmit action. Perhaps there is a better struts way to do this. If anyone has any advice I'm entirely open to changing the way I'm doing this. Thanks for your time and help, Bart. - 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: Can you use a LinkedList or similar as the type for a FormElement?
Lists is where you want to be headed, see answer to previous question as to how to do it on JSP. The key is that the Jakarta BeanUtils/PropertyUtils classes treat arrays and collections the same way so both can use brackets for element indexing. The key is to predefine the instance, I think struts will throw an exception if your list instance is null. It doesn't even need to be a LinkedList, as long as it implements List (and possibly Collection??). As to the validator, I'm pretty sure it handles it, just don't know off the top of my head how it does it. -ed On 8/1/06, Bart Busschots [EMAIL PROTECTED] wrote: Following on from my earlier email it strikes me that the most sensible way to deal with collecting a variable number of student names is to have a LinkedList in your form bean. However, the question then is, can Struts handle this? Can the validator handle this? I would need the validator to apply one rule to all elements of a variable length list? I have a feeling I've stumbled into a limitations with Struts here but I could be wrong. So far no amount of googling has helped me out here. If anyone has any pointers on where to look for solutions to this I'd be much obliged. I can't be the first person to want to change the layout of a latter page in a multipage form within struts based on the values submitted in a previous page! Thanks, Bart. - 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: dynamic casting in Action class
If you only need to get predefined variables, you can use Jakarta BeanUtils or PropertyUtils on the object. For instance, with a form bean ActionForm form: String val = BeanUtils.getProperty(someProperty); Object valAsOriginalClass = PropertyUtils.getProperty(someProperty); BeanUtils.setProperty(someProperty, somePropertyValue); -ed On 7/26/06, Andreas Hartmann [EMAIL PROTECTED] wrote: Gareth Evans wrote: You can't do either of these things! Right. AFAIK you can't do dynamic casting in java, although in java 5 you may be able to utilise the Class.cast method. I did it another way now: I try to do the fm's and catch a possible cast-exception. All needed values are stored in predefined variables. Thanks for your help, kind regards, Andreas Hartmann - 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: problems using validation framework in struts
I haven't seen this error, but my guess is that you have referenced a form bean in your validation.xml that is not defined in struts-config.xml. Look for a typo in the name. -ed On 7/11/06, Anil Kumar Pippalapalli [EMAIL PROTECTED] wrote: hi all, iam new to struts and iam tryin out a simple application which validates password for minlength and maxlength in nb 4.1. iam gettin several exceptions saying unable to load validation.xml and validation-rules.xml check below errors, Using CATALINA_BASE: C:\Documents and Settings\anil\.netbeans\4.1\jakarta-tomcat-5.5.7_base Using CATALINA_HOME: C:\Program Files\netbeans-4.1\enterprise1\jakarta-tomcat-5.5.7 Using CATALINA_TMPDIR: C:\Documents and Settings\anil\.netbeans\4.1\jakarta-tomcat-5.5.7_base\temp Using JAVA_HOME: C:\Program Files\Java\jdk1.5.0_06 Jul 11, 2006 3:16:09 PM org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on http-8084 Jul 11, 2006 3:16:09 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 3535 ms Jul 11, 2006 3:16:10 PM org.apache.catalina.core.StandardService start INFO: Starting service Catalina Jul 11, 2006 3:16:10 PM org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/5.5.7 Jul 11, 2006 3:16:10 PM org.apache.catalina.core.StandardHost start INFO: XML validation disabled Jul 11, 2006 3:16:17 PM org.apache.catalina.core.ApplicationContext log INFO: action: []: Verifying ModuleConfig for this module Jul 11, 2006 3:16:17 PM org.apache.catalina.core.ApplicationContext log INFO: action: []: Verification of ModuleConfig has been completed Jul 11, 2006 3:16:17 PM org.apache.struts.webapp.example.memory.MemoryDatabasePlugIn init INFO: Initializing memory database plug in from '/WEB-INF/database.xml' Jul 11, 2006 3:16:17 PM org.apache.struts.validator.ValidatorPlugIn initResources INFO: Loading validation rules file from '/WEB-INF/validator-rules.xml' Jul 11, 2006 3:16:17 PM org.apache.struts.validator.ValidatorPlugIn initResources INFO: Loading validation rules file from '/WEB-INF/validation.xml' Jul 11, 2006 3:16:21 PM org.apache.struts.tiles.TilesPlugin initDefinitionsFactory INFO: Tiles definition factory loaded for module ''. Jul 11, 2006 3:16:21 PM org.apache.struts.validator.ValidatorPlugIn initResources INFO: Loading validation rules file from '/WEB-INF/validator-rules.xml' Jul 11, 2006 3:16:21 PM org.apache.struts.validator.ValidatorPlugIn initResources INFO: Loading validation rules file from '/WEB-INF/validation.xml' Jul 11, 2006 3:16:25 PM org.apache.struts.tiles.TilesPlugin initDefinitionsFactory INFO: Tiles definition factory loaded for module ''. Jul 11, 2006 3:16:25 PM org.apache.struts.validator.ValidatorPlugIn initResources INFO: Loading validation rules file from '/WEB-INF/validator-rules.xml' Jul 11, 2006 3:16:25 PM org.apache.struts.validator.ValidatorPlugIn initResources INFO: Loading validation rules file from '/WEB-INF/validation.xml' Jul 11, 2006 3:16:26 PM org.apache.catalina.core.ApplicationContext log INFO: ContextListener: contextInitialized() Jul 11, 2006 3:16:26 PM org.apache.catalina.core.ApplicationContext log INFO: SessionListener: contextInitialized() Jul 11, 2006 3:16:27 PM org.apache.catalina.core.ApplicationContext log INFO: ContextListener: contextInitialized() Jul 11, 2006 3:16:27 PM org.apache.catalina.core.ApplicationContext log INFO: SessionListener: contextInitialized() Jul 11, 2006 3:16:37 PM org.apache.struts.tiles.TilesPlugin initDefinitionsFactory INFO: Tiles definition factory loaded for module ''. Jul 11, 2006 3:16:37 PM org.apache.struts.validator.ValidatorPlugIn initResources INFO: Loading validation rules file from '/WEB-INF/validator-rules.xml' Jul 11, 2006 3:16:37 PM org.apache.struts.validator.ValidatorPlugIn initResources INFO: Loading validation rules file from '/WEB-INF/validation.xml' Jul 11, 2006 3:16:38 PM org.apache.struts.validator.ValidatorPlugIn init SEVERE: null java.lang.NullPointerException at org.apache.commons.validator.ValidatorResources.internalProcessForms(ValidatorResources.java:464) at org.apache.commons.validator.ValidatorResources.process(ValidatorResources.java:415) at org.apache.commons.validator.ValidatorResources.init(ValidatorResources.java:162) at org.apache.struts.validator.ValidatorPlugIn.initResources(ValidatorPlugIn.java:237) at org.apache.struts.validator.ValidatorPlugIn.init(ValidatorPlugIn.java:162) at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:869) at org.apache.struts.action.ActionServlet.init(ActionServlet.java:336) at javax.servlet.GenericServlet.init(GenericServlet.java:211) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1068) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:900) at
Re: html-el:checkbox No Longer Works If Preceded by html-el:form
The reason is that your checkbox really is no longer in the form, so the framework doesn't know where to pull the value from. All of the html and html-el tags which create form 'widgets' must be between html:form and /html:form. What you probably need to do is to create a second form on the page by adding html:form action=/admin/selectUsers.do before the c:forEach and change the html:link to html:submit followed by /html:form HTH, -ed On 6/29/06, Caroline Jen [EMAIL PROTECTED] wrote: My html-el:checkbox worked fine. But if the html-el:form ... /html-el:form come before the html-el:checkbox ... , I got the runtime JSP error: cannot find bean: org.apache.struts.taglib.html.BEAN in any scope. The complaint points specifically to the html-el:checkbox property=selectedUsers[${idx.index}].selected /. The getter method for selectedUsers[0].selected can no longer be recognized. I need help because I really do not understand why it happens this way. [code]. %@ page import=..common.pojo.user.User % .. .. !-- Create a variable in scope called userRows from the Users object -- c:set var=userRows value=${requestScope.Users} / c:choose html-el:form action=/admin/findUsers.do // many textfields and a submit button /html-el:form c:when test=${not empty userRows} .. .. !-- create a user object for each element in the userRows -- c:forEach var=user items=${userRows} varStatus=idx tr td align=center html-el:checkbox property=selectedUsers[${idx.index}].selected / html-el:hidden property=selectedUsers[${idx.index}].id value=${user.id}/ /td /tr .. .. /c:forEach tr td colspan=6 align=left html-el:link action=/admin/selectUsers.doEdit Selected Users/html-el:link /td /tr /c:when .. /c:choose .. .. [/code] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Eclipse plugin
I've used MyEclipse also, it works pretty well. It can be a little rough around the edges, but you can't beat the price, $50 w/UML support, $30 without. I'm currently using NitroX v2, since bought by BEA and rebranded BEA Workbench or something like that. It's a lot more expensive, but it is better integrated and has a nice JSP and struts-config.xml editor. I probably use the JSP and XML editors the most, and I've found the AppXRay feature isn't terribly useful except for very simple apps. I've been meaning to fire up eclipse's WTP, I hear it does struts and/or JSP. -ed On 6/29/06, Wilson, Scott [EMAIL PROTECTED] wrote: There's myEclipse... http://www.myeclipseide.com/ It's free for a month and subscription after, Scott -Original Message- From: David Friedman [mailto:[EMAIL PROTECTED] Sent: June 29, 2006 12:25 To: Struts Users Mailing List Subject: RE: Eclipse plugin Here's one (complete with pictures): http://amateras.sourceforge.jp/cgi-bin/fswiki_en/wiki.cgi?page=StrutsIDE Also, if you are using Eclipse, I believe a new RELEASE version is coming out in the next week (or sooner) so you might want to upgrade almost immediately once it comes out in case it has any benefits (speed, new features, better possible stability, etc.). Regards, David -Original Message- From: Rafael Taboada [mailto:[EMAIL PROTECTED] Sent: Thursday, June 29, 2006 12:17 PM To: Struts List Subject: Eclipse plugin Hi folks... In my all Struts life I've used Netbeans as IDE favourite... But right I have to develop in Eclipse... Because I have to work in a team... So I'm wondering if there is a Struts plugin for Eclipse... I was googling and there is EasyStruts but I want to know if there is another plugin in order to help me to develop Struts projects in Eclipse. Do u know another plugin? what is the best? Thanks in advance.. Greetings from Peru - 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: Validate just certain fields
You can use the page attribute on the validations, with the page attribute. Look at http://struts.apache.org/struts-doc-1.2.9/userGuide/dev_validator.html under Multi page forms for an extremely brief overview. Basically, create a java.lang.Integer variable in your form called page and before you call form.validate() set this page variable appropriately: if subtotal was pressed set page=1, if submit then page=2. Define validations common to both in validations with page=1, and submit only with page=2 in validation.xml: form name=SomeForm field property=quantity page=1 depends=required ... /field field property=address page=2 depends=required.../field ... /form It's not the most elegant, but it does work well when you have a linear page flow. -ed On 6/26/06, Jennifer Jacobs [EMAIL PROTECTED] wrote: I'm using the Struts Validator framework. I have a form with two buttons on it, one that calculates a subtotal and one that submits the form. I have validation set to false, because I don't want to validate the shipping address/email/phone number/etc when they calculate the subtotal. So, I do a form.validate() when the submit button is hit. However, I DO want to validate the values they put in for quantity, etc. I know I can write validation for it all, but then my validation is in two places - is there any way to tell it to validate JUST a certain set of fields? Thanks in advance, Jennifer -- View this message in context: http://www.nabble.com/Validate-just-certain-fields-t1850707.html#a5052596 Sent from the Struts - User forum at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: handle to form w/i jsp?
If you know the formbean it's a simple as c:set var=MyFormBean.map.propName value=${theSessionVar}/ If you don't konw the formbean name or want to make it generic you can get the current action's form bean name and then populate it something like below. Modify requestScope/sessionScope as appropriate. c:set var=actionMapping' value=${requestScope['org.apache.struts.action.mapping.instance]}/ c:set var=requestScope[actionMapping.name].map.propName value=${theSessionVar}/ HTH, -ed On 6/23/06, Brian Long [EMAIL PROTECTED] wrote: Hi folks - I've got session data that I'd like to jam into a DynaValidatorForm before it displays, so that all of the html tags that do auto-population from the form work. How do I get a handle to the form within the jsp? Thanks in advance, -b -- Brian M. Long Middleware Services, Virginia Tech Ancora Imparo (I am still learning) - Michaelangelo, age 87 - 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 download a file
Take a look at org.apache.struts.actions.DownloadAction, I created an action that extended it (and implemented the internal StreamInfo) and was able to create an action that downloaded a PDF doc in less than an hour. For creating a new file to stream, one approach is to create the temp file using (untested, of course): File dir = new File(request.getSession().getServletContext().getRealPath(.)); File tmp = File.createTempFile(web,null,dir); tmp.deleteOnExit(); You may not have rights to write to the web server's root directory, you might be able to get away with File tmp = File.createTempFile(web, null); Store the data to this temp file, passing the file as a stream in the aformentioned StreamInfo object. To eliminate creating the temp file, stream the file directly without having an intermediate file. -ed On 6/22/06, Kavita Mehta [EMAIL PROTECTED] wrote: my requirement is to save some lines on the server in a file and then download it to the client's PC . can anybdy suggest how to go abt it thanks Kavita - 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: Why My JSTL Tag Cannot Do What Struts Tag Does?
You don't need to do the intermediate assignment to user, it should be sufficient to do: --- c:forEach var=User items=${userRows } varStatus=idx c:choose c:when test=${( idx.count+1)%2 ==0} tr class=contentCell1 /c:when c:otherwise tr class=contentCell2 /c:otherwise /c:choose tdc:out value=${User.createdByUserID} //td tdc:out value=${User.firstName} //td tdc:out value=${User.lastName} //td /tr /c:forEach --- Also, the convention is to keep var names lowercase, as in c:forEach var=user... -ed On 6/21/06, Caroline Jen [EMAIL PROTECTED] wrote: I am able to display a List of object returned from the database using the Struts tags: [code] . %@ page import=.common.pojo.user.User % % List user = (List)request.getAttribute(Users); pageContext.setAttribute(Users, user); % . . logic:iterate id=users name=Users type=. commom.pojo.user.User scope=request tr tdbean:write name=users property=createdByUserID//td tdbean:write name=users property=firstName//td tdbean:write name=users property=lastName//td /tr /logic:iterate .. [/code] But, when I use JSTL tags to do the same thing, I cannot display my data. I mean, I do not get any JSP error. I can see each row in a table, but it is complete blank in every single column for every single row. I did import the JSTL tag library. And the JSTL tag library exists and works in other JSPs. Please help me to see what went wrong. Here is my JSTL code (I am typing my code and there may be typos. Anyway, no error is given in the browser.): [code] . %@ taglib uri=/tags/core prefix=c % %@ page import=.common.pojo.user.User % ... c:set var=userRows value=${requestScope.Users} / . c:forEach var=User items=${userRows } varStatus=idx % User user = (User)pageContext.getAttribute( user ); % c:choose c:when test=${( idx.count+1)%2 ==0} tr class=contentCell1 /c:when c:otherwise tr class=contentCell2 /c:otherwise /c:choose tdc:out value=${user.createdByUserID} //td tdc:out value=${user.firstName} //td tdc:out value=${user.lastName} //td /tr /c:forEach .. [/code] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: seeking quick start struts tutorial
There's too many to mention; here are some of my favorites: http://struts.apache.org/struts-action/index.html http://struts.apache.org/struts-action/userGuide/index.html http://www.learntechnology.net/ Look at Struts Lessons in left menu http://courses.coreservlets.com/Course-Materials/struts.html -ed On 6/21/06, hicham [EMAIL PROTECTED] wrote: hello I'm a newbie to struts framework if anybody knows of a quick start easy tutorial that can get me on the road links ? pdf ? Thank you hicham - 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: need urgent help
This exception is caused by outputting a message without specifying a message resource in your struts-config.xml file. You can learn some more about Struts starting at these links: http://struts.apache.org/struts-action/index.html http://struts.apache.org/struts-action/userGuide/index.html -ed On 6/19/06, Medicherla Lakshmi [EMAIL PROTECTED] wrote: hi, I have a problem, please give me soln. I have an actionform which has String aswellas int types with get and set methods. In the jsp, when am trying to get the int type value of that actionform using bean:write name=ele property=empid where empid is one of the get/set method in the action form, its throwing exception saying: The error it is specifying in the servlet class is of that empid value. Please tel me how to int type of actionform in jsp. am in urgent need of it. type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException: Cannot find message resources under key org.apache.struts.action.MESSAGE org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781) org.apache.jsp.ManageTeam_jsp._jspService(ManageTeam_jsp.java:491) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362) org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063) org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362) root cause javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE org.apache.struts.taglib.TagUtils.retrieveMessageResources(TagUtils.java:1175) org.apache.struts.taglib.TagUtils.message(TagUtils.java:1024) org.apache.struts.taglib.TagUtils.message(TagUtils.java:999) org.apache.struts.taglib.bean.WriteTag.retrieveFormatString(WriteTag.java:254) org.apache.struts.taglib.bean.WriteTag.formatValue(WriteTag.java:317) org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:232) org.apache.jsp.ManageTeam_jsp._jspx_meth_bean_write_1(ManageTeam_jsp.java:525) org.apache.jsp.ManageTeam_jsp._jspService(ManageTeam_jsp.java:272) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362) org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063) org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362) - Yahoo! India Answers: Share what you know. Learn something new Click here Send free SMS to your Friends on Mobile from your Yahoo! Messenger Download now - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: web.xml specifications from 2.4 to 2.3
You can't do it without changing your JSPs. It isn't as simple as wrapping everything with c:out value=${someVariable}/ as JSP tags cannot be nested within attributes. Also, to my knowledge there is no way to just include some jar file to enable EL exprs. A suggestion too, your code: bean:define id=biz_link type=String name=Biz_Bean property=business_id/ html:link action=/viewBiz/ViewBusinessDetail?business_id=${biz_link} can be rewritten as: html-el:link action=/viewBiz/ViewBusinessDetail?business_id=${Biz_Bean.business_id}/ HTH, -ed On 6/14/06, chuanjiang lo [EMAIL PROTECTED] wrote: i have some other pages that uses c:if and etc etc.. I've read on the net and realize that the 2.3 specifications supports only JSTL 1.0 and it would not evaluate the EL expressions. So how do i make it evaluate the EL expression without changing my implementation. On 6/14/06, Rahul Akolkar [EMAIL PROTECTED] wrote: On 6/14/06, Dave Newton [EMAIL PROTECTED] wrote: chuanjiang lo wrote: bean:define id=biz_link type=String name=Biz_Bean property=business_id/ html:link action=/viewBiz/ViewBusinessDetail?business_id=${biz_link} You need to use the EL-enabled tag libs (struts-el or something like that) when you don't have JSP 2.0 available. snip/ Indeed: http://struts.apache.org/struts-action/struts-el/index.html -Rahul Dave - 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-config xml file throws a java exception
Hi Oliver- I'm going to guess that you have defined a form bean and properties in your form bean, and one of these properties is called loginRequired. I'm also going to guess that you don't have a setter method for this property with the method signature of 'public void setLoginRequired(String x)' -ed On 6/7/06, Olivier Bex [EMAIL PROTECTED] wrote: Hi everyone, When I start Tomcat 5.0.28, it says that I have a parsing error in my struts-config.xml, but I think it's not. The log file throws a java.lang.NoSuchMethodException : bean has no property named loginRequired Regards, Olivier BEX - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Object size in App Server
For interactive session viewing look at http://messadmin.sourceforge.net/. It's not something I'd put on a production server, but it is useful for testing. -ed On 5/25/06, Chaudhary, Harsh [EMAIL PROTECTED] wrote: I just wrote the object to a file as a bit blob and looked at the file size. But I needed something quick and dirty and not necessarily extremely accurate. Harsh. -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Thursday, May 25, 2006 12:16 AM To: Struts Users Mailing List Subject: Re: Object size in App Server I can help with the session size at least: http://javawebparts.sourceforge.net Specifically, the SessionSize class: http://javawebparts.sourceforge.net/javadocs/javawebparts/session/Sessio nSize.html I think you should be able to yank that code and and make it generic to work with any Object (it must be serializable though), in which case you can get the size of a ResultSet too. Frank Hanmay Udgiri wrote: Hi I am getting a ResultSet from database. I want to get the size of the object in the App Server. Also I want to get the size of session object after the user is validated and the user details are added to session. Thanks and Regards Hanmayya Udgiri -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: [EMAIL PROTECTED] Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - 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: Getting a list of fields in a form along with their values
Take a look at jakarta BeanUtils.describe() -ed On 5/24/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello, The DynaActionForm class has a method called getMap which Returns the Map containing the property values We've found this quite useful for some of the things we need to do. I am looking for a similar method in the ActionForm ValidatorForm but I can't find anything. Can someone tell me if there is an easy way to get all the property keys along with their values from those two classes? Thanks in advance for any help. David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to disallow opening a page directly from URL
Put your JSPs unde WEB-INF and forward to the JSP in struts-config.xml: http://www.onjava.com/pub/a/onjava/2002/10/30/jakarta.html?page=3 For roles, use declarative roles: http://wiki.apache.org/struts/ApplicationSecurity http://www.onjava.com/pub/a/onjava/2004/02/18/strutssecurity.html -ed On 5/17/06, Pankaj Gupta [EMAIL PROTECTED] wrote: Hi All, I am new to struts and have a basic question. I am making an application and I want that all the pages should be accessed through the menu items only.i.e. if a user copies the url in the browser the page should not get loaded. How can I enforce such a security? Another question is how can I selectively disable some menus based on login roles? regards, Pankaj - 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 dertermine the url from which a request is made ?
You can check the referer field in the request, notice that the actual field name is misspelled. Also, the field is optional and browser-dependent if it's sent (but most/all modern browsers will send it), and a user could spoof this field as well. You may be better off putting the current URL in a session variable and then referring to this variable in the next access. However, you will encounter a problem if the user has two windows open with the same session. -ed On 5/15/06, temp temp [EMAIL PROTECTED] wrote: The method request.getServletPath returns current request uri.Can I get the previous request uri .ie I have a filter which is mapped to all .do's .So any .do is called this filter is invoked.In this filter I can retrieve the requested url. Is there any way I can determine url from which this request was made ? Thanks Regards - Blab-away for as little as 1¢/min. Make PC-to-Phone Calls using Yahoo! Messenger with Voice. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to display a message for every request
You can create a base action class which extends Action and implements execute(). In execute you would call your preferred logging method as described below. Then, every action you create would extend your BaseAction class and the first line of every execute() method would call super.execute() -ed On 5/8/06, Adam Hardy [EMAIL PROTECTED] wrote: Srinivas Vakkalanka on 08/05/06 11:32, wrote: Hi, I am new to struts. I have a request that, for every request I want to display a message or log a message using struts frame work. How this could achieve. Please help in this regard Hi Srinivas, your requirement would normally be implemented using your logging component (commons-logging would be a good first choice). You code against the logging API and you control where it puts the output via the configuration. Check out the jakarta website and look for commons, and then the logging subproject. They have a useful 'quickstart' section in their docs online. Adam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: page validation in wizzard app
You could have the ActionForward mapped to an Action class in your struts_config.xml file just as easily as a JSP, e.g. forward name=validation_failed action=RepopulateAction/ and then just 'return ActionForward(validation_failed)' if validation failed on page1. HTH, -ed On 5/6/06, Jakub Milkiewicz [EMAIL PROTECTED] wrote: Hi Ed Thanks for an answer. The problem with your idea is: IF validation fails i can not forward to previous JSP! I need to forward to previous action to prepare me a view - retireve something from DB and put it in html:select. I have the same idea to put form.setPage(pageNo) as first thing in each action. Moreover if i disable autovalidation i do not have to make those tricks to decrement page in validate if errors are found. 2006/5/6, Ed Griebel [EMAIL PROTECTED]: Hi Jakub- I'm not sure if I fully understand your pageflow, but here goes. I would turn off automatic validation in struts_config.xml. In each action, one of the first things I would do is call form.setPage(pageNo) and then call form.validate(...), and if there are any errors I'd return an ActionForward corresponding to the previous JSP. I have an app that is very similar to this but I use a DispatchAction and set things as described above and it works well. As to overriding the page variable counter, it's an interesting idea, but you may run into a problem so you'll have to trap it from going below zero, for instance if they keep failing validation on the first screen. One way to find out for sure is to try it out and see how it goes! -ed On 5/6/06, Jakub Milkiewicz [EMAIL PROTECTED] wrote: Hi I have a wizzard application with 5 screens. All user inputs are collected in one bean, which is named: viewBean and is stored in HTTP session. So each action has the same formBean - viewBean. I use commons-validator and viewBean properties to validate are present in validation.xml with page attributes. ViewBean extends ValidatorForm and it's validation occurs automatically - i have validation set to true for all ACTIONS. The structure of my app is: Populate view - jsp -populate view -jsp -populate view - jsp ... Population of view happens in ACTION class and can consists of retrieving some data from DB, sets these data in HTTP request. After population process i forward to appropriate jsp to give user a chance to fill the form and to present population process results as for example options in html:select. If form is correct i go to another action which populate view for a next screen (jsp). If form is not filled correctly i need to show it again, but i can not forward to jsp - i need to forward to action that prepares the form - that's why i have my input parameter of action tag set to action which populate the view - previous action. I have a problem with page attribute. Please take a look at the sample of processing in my app: ACTION1 - JSP1 -ACTION2 - JSP2 -Action3 -JSP3 ... Let's assume that user submits form in JSP2 to action3. After ActionForm bean population, page property is set to 2. Next, validation fails in Action3 and input parameter of action3 forwards user to ACTION2. Before execute method in Action2 is invoked, ActionForm (viewBean) validation occurs. The page attribute is still set to 2 ! and commons-validator tries to validate properties that has page attribute set to 2.Obviously validation fails and control is forwarded to Action1. Action1 also has validation set to true and validation of ActionForm occurs again with page =2. Validation fails and control is forwarded to ... Does anyone have any idea to solve the problem. My idea is to not to use hidden page parameter in each jsp action but set page property of viewBean in each Action: for ACTION2 sets it to 2, for Action3 sets it to 3 ... and to override validate method in viewBean: public ActionErrors validate( ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = super.validate(mapping,request); if(errors != null errors.size() 0 ) page--; return errors; } Maybe someone knows more elegant solution, or maybe architecture of my app isn't valid. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: page validation in wizzard app
On 5/7/06, Jakub Milkiewicz [EMAIL PROTECTED] wrote: Hi I do not catch it: forward name=validation_failed action=RepopulateAction/ I do not think this synax is ok. The forward .../ is inside of a action block in your struts-config.xml, the syntax is approximate and should be enough to give you the idea. The problem is that i use autovalidation. Yes, I understand you want to use autovalidation, but if turn it off and call form.validate() manually it's only a few additional lines in your action classes and will save you a lot of headaches. -ed - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: page validation in wizzard app
Hi Jakub- I'm not sure if I fully understand your pageflow, but here goes. I would turn off automatic validation in struts_config.xml. In each action, one of the first things I would do is call form.setPage(pageNo) and then call form.validate(...), and if there are any errors I'd return an ActionForward corresponding to the previous JSP. I have an app that is very similar to this but I use a DispatchAction and set things as described above and it works well. As to overriding the page variable counter, it's an interesting idea, but you may run into a problem so you'll have to trap it from going below zero, for instance if they keep failing validation on the first screen. One way to find out for sure is to try it out and see how it goes! -ed On 5/6/06, Jakub Milkiewicz [EMAIL PROTECTED] wrote: Hi I have a wizzard application with 5 screens. All user inputs are collected in one bean, which is named: viewBean and is stored in HTTP session. So each action has the same formBean - viewBean. I use commons-validator and viewBean properties to validate are present in validation.xml with page attributes. ViewBean extends ValidatorForm and it's validation occurs automatically - i have validation set to true for all ACTIONS. The structure of my app is: Populate view - jsp -populate view -jsp -populate view - jsp ... Population of view happens in ACTION class and can consists of retrieving some data from DB, sets these data in HTTP request. After population process i forward to appropriate jsp to give user a chance to fill the form and to present population process results as for example options in html:select. If form is correct i go to another action which populate view for a next screen (jsp). If form is not filled correctly i need to show it again, but i can not forward to jsp - i need to forward to action that prepares the form - that's why i have my input parameter of action tag set to action which populate the view - previous action. I have a problem with page attribute. Please take a look at the sample of processing in my app: ACTION1 - JSP1 -ACTION2 - JSP2 -Action3 -JSP3 ... Let's assume that user submits form in JSP2 to action3. After ActionForm bean population, page property is set to 2. Next, validation fails in Action3 and input parameter of action3 forwards user to ACTION2. Before execute method in Action2 is invoked, ActionForm (viewBean) validation occurs. The page attribute is still set to 2 ! and commons-validator tries to validate properties that has page attribute set to 2.Obviously validation fails and control is forwarded to Action1. Action1 also has validation set to true and validation of ActionForm occurs again with page =2. Validation fails and control is forwarded to ... Does anyone have any idea to solve the problem. My idea is to not to use hidden page parameter in each jsp action but set page property of viewBean in each Action: for ACTION2 sets it to 2, for Action3 sets it to 3 ... and to override validate method in viewBean: public ActionErrors validate( ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = super.validate(mapping,request); if(errors != null errors.size() 0 ) page--; return errors; } Maybe someone knows more elegant solution, or maybe architecture of my app isn't valid. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts filter help
Depending on what you mean by Java file starts, there's 3 things you can do. - Once on creation of a session, implement HttpSessionListener and specify the listener in web.xml - Once for every request, create a filter by extending AbstractHttpFilter or implementing HttpFilter and specify the filter and what URLs map to the filter in web.xml - Once on startup (or shutdown) of the web app (including deployment), create a ContextListener by implementing ServletContextListener and specify the listener in web.xml HTH, -ed On 5/5/06, Stanislav [EMAIL PROTECTED] wrote: Hi! I want to do some check every time when java file starts. How can i do this? I think that is posible with filter in web.xml, but i dont know how to do this :-( Tnx, Stanislav - 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 create a Waiting Page for long requests?
I've done exactly this in another app with both a meta-tag to resubmit and a button to do same. It would check a status flag somewhere (db, session var, whatever) and when set it will jump to a done action. The tricky part is that you can't create a new thread in your action as it violates the servlet spec (as you don't know what thread will get subsequent requests from the same session, so you've lost the handle to your child thread), so what I did is had a JMS receiver that sat idle until the action sent a JMS message to the receiver which would then start the asynchronous process. The receiver process [thread] would do what it needed to do, set the magic status flag, and then wait for another request. -ed On 5/3/06, Shshank Jain [EMAIL PROTECTED] wrote: I have used div and js and it works fine. but if u dont want to use it...maybe just an idea. redirect the user to a page with the waiting message and the hidden form and resubmit that.. -shanky On 5/3/06, Julian Tillmann [EMAIL PROTECTED] wrote: Hi again, thanks for the suggestions, but I'd rather not use JavaScript, so any advice besides that? ciao 4 now Julian --- Ursprüngliche Nachricht --- Von: Shshank Jain [EMAIL PROTECTED] An: Struts Users Mailing List user@struts.apache.org Betreff: Re: How to create a Waiting Page for long requests? Datum: Wed, 3 May 2006 12:34:08 +0530 Hii One way could be to dynamically create a full page size div and place it over the whole page on the higher z-index this will disable the access to the underlying buttons etc. If you have select list with submission on onchange event then you may have to disable them manually using javascript as browser places them on the highest z-index exposing them during the request. - Shanky On 5/3/06, Roy, Ansuman [EMAIL PROTECTED] wrote: when a user submits anything on the jsp page you can try and disable the submit button and display a message for please wait. all this can be achieved with the help of java script. regards, Roy -Original Message- From: Julian Tillmann [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 03, 2006 11:44 AM To: [EMAIL PROTECTED]; user@struts.apache.org Subject: How to create a Waiting Page for long requests? Hi I want to prevent a user from submitting long during database queries twice. Therefore I try to include a waiting page. Can someone name me an example or give me a tip how to implement it? Thanks a lot Julian -- Feel free - 10 GB Mailbox, 100 FreeSMS/Monat ... Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- GMX Produkte empfehlen und ganz einfach Geld verdienen! Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner - 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 create a Waiting Page for long requests?
Great link, thanks!! -ed On 5/3/06, Jakub Milkiewicz [EMAIL PROTECTED] wrote: Hi I think JMS is only valid , i.e. following specification solution. Take a look at: http://www.javaranch.com/newsletter/200403/AsynchronousProcessingFromServlets.html 2006/5/3, Dave Newton [EMAIL PROTECTED]: Ed Griebel wrote: The tricky part is that you can't create a new thread in your action as it violates the servlet spec (as you don't know what thread will get subsequent requests from the same session, so you've lost the handle to your child thread), Oh, yeah? Is that equally valid for a servlet that's run only on initialization that starts a thread that thrashes through the database every now and then doing something? I know I could use jCrontab/etc. but they're already mad enough at me for using not-invented-here stuff :-( Dave - 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: Validator rules not loaded
You probably have some kind of typo in your DTD specification in validation.xml or validator-rules.xml, as most modern appservers will pull DTDs out of jars. Ensure that commons-validator.jar is included in your war/ear file. Also, if validator rules are so critical to security, you should probably throw an exception at app startup (in an app context listsener) so the app won't even be out there if the validation rules are not loaded. -ed On 5/2/06, Lance Semmens [EMAIL PROTECTED] wrote: Struts is not loading validator rules if the validator dtd can not be retrieved. On app server startup, the following is reported: 2006-04-29 16:18:23,420 ERROR [org.apache.struts.validator.ValidatorPlugIn] jakarta.apache.org java.net.UnknownHostException: jakarta.apache.org at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177) at java.net.Socket.connect(Socket.java:507) at java.net.Socket.connect(Socket.java:457)* : : *Im assuming that this is exception occurs trying to retrieve http://jakarta.apache.org/commons/dtds/validator_1_1.dtd After this, my app works fine except there are now no rules being applied to my forms which poses a *slight* security issue. ** -- Lance Semmens Marketpipe Limited a. 7 Soho Square, London W1D 3QB, UK t. +44 20 7297 8401 f. +44 20 7297 8427 e. [EMAIL PROTECTED] w. www.marketpipe.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: jsessionid problem fix for weblogic servers
I don't have a copy of SIA, so I'm not sure what it says, but as I understand URL rewriting, it is always used on the struts URLs on the first page returned after a session is initiated, and for links in subsequent pages when the browser doesn't return a cookie with the session ID. By turning this off, sessions will not be maintained with browsers whose cookies are turned off or not supported. I'm sure you've tried a lot of things already, but using hardcoded/hand-generated links instead of html:rewrite or html:link tags would probably work (maybe with the path embedded as config-params in web.xml), or if your app server is fronted by Apache you could use mod_rewrite to strip the jsessionid= from URLs. Or, maybe if you put the images in the WAR but not under /do/* (or whatevers configured as the struts servlet prefix in servlet-mapping) the links would not be rewritten. The first idea is the one that I'm using on a project now. -ed On 5/2/06, Braun, James F [EMAIL PROTECTED] wrote: I had a problem with jsessionid trashing all my images and urls until I refreshed my browser. Ted Husted points out this phenomenon on page 66 of SIA. The symptom is that ;jsessionid=~long id string here is appended to urls which confuses the weblogic app server. The fix for weblogic is to add the following to the weblogic.xml file session-descriptor session-param param-nameURLRewritingEnabled/param-name param-valuefalse/param-value /session-param /session-descriptor I'm sending out this solution because it has been a repeated subject on this list. Should I put it in the wiki? J. J. Braun Polaroid Corp. Waltham MA USA +1 (781) 386 6871 [EMAIL PROTECTED] java, sql, xml, jsp, eeuts -- This transmission is intended only for use by the addressee(s) named herein and may contain information that is proprietary, confidential and/or legally privileged. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you. - 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: StrutsTestCases
There was a question about this a couple of days ago where web.xml was not being found. Also, it looks like you have a leading slash before the D: in setConfigFile(), that could be the problem. HTH -ed On 4/27/06, Chaitanya Parkhi [EMAIL PROTECTED] wrote: hi friends i m working on Struts Test Cases ,i have written the following code,for testing accurate user login from login page for my application i hav included strutsTest-2.1.3.jar,junit.jar from JUNIT_HOME directory,when i run the following code i m getting following failures: 1.junit.framework.AssertionFailedError: The /WEB-INF/web.xml was not found. 2.junit.framework.AssertionFailedError: No tests found in servletunit.struts.MockStrutsTestCase can anybody plz tell me whats a problem? is ther anything reqd to write in web.xml for StrutstestCases? import servletunit.struts.MockStrutsTestCase; public class TestLoginAction extends MockStrutsTestCase { public void setUp() throws Exception { super.setUp(); } public void tearDown() throws Exception { super.tearDown(); } public TestLoginAction(String testName) { super(testName); } public void testSuccessfulLogin() { setConfigFile(/D:/Projects/Silk-Server/Phase2-RTQA1-Branch/SilkMobileServerWeb/WebRoot/WEB-INF/config/struts- config.xml); setRequestPathInfo(/login); addRequestParameter(username,cdpadmin); addRequestParameter(password,cdp); actionPerform(); String[] actionErrors = {username.required,password.required}; verifyActionErrors(actionErrors); } public void testFailedLogin() { addRequestParameter(username,cdpadmin); addRequestParameter(password,indiana); setRequestPathInfo(/login); actionPerform(); verifyTilesForward(success,success.tiles.def); verifyActionErrors(new String[] {error.password.mismatch, error.username.required,error.password.required}); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Synchronization of dispatch Action
To answer your question, in general, its a very bad idea to synchronize action methods as that will bring your webapp to a screeching halt because Struts only creates a single instance of a given action class. What you will be doing is essentially handling a single request at a time, very bad. Now, the reason why you want to synchronize access is based on a bad design idea. You DO NOT want to have an instance to a database connection shared between different requests because of the concurrency issues you refer to. You don't even want to share a connection within a session for a couple of reasons: you don't want a connection open across different requests, and even if holding connections open for a long time isn't bad enough, you can have multiple client web pages that are part of the same session hitting the same connection at the same time, which will certainly break something, and probaly not until your web app is in production :-) You need to do some research on how to use a connection pool, and then have your DAOs either get a connection from the connection pool or take a connection as an argument which will be supplied by the action. I prefer the latter, that way you can chain operations on the database in an action without the overhead of each dao call getting and then freeing a connection from the pool. Also, transactions across DAOs are much easier with the latter solutions too. I don't have any links handy, but there's probably at least a half-dozen pages about this on the Struts wiki that you can find at http://struts.apache.org/ HTH, -ed On 3/21/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Is it a good idea to synchronize DispathAction to make sure all requests to DB and results which come back don't overstep each other ? Pls help. Following is some detail of what am I doing in my application. I have few operation I want to synchronize. In my app following steps I am taking 1. calling dispatch Action getInstrumentsFromQ as under, Should this be synchronized ? public ActionForward getInstrumentsFromQ(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { .. .. } 2. In Dao service I have couple of lists which are stored as Class variable, where I store one I received from DB. public class InstrumentDiceQdao extends BaseDao implements InstrumentDao{ private List instruments =(List ) Collections.synchronizedList(new ArrayList()); private List instrumentDbItems = (List) Collections.synchronizedList(new ArrayList()); public synchronized List getAllInstrumentsFromQ(Long sectorId) throws DiceWebException { ... ... } } 3. I am putting service object which has results of all DB query in Session, so I can access from various places in web. InstrumentService instService = new InstrumentDaoService(ds) ; try { synchronized(instService) { List instruments = instService.getAllinstrumentsFromQ(sectorId); session.setAttribute(InstrumentService,instService); } } This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of JPMorgan Chase Co., its subsidiaries and affiliates. -- The greatest tyrannies are always perpetrated in the name of the noblest causes. Thomas Paine Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety - Benjamin Franklin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Java (O/T) thing
I wrestled with this exact thing this week. For the benefit of people searching the archives, to force a 1.4-compatible JDK to be used by a 1.5 compiler you can use -target 1.4 -source 1.4 on the javac command line, or for ant, target='1.4' source='1.4' in your javac task. -ed On 3/14/06, Wendy Smoak [EMAIL PROTECTED] wrote: On 3/14/06, Martin Gainty [EMAIL PROTECTED] wrote: Does anyone know what this message means? class file has wrong version 49.0, should be 48.0 You're using JDK 1.4 and attempting to use a class that was compiled for JDK 1.5 (or Java SE 5). -- Wendy \ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How To Use Existing Tags to Test and Write Out the Value of the Size of a Collection?
If you're using a JSP 2.0 container you can use fn:length(expr), see http://www.onjava.com/pub/a/onjava/2003/11/05/jsp.html?page=last and http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/fn/length.fn.html If you're not using a JSP 2.0 container, you can use a taglib in the Jakarta Taglibs sandbox, there's a size tag in the unstandard taglib: http://jakarta.apache.org/taglibs/sandbox/doc/unstandard-doc/intro.html. I don't know how well supported the unstandard taglib is, but from what I've found when looking at the source code for Unstandard is that the methods are pretty basic and what I would write, so it saves me writing my own tags. -ed On 3/6/06, Caroline Jen [EMAIL PROTECTED] wrote: I have a Collection called 'remarks'. I can use the logic:notEmpty or logic:empty tags to test out if the Collection has some elements in it or not. 1. Is there any tag I can use to test the size value of that Collection to be zero or greater than zero? Or I have to use the Java code in my JSP page? 2. Is there any tag I can use to output the remarks.size(); to the browser? I simply think that it should not be too much Java code in a JSP page. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- The greatest tyrannies are always perpetrated in the name of the noblest causes. Thomas Paine Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety - Benjamin Franklin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [FRIDAY] You might be a pointy-haired-boss if ...
- When PHB asks for weekly progress report on a project and you begin to describe tasks a, b, and c completion status, he interrupts with I just need to know a percentage, and then gets visibly annoyed when you take last week's progress and just add 5% to it. - When PHB tries to relate his mainframe development experience from a decade back to Java/Struts development, particularly in the context of trying to knock down your task estimates. -ed On 1/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: . . . you want to know whether that feature is 90% done or 95% done. --- On Fri 01/27, Ted Husted [EMAIL PROTECTED] wrote: From: Ted Husted [mailto: [EMAIL PROTECTED] To: user@struts.apache.org Date: Fri, 27 Jan 2006 08:54:40 -0500 Subject: [FRIDAY] You might be a pointy-haired-boss if ... ... you think blogs are a breakfast treat.Engineer: I like to start each day with a cup of coffee and a couple of blogs.PHB: ... H ... A cream-filled blog would hit the spot ...-Ted.** http://husted.com/ted/blog/-To unsubscribe, e-mail: [EMAIL PROTECTED] additional commands, e-mail: [EMAIL PROTECTED] ___ Join Excite! - http://www.excite.com The most personalized portal on the Web! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- The greatest tyrannies are always perpetrated in the name of the noblest causes. Thomas Paine Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety - Benjamin Franklin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: constant strings in the tags
I've just started using the taglib unstandard in the Jakarta Sandbox which has a JSP tag that does exactly what you want. Say you have a class called org.myorg.Constants, this tag creates an associative array of the members like so: %@ taglib uri=http://jakarta.apache.org/taglibs/unstandard-1.0; prefix=un% un:useConstants var=Constants className=org.myorg.Constants/ c:out value=My constant value: ${Constants.FOO}/ HTH, -ed On 1/24/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: In my action classes, and other java classes, I use defined constants for my Strings. This is a common best practice. One frequent location of this practice is the names for the attributes I set on the session and request ojbects. Most of the time, I then access these attributes on my JSP pages via various struts and jstl tags. But when I reference these objects from the JSP side, I find that I can't use defined constants. This undermines like 50% of the benefit of using defined constants for my attribute names. Since the strust platform seems to demonstrate best practices most of the time, I find it hard to believe that there isn't some what to use defined constants in the JSP side. I guess that isn't strut's realm, strictly speaking. It seems that if the JSP is really just a servlet, then surely I can use the defined constants just as I do from java code. But I don't know how to do this. Anybody know how? ___ Join Excite! - http://www.excite.com The most personalized portal on the Web! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- The greatest tyrannies are always perpetrated in the name of the noblest causes. Thomas Paine Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety - Benjamin Franklin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts and JSTL
The problem is that you're putting the 'amount' field into a hidden field and then trying to use that hidden field as a value, but your amt bean will actually contain the value of the form field: input type='hidden' value='123.00'/ Try this instead. First, in your action save this amount value to the request scope: request.setAttribute(amount, yourAmountVar); Then put in your JSP, assuming a JSP 2.0 container: td fmt:formatNumber value=${amount} type=currency/ /td -ed On 1/23/06, fea jabi [EMAIL PROTECTED] wrote: would like to display the value of property amount as $10,00,000. tried using the below. But getting an error/ it doesn't get displayed. Is this the way to do this. Or is there an easier way to do the same? td bean:define id=amthtml:text name=Form1 property=amount styleClass=invisibleInput readonly=true tabindex=-1//bean:define % System.out.println(amt);% fmt:formatNumber value=${amt} type=currency/ /td Thanks. _ Is your PC infected? Get a FREE online computer virus scan from McAfee(r) Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- The greatest tyrannies are always perpetrated in the name of the noblest causes. Thomas Paine Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety - Benjamin Franklin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What JDK version are you using?
1.4 (+ Struts 1.2 ) We're locked into this for at least a couple of years, corporate decision. -ed On 1/23/06, Niall Pemberton [EMAIL PROTECTED] wrote: What JDK version are you using? - [ ] JDK 1.2 [ ] JDK 1.3 [ ] JDK 1.4 [ ] JDK 1.5 (or JDK 5) - I'm mainly interested in the impact of moving Commons Valdator to a minimum dependency of JDK 1.4 to use the RegExp support rather than depending on ORO, so it would be useful if you could indicate whether you are using Validator or not. tia Niall - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- The greatest tyrannies are always perpetrated in the name of the noblest causes. Thomas Paine Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety - Benjamin Franklin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: gone MAD with servlet / xls download on winXP
I agree, it sounds like a configuration issue on your PC. Have you tried it on a different PC? Possibly one not set up by the same Corporate IT department? -ed On 1/17/06, Thomas Joseph [EMAIL PROTECTED] wrote: Try any/all of these: 1. WinXP + Firefox. 2. reinstalling Excel 3. save file and open Note that everything works on IE 6.0 (or firefox) in win2k (so I decided not to post any code samples) but opening file fails on IE 6.0 in winXP What is wrong then? I tried plethora of different headers in every possible combinations found in posts of similar (but not equal) problems with file downloads. Regards Thomas Joseph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- The greatest tyrannies are always perpetrated in the name of the noblest causes. Thomas Paine Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety - Benjamin Franklin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: downloading a file using struts action class
On the thread today called gone MAD with servlet / xls download on winXP, someone suggested that sending the no-cache directive will cause IE to download the file and then remove it before starting the associated application. This sounds like what is happening in your case as well. -ed On 1/17/06, temp temp [EMAIL PROTECTED] wrote: I am using struts action class to download a file . Here is the action class public ActionForward execute(ActionMapping aActionMapping, ActionForm aActionForm, HttpServletRequest aHttpServletRequest, HttpServletResponse aHttpServletResponse) throws Exception { String aFileName=aHttpServletRequest.getParameter(IWeb.FILE_NAME); aHttpServletResponse.setContentType(application/octet-stream); Integer aSysAttachId = new Integer(aHttpServletRequest.getParameter(IWeb.SYS_ATTACH_ID)); aHttpServletResponse.setHeader(Content-Disposition, attachment; filename=\ +aFileName+ \); download(aApplicationInfoDelegate.getApplicationAttachemntFile(aSysAttachId),aHttpServletResponse); return null; } private void download(byte[] byteArray, HttpServletResponse httpServletResponse) throws IOException, SQLException { try { BufferedOutputStream aBufferedOutputStream =new BufferedOutputStream(httpServletResponse.getOutputStream()); aBufferedOutputStream.write(byteArray,0,byteArray.length); aBufferedOutputStream.close(); } catch (Exception e) { throw new IllegalArgumentException(e.getMessage()); } } download works in mozilla but in internet explorer when user chooses to open the downloaded file (a pdf) rather than saving IE opens Adobe Acrobat reader with an error message There was an error opening this document .This file cannot be found. Can somebody guide me what is going wrong here ? Thanks Regards - Yahoo! Photos – Showcase holiday pictures in hardcover Photo Books. You design it and we'll bind it! -- The greatest tyrannies are always perpetrated in the name of the noblest causes. Thomas Paine Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety - Benjamin Franklin
Re: more on wicket
On 1/16/06, Nick Heudecker [EMAIL PROTECTED] wrote: You can create aliases in the current version to provide shorthand names for pages. Wicket 1.2 will allow you to mount pages at specified URLs, which should get around this problem. ...which are currently configured by what, XML? Doesn't this remove some of the zero-conf advantages? And, there's going to have to be a way to configure it in 1.2 somehow also. I guess almost zero configuration isn't as catchy? :-) All this Wicket/RoR/zero-conf stuff (and SilverStream too, if anyone remembers that) reminds me of Visual Basic back in the day: it's a very productive framework if your problem is within the class of problems that were envisioned, but once you need to step outside that box, you're screwed as you are spending more time fighting with the framework than problem domain coding. -ed On 1/16/06, David G. Friedman [EMAIL PROTECTED] wrote: More wicket articles? I'm getting a message here: I bet you wish Struts Action 2.0 was really Struts Wicket 2.0. LOL. Personally, I had trouble with how it implements zero configuration files and how the URLs look freaky in the current version. Regards, David Friedman / [EMAIL PROTECTED] -Original Message- From: news [mailto:[EMAIL PROTECTED] Behalf Of netsql Sent: Monday, January 16, 2006 9:29 AM To: user@struts.apache.org Subject: ot: more on wicket http://www.javalobby.org/java/forums/t60786.html .V - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- The greatest tyrannies are always perpetrated in the name of the noblest causes. Thomas Paine Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety - Benjamin Franklin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: bean:write internationalization
Try this, it's much cleaner and doesn't use scriptlets: c:set var=promptValuebean:message key=prompt.myValue//c:set bean-el:message key=my.key arg0=${promptValue}/ You don't need the EL version of the library if you're using a JSP 2.0 server, just use bean:message. -ed On 1/13/06, Gary Feidt [EMAIL PROTECTED] wrote: The last time I did this in a jsp I had to write a little scriplet code to go with it. Here is what I did: % java.util.ResourceBundle bundle = ResourceBundle.getBundle(Constants.RESOURCE_BUNDLE, currentUser.getLocale()); sArg0 = bundle.getString(jsp.event.future); % bean:message key=jsp.appointment.nofutureappt arg0=%= sArg0 %/ I hope this helps. Gary [EMAIL PROTECTED] 1/13/2006 10:00:24 AM Hello all, I m stuck with a very simple problem :( I have a bean:write key=my.key Where My.key =this is {0} message I need to replace {0} with another property which is in my app resources file But looks like this syntax does not work bean:write key=my.key arg0=prompt.myvalue/ Anyone could help? Thanx and regards marco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Confidentiality Statement: This email/fax, including attachments, may include confidential and/or proprietary information and may be used only by the person or entity to which it is addressed. If the reader of this email/fax is not the intended recipient or his or her agent, the reader is hereby notified that any dissemination, distribution or copying of this email/fax is prohibited. If you have received this email/fax in error, please notify the sender by replying to this message and deleting this email or destroying this facsimile immediately. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- The greatest tyrannies are always perpetrated in the name of the noblest causes. Thomas Paine Those who would give up essential Liberty, to purchase a little temporary Safety, deserve neither Liberty nor Safety - Benjamin Franklin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]