RE: PropertyUtils.copyProperties() usage in 1.1-b2
Craig, Rana, thanks for your responses, hoping you guys can provide some input: From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Subject: Re: PropertyUtils.copyProperties() usage in 1.1-b2 I'm trying to figure out what I am doing wrong with PropertyUtils.copyProperties(). From within my Action, I have: User user = bean; DynaActionForm regForm = (DynaActionForm) form; PropertyUtils.copyProperties(regForm, user); When I look at what copyProperties is doing, it's getting a PropertyDescriptor array from getPropertyDescriptors() with the user bean correctly, then it iteratively tries to see if the regForm has any of the properties found in the user bean. But calling getPropertyDescriptor(regForm, fieldname) seems to be comparing the (correct) field names from the bean against the *structure* of the DynaActionForm component (i.e. the multipartRequestHandler, dynaClass, servlet, etc), instead of the DynaFields that I set up in my form-bean/. Which CVS version number of PropertyUtils are you looking at (second line of the sources? The version I'm looking at, 1.32 (i.e. the current nightly builds), does not call getPropertyDescriptors() on a DynaBean. K, here's what I'm seeing under PropertyUtils 1.32: in copyProperties: orig is neither Map nor DynaBean, so line 283 calls getPropertyDescriptors(orig). Then, for each readMethod in the result, line 296 has: String name = origDescriptors[i].getName(); if (getPropertyDescriptor(dest, name) != null) { But getting into getPropertyDescriptor(), line 869 calls getPropertyDescriptors(bean). If the dest is a DynaBean, I'm not seeing where the instanceof DynaBean is -- it simply calls Introspector.getBeanInfo().getPropertyDescriptors(), but the result of getBeanInfo doesn't know anything about DynaBeans. What am I missing here? Rana says this is working and appreciate his input, especially with the release notes reference (thanks!) But tracing through the code and triple-checking at the beans (they both have a name property), I still can't see how this is going to work, and in practice, the destination DynaBean is untouched. Thanks again, -b -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
ActionServlet unable to proceed...pl help
Hi! While running the following code (more or less same as Javaranch's march article) in weblogic 7.0, the LoginView.jsp accepts UserID and Pwd but then the login.do returns a blank page...seems ActionServlet is unable to proceed. Here's my directory structure (weblogic 7.0) and the source codes (more or less same as March article). Pl help. examplesWebApp |_WEB-INF | |___classes | |___lib|___test | struts-config.xml |__struts | web.xml LoginAction.class |LoginBean.class MainMenu.jsp LoginForm.class LoginView.jsp MessageResource.props The files are as under: !-- LoginView.jsp -- %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/struts.tld prefix=struts % HTML HEADTITLEstruts:message key=title.login //TITLE/HEAD BODY struts:message key=heading.login / html:errors / html:form action=/login p struts:message key=label.userId /: html:text property=userId size=10 / br struts:message key=label.passWord /: html:password property=passWord size=10 / brbr html:submit bean:message key=button.submit / /html:submit /html:form /BODY /HTML ** File:struts-config.xml ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.0//EN http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd; struts-config !-- == Form Bean Definitions -- form-beans form-bean name=login type=test.struts.LoginForm / /form-beans !-- == Global Forward Definitions = -- global-forwards /global-forwards !-- == Action Mapping Definitions -- action-mappings action path=/login type=test.struts.LoginAction scope=request name=login input=LoginView.jsp validate=true forward name=valid path=MainMenu.jsp redirect=true/ forward name=invalid path=LoginView.jsp redirect=true/ /action /action-mappings /struts-config ** !-- MainMenu.jsp -- %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/struts.tld prefix=struts % jsp:useBean id=LoginBean scope=request class=test.struts.LoginBean / HTML HEADTITLEstruts:message key=title.mainmenu //TITLE/HEAD BODY struts:message key=heading.mainmenu / p struts:message key=label.userType /: bjsp:getProperty name=LoginBean property=userType //bbr /BODY /HTML ** File: web.xml web-app display-nameExamples Web Application/display-name !-- Action Servlet Configuration -- servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valuetest.struts.MessageResources/param-value /init-param init-param param-namemapping/param-name param-valueorg.apache.struts.action.RequestActionMapping/param-value /init-param init-param param-nameconfig/param-name param-value/WEB-INF/struts-config.xml/param-value /init-param init-param param-namedebug/param-name param-value2/param-value /init-param load-on-startup2/load-on-startup /servlet !-- Action Servlet Mapping -- servlet-mapping servlet-nameaction/servlet-name url-pattern*.do/url-pattern /servlet-mapping !-- Struts Tag Library Descriptors -- taglib taglib-uri/WEB-INF/struts-bean.tld/taglib-uri taglib-location/WEB-INF/struts-bean.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/struts-html.tld/taglib-uri taglib-location/WEB-INF/struts-html.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/struts-logic.tld/taglib-uri taglib-location/WEB-INF/struts-logic.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/struts-template.tld/taglib-uri taglib-location/WEB-INF/struts-template.tld/taglib-location /taglib /web-app * package test.struts; import javax.servlet.http.*; import org.apache.struts.action.*; public class LoginAction extends Action { public LoginAction() {} public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException{ LoginBean lb = new LoginBean(); request.setAttribute(LoginBean, lb); lb.setParameters(request); ActionErrors ae = lb.validate(); request.setAttribute(Action.ERROR_KEY, ae); if (ae == null || ae.size() == 0) { System.out.println(after LoginAction); return mapping.findForward(valid); } else { return mapping.findForward(invalid); } } }
Wrong form bean instantiated by controller!
I have an index.jsp, which optionally %@ include %s two fragments: one is a login form (connected to a LoginForm action form bean), the other a list of items. The login form is only included if there is no user bean in the session scope (determined via logic:present tags). The other fragment is always included, but if the user is logged in, each item has a form associated with it. I have an action (FrontPageAction, frontPage.do) which puts an ArrayList of Foo objects in the request scope, then forwards to the index.jsp. Easier to explain with a code snippet... foos is a request scoped ArrayList of Foo objects (which has legLength and fooID properties): logic:iterate id=element name=foo pbean:write name=element property=legLength//p logic:present name=user scope=session html:form action=/rateFoo input type=hidden name=fooID value=%=((Foo)element).getFooID()%/ html:radio property=rating value=1/ html:radio property=rating value=2/ html:radio property=rating value=3/ html:submit value=Rate!/ /html:form /logic:present logic:iterate/ So, with nobody logged in, hitting frontPage.do displays the front page correctly. I get my list of Foo objects (with no rating forms) and my login form. I log in, and the last thing my LoginAction does is forward back to frontPage.do. The login box is no longer displayed, and the rating forms should be, but it breaks because the LoginForm bean is still there, instead of a RatingForm! So I get a stack trace, complaining that org.apache.struts.taglib.html.BEAN doesn't have a rating property. But if I then type frontPage.do into my address bar, everything works as expected! So my questions are: 1. Is this a good design? Am I allowed to have multiple different forms on the one page, or should I have a seperate guestIndex.jsp and memberIndex.jsp? 2. Am I allowed to have many of the *same* form on the one page, distinguishing which element is having its form submitted by looking at a hidden property? Or should I go about this differently, using javascript tricks (I'd prefer to avoid this if possible). 3. Should I need to remove anything from the request scope at the end of my LoginAction, and if so, what? Cheers, Robert. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Struts-el/JSTL/dynamic img
Hi, Eddie bush wrote. From the archives --- ... and if you happen to be able to use the JSTL ... David Karr wrote a taglib for struts which should soon be in the contrib directory. It's called Struts-EL, and it incorporates the JSTL's EL engine into the standard Struts tags we all know and love. Using his taglib, you could do the following: html:img src=${BEAN.property}/ Nice, eh? Search the archive for struts-el, and you're bound to happen across how you can get the taglib. If you're stuck using the HTML img src=... go with Martin's suggestion. My question is. Is this valid ? html:img src=${BEAN.property}/ Though we are using JSTL, we are assuming it is the same as the Struts-el. Same engine ? Our tag html:img src=${image.name} width=730 height=350 border=0 usemap=#Map/ generates img src=${image.name} height=350 width=730 border=0 usemap=#Map Do you see something wrong here ? Thanks, Mohan -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Struts-el/JSTL/dynamic img
Did you load tld file correctly in web.xml and declare struts-el in your jsp file? -Dan - Original Message - From: Mohan Radhakrishnan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, November 17, 2002 5:27 AM Subject: Struts-el/JSTL/dynamic img Hi, Eddie bush wrote. From the archives --- ... and if you happen to be able to use the JSTL ... David Karr wrote a taglib for struts which should soon be in the contrib directory. It's called Struts-EL, and it incorporates the JSTL's EL engine into the standard Struts tags we all know and love. Using his taglib, you could do the following: html:img src=${BEAN.property}/ Nice, eh? Search the archive for struts-el, and you're bound to happen across how you can get the taglib. If you're stuck using the HTML img src=... go with Martin's suggestion. My question is. Is this valid ? html:img src=${BEAN.property}/ Though we are using JSTL, we are assuming it is the same as the Struts-el. Same engine ? Our tag html:img src=${image.name} width=730 height=350 border=0 usemap=#Map/ generates img src=${image.name} height=350 width=730 border=0 usemap=#Map Do you see something wrong here ? Thanks, Mohan -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: bean:struts problem
On Sat, 16 Nov 2002, Zsolt Koppany wrote: Hi, I want to access the form data using the command: bean:struts id=form formBean=loginForm/ loginForm is defined in struts-config.xml as follows: form-bean name=loginForm type=cv.security.LoginForm / I get the error attached below for the command as follows: logic:notEmpty name=form property=message The form does have a getMessage() method. The problem is that bean:struts does not return the form bean, it returns the form bean *configuration*. The bean:struts tag gives you access to the configuration data from your struts config file. If you want to access the form bean itself, you should be doing so directly, as it is in either request or session scope. -- Martin Cooper How can I fix this problem? ERROR Message: [ServletException in:/admin/login.jsp] No getter method for property message of bean form' javax.servlet.ServletException: No getter method for property message of bean form at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:494) at org.apache.jsp.login_jsp._jspService(login_jsp.java:277) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:204) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:575) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:498) at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:820) at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:395) at -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
DynaActionForm and JavaBean form-property
Greetings. Has anyone used DynaActionForm with form-property of type normal javabean. We are getting error while submitting the form ie. transport data from JSP to action. The error is javax.servlet.ServletException:BeanUtils.populate() ... root cause java.lang.IllegalArgumentException: No bean specified. at org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(Propert yUtils.java:819) could anyone help us. Thanks for your cooperation and help. -guna
Re: Small log4j PlugIn-Contribution
On Fri, 15 Nov 2002, Thomas Nagel wrote: Hi, I guess more people than I had the problem to use log4j inside a non log4j enviroment e.g. Caucho Resin. I'm not sure I understand why you need this plugin (apart from the reloading aspect). If you have log4j.jar in WEB-INF/lib and log4j.properties in WEB-INF/classes, it should just work. -- Martin Cooper I wrote a small Struts log4j PlugIn which might be useful to those who do not want to reinvent the wheel ;-) The Plug-In is also able to reload configuration after a given sleep time, because restarting the server on every property file change anoyed me. Use: 1) put your log4j.properties in your /WEB-INF/ directory. 2) Add the following to your struts-config.xml plug-in className=Log4jPlugIn !-- sleep time, default to 2 minutes sleep time of 0 means no background thread -- set-property property=sleepTime value=120 / !-- where to find the log4j.properties file -- set-property property=logProperties value=/WEB-INF/log4j.properties / /plug-in 3) Compile the following and add to your /WEB-INF/classes - code - import java.io.File; import javax.servlet.ServletException; import org.apache.log4j.PropertyConfigurator; import org.apache.log4j.Logger; import org.apache.struts.action.PlugIn; import org.apache.struts.config.ApplicationConfig; import org.apache.struts.action.ActionServlet; /** * Initializes the a href=http://jakarta.apache.org/log4j;log4j/a * system with a given log4j.properties file for non - Log4j enviroments, * e.g. Caucho Resin. * p * This class also starts a background thread which checks the modification * time of the property file periodically (sleepTime) and updates the * system if necessary. * p * Default sleep time is 2 minutes, a sleep time of 0 simply means * NO background thread. * * @author a href=mailto:[EMAIL PROTECTED];Thomas Nagel/a * @version $Revision: 1.1 $ $Date: 2002/11/12 09:23:27 $ */ public final class Log4jPlugIn implements PlugIn { // --- members /** Logger instance to use with this Plugin. */ private Logger log; /** Path to find the log properties. */ private String _logConfiguration; /** Which configuration file to use. */ private File _logProperties; /** When was last time the logging properties where modified. */ private long _lastChange; /** * The background thread which updates the log4j if the configuration * file has changed. */ private ModificationWatcher _modificationWatcher; /** * How long should the modification thread sleep until * it reloads the configuration? Default to 2 minutes * (12 milliseconds). */ private long _sleepTime = 12; // --- constructor /** Creates a new instance of DatabasePlugIn */ public Log4jPlugIn() {} // --- methods /** * Initializes the Log4jPlugIn by configuring the log4j system * with the given property file. * * @throws ServletException if initialization failes. */ public void init(ActionServlet servlet, ApplicationConfig applicationConfig) throws ServletException { try{ _logProperties = new File(servlet.getServletContext().getRealPath(getLogProperties())); configureLog4j(); log = Logger.getLogger(getClass().getName()); if(_sleepTime 0 ){ _modificationWatcher = new Log4jPlugIn.ModificationWatcher(); _modificationWatcher.start(); } }catch(Exception e){ throw new ServletException(Could not initialize log4j subsystem, e); } log.info(Log4j successfully initialized.); } /** * Not used but required by interface. */ public void destroy() { log.info(Shutting down log4j system.); _modificationWatcher.shutdown(); } /** * Configures the log4j system. */ private void configureLog4j() throws Exception { PropertyConfigurator.configure(_logProperties.toURL()); _lastChange = _logProperties.lastModified(); } // properties public String getLogProperties() { return _logConfiguration; } public void setLogProperties(String logProperties) { _logConfiguration = logProperties; } public void setSleepTime(String sleepTime) { _sleepTime = Long.parseLong(sleepTime); } // -- inner classes
RE: Tiles referencing actions.
On Fri, 15 Nov 2002, ROSSEL Olivier wrote: But when I want to tiles:put the output of the LoginState action into the loginBox : tiles:insert page=/pages/MainLayout.jsp flush=true tiles:put name=title value=/pages/Title.jsp/ tiles:put name=loginBox value=/LoginState.do/ /tiles:insert , nothing appears. My question: is it possible to have tiles:put to display the output of an action, instead of just the output of a (statically-referenced) jsp. I answer to me: yes you can reference to a Struts action from a tile. But this action must not forward to a result page via a redirection (: forward ... redirect=true will make the tile to display nothing.) So my question is: why? Having redirect=true in the forward of an action is quite good. But it is incompatible with tiles, which are also quite good. Tiles needs to use request attributes to communicate information between the tiles on a page. Using a redirect loses att request attributes, because it requires a round trip to the browser and back. -- Martin Cooper Is it a feature? This e-mail is intended only for the above addressee. It may contain privileged information. If you are not the addressee you must not copy, distribute, disclose or use any of the information in it. If you have received it in error please delete it and immediately notify the sender. Security Notice: all e-mail, sent to or from this address, may be accessed by someone other than the recipient, for system management and security reasons. This access is controlled under Regulation of Investigatory Powers Act 2000, Lawful Business Practises. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: What can I do to display unicode-string in struts tag?
On Thu, 14 Nov 2002, Huynh Ngoc Huy wrote: I'm using struts version 1.1b2. The followings are my snippet codes: * struts-config.xml * ... form-bean name=aForm type=org.apache.struts.action.DynaActionForm form-property name=msg type=java.lang.String/ ... action path=/aPath type=anAction name=aForm forward name=target path=/result.jsp/ /action ... * anAction.java * ... String s = a unicode-string from mysql database; PropertyUtils.setSimpleProperty(form, msg, s); ... return mapping.findForward(target); * index.jsp * %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % html:link page=/aPath.dogo/html:link * result.jsp * %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % html:form action=/aPath.do html:textarea property=msg cols=30 rows=5/ /html:form * In the result.jsp, the textarea cannot display the unicode-string correctly. What do you mean by unicode-string? Strings in Java are always Unicode. Perhaps you mean a string that contains non-Latin characters? If that's the case, you'll need to specify the encoding you want in the JSP page. The pages above do not specify an encoding, so they are defaulting to ISO-8859-1, which may not be what you want. Also, I've seen a couple of people mention problems related to storing non-Latin characters in a MySql database. I don't use MySql, so I can't help you with that, but you'll probably find more information in the mailing list archives. -- Martin Cooper Any help is appreciated ! Thanks in advance, Huy __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Struts-el/JSTL/dynamic img
Mohan == Mohan Radhakrishnan [EMAIL PROTECTED] writes: Mohan Hi, Mohan Eddie bush wrote. From the archives Mohan --- Mohan ... and if you happen to be able to use the JSTL ... David Karr wrote a Mohan taglib for struts which should soon be in the contrib directory. It's called Mohan Struts-EL, and it incorporates the JSTL's EL engine into the standard Struts Mohan tags we all know and love. Using his taglib, you could do the following: Mohan html:img src=${BEAN.property}/ Nice, eh? Search the archive for Mohan struts-el, and you're bound to happen across how you can get the taglib. Mohan If you're stuck using the HTML img src=... go with Martin's suggestion. Mohan Mohan My question is. Is this valid ? Mohan html:img src=${BEAN.property}/ Mohan Though we are using JSTL, we are assuming it is the same as the Struts-el. Mohan Same engine ? Mohan Our tag Mohan html:img src=${image.name} width=730 height=350 border=0 Mohan usemap=#Map/ Mohan generates Mohan img src=${image.name} height=350 width=730 border=0 usemap=#Map Mohan Do you see something wrong here ? Normally, I would expect the tag to look like: html-el:img src=${image.name} ... / because it's conventional to have a taglib line like: %@ taglib uri=/WEB-INF/struts-html-el.tld prefix=html-el % However, if you used a prefix of html instead of html-el, then that could work, although it would be unconventional. The fact that your attribute value isn't getting translated means that you're either using the wrong prefix, or you didn't specify the correct taglib line. -- === David M. Karr ; Java/J2EE/XML/Unix/C++ [EMAIL PROTECTED] ; SCJP -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Example of indexed properties and DynaBean?
Hi, can anyone point me to a working example of indexed properties and struts 1.1 (b2 or nightly). All my tests failed so far with various exceptions in the BeanUtils. Thanks in advance Christoph -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: ActionServlet unable to proceed...pl help
I believe WL 7 is servlet 2.3 compliant so you don't have to copy the tlds into WEB-INF. See the users guide for more details that will make your deployment easier. David From: Suman Das [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: ActionServlet unable to proceed...pl help Date: Sun, 17 Nov 2002 01:54:04 -0800 (PST) Hi! While running the following code (more or less same as Javaranch's march article) in weblogic 7.0, the LoginView.jsp accepts UserID and Pwd but then the login.do returns a blank page...seems ActionServlet is unable to proceed. Here's my directory structure (weblogic 7.0) and the source codes (more or less same as March article). Pl help. examplesWebApp |_WEB-INF | |___classes | |___lib|___test | struts-config.xml |__struts | web.xml LoginAction.class |LoginBean.class MainMenu.jsp LoginForm.class LoginView.jsp MessageResource.props The files are as under: !-- LoginView.jsp -- %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/struts.tld prefix=struts % HTML HEADTITLEstruts:message key=title.login //TITLE/HEAD BODY struts:message key=heading.login / html:errors / html:form action=/login p struts:message key=label.userId /: html:text property=userId size=10 / br struts:message key=label.passWord /: html:password property=passWord size=10 / brbr html:submit bean:message key=button.submit / /html:submit /html:form /BODY /HTML ** File:struts-config.xml ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.0//EN http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd; struts-config !-- == Form Bean Definitions -- form-beans form-bean name=login type=test.struts.LoginForm / /form-beans !-- == Global Forward Definitions = -- global-forwards /global-forwards !-- == Action Mapping Definitions -- action-mappings action path=/login type=test.struts.LoginAction scope=request name=login input=LoginView.jsp validate=true forward name=valid path=MainMenu.jsp redirect=true/ forward name=invalid path=LoginView.jsp redirect=true/ /action /action-mappings /struts-config ** !-- MainMenu.jsp -- %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/struts.tld prefix=struts % jsp:useBean id=LoginBean scope=request class=test.struts.LoginBean / HTML HEADTITLEstruts:message key=title.mainmenu //TITLE/HEAD BODY struts:message key=heading.mainmenu / p struts:message key=label.userType /: bjsp:getProperty name=LoginBean property=userType //bbr /BODY /HTML ** File: web.xml web-app display-nameExamples Web Application/display-name !-- Action Servlet Configuration -- servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valuetest.struts.MessageResources/param-value /init-param init-param param-namemapping/param-name param-valueorg.apache.struts.action.RequestActionMapping/param-value /init-param init-param param-nameconfig/param-name param-value/WEB-INF/struts-config.xml/param-value /init-param init-param param-namedebug/param-name param-value2/param-value /init-param load-on-startup2/load-on-startup /servlet !-- Action Servlet Mapping -- servlet-mapping servlet-nameaction/servlet-name url-pattern*.do/url-pattern /servlet-mapping !-- Struts Tag Library Descriptors -- taglib taglib-uri/WEB-INF/struts-bean.tld/taglib-uri taglib-location/WEB-INF/struts-bean.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/struts-html.tld/taglib-uri taglib-location/WEB-INF/struts-html.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/struts-logic.tld/taglib-uri taglib-location/WEB-INF/struts-logic.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/struts-template.tld/taglib-uri taglib-location/WEB-INF/struts-template.tld/taglib-location /taglib /web-app * package test.struts; import javax.servlet.http.*; import org.apache.struts.action.*; public class LoginAction extends Action { public LoginAction() {} public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException{
Re: Example of indexed properties and DynaBean?
You are not alone :( I also have tried several combinations same BeanUtils exceptions. My environment is jakarta-struts-1.1-b2 on Apache Tomcat/4.1.12 JSDK=1.4.1_01-b01 I also tried with JSDK1.3.1-06 where I got the exception: java.lang.reflect.InvocationTargetException: java.lang.IndexOutOfBoundsException: Index: 7, Size: 0 at java.util.ArrayList.RangeCheck(ArrayList.java:486) at java.util.ArrayList.get(ArrayList.java:302) at test.IndexedForm.getParameter(IndexedForm.java:28) at java.lang.reflect.Method.invoke(Native Method) I post my testing code on message: http://www.mail-archive.com/struts-user@jakarta.apache.org/msg48968.html Please help, Thank you so much. Leo From: Christoph Kulla [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Example of indexed properties and DynaBean? Date: Sun, 17 Nov 2002 20:07:09 +0100 Hi, can anyone point me to a working example of indexed properties and struts 1.1 (b2 or nightly). All my tests failed so far with various exceptions in the BeanUtils. Thanks in advance Christoph -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Example of indexed properties and DynaBean?
Hi, I had a quick look at the beanutil code. I can't find any code wich instantiates an empty array of the required size (given by the form data in the request). I wonder whether that ever worked. IMHO you have to specify the array size with an inital value in the form config. But then you'll have a fixed size array :( My idea is to write a new kind of List implementation which extends itself in size when the set method is called. So the List will resize itself to the number of indexed form elements. Btw, does your exception gets thrown when you submit your form data or when you display the form the first time? Regards Christoph Leonardo Maciel schrieb: You are not alone :( I also have tried several combinations same BeanUtils exceptions. My environment is jakarta-struts-1.1-b2 on Apache Tomcat/4.1.12 JSDK=1.4.1_01-b01 I also tried with JSDK1.3.1-06 where I got the exception: java.lang.reflect.InvocationTargetException: java.lang.IndexOutOfBoundsException: Index: 7, Size: 0 at java.util.ArrayList.RangeCheck(ArrayList.java:486) at java.util.ArrayList.get(ArrayList.java:302) at test.IndexedForm.getParameter(IndexedForm.java:28) at java.lang.reflect.Method.invoke(Native Method) I post my testing code on message: http://www.mail-archive.com/struts-user@jakarta.apache.org/msg48968.html Please help, Thank you so much. Leo From: Christoph Kulla [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Example of indexed properties and DynaBean? Date: Sun, 17 Nov 2002 20:07:09 +0100 Hi, can anyone point me to a working example of indexed properties and struts 1.1 (b2 or nightly). All my tests failed so far with various exceptions in the BeanUtils. Thanks in advance Christoph -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: ActionServlet unable to proceed...pl help
-Original Message- From: Suman Das [mailto:[EMAIL PROTECTED]] Subject: ActionServlet unable to proceed...pl help While running the following code (more or less same as Javaranch's march article) in weblogic 7.0, the LoginView.jsp accepts UserID and Pwd but then the login.do returns a blank page...seems ActionServlet is unable to proceed. Not getting any exceptions to the log? Start with a System.out.println(made it...); in the start of the Action.execute(). If that comes out in the log okay, you are probably executing fine, look to make sure that your forward for invalid and valid (MainMenu.jsp and LoginView.jsp respectively) are in the root of the application WAR file or deployment directory. If they are, add a % System.out.println(...); % to both the JSPs, make sure they are getting called, I suspect that they aren't. You can keep going with the printlns for a while. Good luck! -b -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
SEGMENTATION VIOLATION..
Hi, I have an application that is running on OC4J. We are using struts to implement the application.. One of the module searches for the records fetches the result from database. SInce the Database hits need to be minimised we are fetching around 100 records at a time we are storing them in session object. The records are collection of HashMap which are stored in ArrayList..that is to tell that the result is an ArrayList of HashMap.. Now after some time when the program tries to access request.getSession(false) Oc4J is throwing the following stack trace the server crashes abruptly.. I have attached the stack trace for teh refernce below.. Has anyone come across this problem before? Is there any limit on the size of the data that will be placed in the session I did search the web but I havent been able to find the information of the limit Except that IBM site has an article for their application server where they manage this overflow of session.. Please do give me some inputs on this.. Thanks Regards, Divakar SIGSEGV 11 segmentation violation si_signo [11]: SEGV si_errno [0]: si_code [1]: SEGV_MAPERR [addr: 0xc261820] stackpointer=F216FF80 ApplicationServerThread (TID:0x14cfcc0, sys_thread_t:0x14cfbf8, state:R, thread_t: t@70, threadID:0xf2171d70, stack_bottom:0xf2171d70, stack_size:0x1fd70) prio=5 *current thread* [1] mascot.workqueue.action.WrkqSearchAction.perform(WrkqSearchAction.java:63) [2] org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja va:1786) [3] org.apache.struts.action.ActionServlet.process(ActionServlet.java:1515) [4] org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509) [5] javax.servlet.http.HttpServlet.service(HttpServlet.java:189) [6] javax.servlet.http.HttpServlet.service(HttpServlet.java:225) [7] javax.servlet.http.HttpServlet.service(HttpServlet.java:323) [8] com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispa tcher.java:199) [9] com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletReq uestDispatcher.java:155) [10] com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandle r.java:286) [11] com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:81) [12] com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:45) --- ApplicationServerThread (TID:0x188f9e8, sys_thread_t:0x188f920, state:R, thread_t: t@63, threadID:0xf2f71d70, stack_bottom:0xf2f71d70, stack_size:0x1fd70) prio=5 [1] oracle.jdbc.oci8.OCIDBAccess.do_fetch(Native Method) [2] oracle.jdbc.oci8.OCIDBAccess.fetch(OCIDBAccess.java:1358) [3] oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:1597) [4] oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java :1834) [5] oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:515) [6] com.evermind.sql.FilterStatement.executeQuery(FilterStatement.java:255) [7] mascot.common.DBConnectionWrapper.getLabelValueRows(DBConnectionWrapper.java :447) [8] mascot.workqueue.bean.WrkqProfileSetUpDBBean.getASMList(WrkqProfileSetUpDBBe an.java:189) [9] mascot.workqueue.bean.WrkqProfileSetUpBean.getASMLIST(WrkqProfileSetUpBean.j ava:196) [10] mascot.workqueue.action.WrkqProfileSetupAction.perform(WrkqProfileSetupActio n.java:61) [11] org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja va:1786) [12] org.apache.struts.action.ActionServlet.process(ActionServlet.java:1515) [13] org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509) [14] javax.servlet.http.HttpServlet.service(HttpServlet.java:189) [15] javax.servlet.http.HttpServlet.service(HttpServlet.java:225) [16] javax.servlet.http.HttpServlet.service(HttpServlet.java:323) [17] com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispa tcher.java:199) [18] com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletReq uestDispatcher.java:155) [19] com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandle r.java:286) [20] com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:81) [21] com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:45) --- SeedGenerator Thread (TID:0x1b91978, sys_thread_t:0x1b918b0, state:CW, thread_t: t@21, threadID:0xf20f1d70, stack_bottom:0xf20f1d70, stack_size:0x1fd70) prio=1 [1] java.lang.Object.wait(Object.java:424) [2] sun.security.provider.SeedGenerator.run(SeedGenerator.java:107) [3] java.lang.Thread.run(Thread.java:479) --- Thread-2 (TID:0x179660, sys_thread_t:0x179598, state:MW, thread_t: t@1, threadID:0x25228, stack_bottom:0xffbf, stack_size:0x80) prio=5 --- TaskManager (TID:0xa57678, sys_thread_t:0xa575b0, state:CW, thread_t: t@13, threadID:0xf2901d70, stack_bottom:0xf2901d70, stack_size:0x1fd70) prio=5 [1] java.lang.Thread.sleep(Native Method) [2] com.evermind.util.TaskManager.run(TaskManager.java:108) [3]
Re: The content of html:file tag
Dear, How can I set the initial value for html:file tag? Thanks, Huy --- Craig R. McClanahan [EMAIL PROTECTED] wrote: On Fri, 15 Nov 2002, Huynh Ngoc Huy wrote: Date: Fri, 15 Nov 2002 19:38:26 -0800 (PST) From: Huynh Ngoc Huy [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: The content of html:file tag Dear group, How can we get the content of the html:file struts tag ? Thanks, Huy You might want to look at the source code for the struts-upload.war example application to get a feel for the ways you can do this. Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: What can I do to display unicode-string in struts tag?
I didn't mean the unicode-string was a string that contains non-Latin characters. This is a unicode-string Đây là một dòng unicode. JSP could display this line correctly, but the html:textarea struts tag couldn't. Thanks, Huy --- Martin Cooper [EMAIL PROTECTED] wrote: On Thu, 14 Nov 2002, Huynh Ngoc Huy wrote: I'm using struts version 1.1b2. The followings are my snippet codes: * struts-config.xml * ... form-bean name=aForm type=org.apache.struts.action.DynaActionForm form-property name=msg type=java.lang.String/ ... action path=/aPath type=anAction name=aForm forward name=target path=/result.jsp/ /action ... * anAction.java * ... String s = a unicode-string from mysql database; PropertyUtils.setSimpleProperty(form, msg, s); ... return mapping.findForward(target); * index.jsp * %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % html:link page=/aPath.dogo/html:link * result.jsp * %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % html:form action=/aPath.do html:textarea property=msg cols=30 rows=5/ /html:form * In the result.jsp, the textarea cannot display the unicode-string correctly. What do you mean by unicode-string? Strings in Java are always Unicode. Perhaps you mean a string that contains non-Latin characters? If that's the case, you'll need to specify the encoding you want in the JSP page. The pages above do not specify an encoding, so they are defaulting to ISO-8859-1, which may not be what you want. Also, I've seen a couple of people mention problems related to storing non-Latin characters in a MySql database. I don't use MySql, so I can't help you with that, but you'll probably find more information in the mailing list archives. -- Martin Cooper Any help is appreciated ! Thanks in advance, Huy __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: SEGMENTATION VIOLATION..
I'd say you have a bad install of Java on your OS, not a Struts problem. You should never see the VM crash under any circumstances where the VM and the OS are installed correctly. What OS are you running on? Are you running the most current updates of everything, including the OS? What threads type and versions are you using? You probably have an incompatibility somewhere between those three. It's impossible to for a company to test on every version combination possible of OS, threads version, and Java VM version, so your best bet is to use a version combination that others are using, (but unfortunately, I can't help you on that one ;) HTH, good luck, -b -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: SEGMENTATION VIOLATION..
I've seen advice to limit the size of the session data but have never heard of there actually being a limit. The server might be serializing the data because it hasn't been used in a while and crashing when it tries to bring it back into memory. David From: Divakar Satyanarayan [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: SEGMENTATION VIOLATION.. Date: Mon, 18 Nov 2002 04:58:50 +0530 Hi, I have an application that is running on OC4J. We are using struts to implement the application.. One of the module searches for the records fetches the result from database. SInce the Database hits need to be minimised we are fetching around 100 records at a time we are storing them in session object. The records are collection of HashMap which are stored in ArrayList..that is to tell that the result is an ArrayList of HashMap.. Now after some time when the program tries to access request.getSession(false) Oc4J is throwing the following stack trace the server crashes abruptly.. I have attached the stack trace for teh refernce below.. Has anyone come across this problem before? Is there any limit on the size of the data that will be placed in the session I did search the web but I havent been able to find the information of the limit Except that IBM site has an article for their application server where they manage this overflow of session.. Please do give me some inputs on this.. Thanks Regards, Divakar SIGSEGV 11 segmentation violation si_signo [11]: SEGV si_errno [0]: si_code [1]: SEGV_MAPERR [addr: 0xc261820] stackpointer=F216FF80 ApplicationServerThread (TID:0x14cfcc0, sys_thread_t:0x14cfbf8, state:R, thread_t: t@70, threadID:0xf2171d70, stack_bottom:0xf2171d70, stack_size:0x1fd70) prio=5 *current thread* [1] mascot.workqueue.action.WrkqSearchAction.perform(WrkqSearchAction.java:63) [2] org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja va:1786) [3] org.apache.struts.action.ActionServlet.process(ActionServlet.java:1515) [4] org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509) [5] javax.servlet.http.HttpServlet.service(HttpServlet.java:189) [6] javax.servlet.http.HttpServlet.service(HttpServlet.java:225) [7] javax.servlet.http.HttpServlet.service(HttpServlet.java:323) [8] com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispa tcher.java:199) [9] com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletReq uestDispatcher.java:155) [10] com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandle r.java:286) [11] com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:81) [12] com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:45) --- ApplicationServerThread (TID:0x188f9e8, sys_thread_t:0x188f920, state:R, thread_t: t@63, threadID:0xf2f71d70, stack_bottom:0xf2f71d70, stack_size:0x1fd70) prio=5 [1] oracle.jdbc.oci8.OCIDBAccess.do_fetch(Native Method) [2] oracle.jdbc.oci8.OCIDBAccess.fetch(OCIDBAccess.java:1358) [3] oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:1597) [4] oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java :1834) [5] oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:515) [6] com.evermind.sql.FilterStatement.executeQuery(FilterStatement.java:255) [7] mascot.common.DBConnectionWrapper.getLabelValueRows(DBConnectionWrapper.java :447) [8] mascot.workqueue.bean.WrkqProfileSetUpDBBean.getASMList(WrkqProfileSetUpDBBe an.java:189) [9] mascot.workqueue.bean.WrkqProfileSetUpBean.getASMLIST(WrkqProfileSetUpBean.j ava:196) [10] mascot.workqueue.action.WrkqProfileSetupAction.perform(WrkqProfileSetupActio n.java:61) [11] org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.ja va:1786) [12] org.apache.struts.action.ActionServlet.process(ActionServlet.java:1515) [13] org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509) [14] javax.servlet.http.HttpServlet.service(HttpServlet.java:189) [15] javax.servlet.http.HttpServlet.service(HttpServlet.java:225) [16] javax.servlet.http.HttpServlet.service(HttpServlet.java:323) [17] com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispa tcher.java:199) [18] com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletReq uestDispatcher.java:155) [19] com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandle r.java:286) [20] com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:81) [21] com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:45) --- SeedGenerator Thread (TID:0x1b91978, sys_thread_t:0x1b918b0, state:CW, thread_t: t@21, threadID:0xf20f1d70, stack_bottom:0xf20f1d70, stack_size:0x1fd70) prio=1 [1] java.lang.Object.wait(Object.java:424) [2] sun.security.provider.SeedGenerator.run(SeedGenerator.java:107)
Re: The content of html:file tag
The user guide instructions are pretty clear: http://jakarta.apache.org/struts/userGuide/struts-html.html#file David From: Huynh Ngoc Huy [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: The content of html:file tag Date: Sun, 17 Nov 2002 16:31:55 -0800 (PST) Dear, How can I set the initial value for html:file tag? Thanks, Huy --- Craig R. McClanahan [EMAIL PROTECTED] wrote: On Fri, 15 Nov 2002, Huynh Ngoc Huy wrote: Date: Fri, 15 Nov 2002 19:38:26 -0800 (PST) From: Huynh Ngoc Huy [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: The content of html:file tag Dear group, How can we get the content of the html:file struts tag ? Thanks, Huy You might want to look at the source code for the struts-upload.war example application to get a feel for the ways you can do this. Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: What can I do to display unicode-string in struts tag?
Did you try coding a regular textarea tag without struts? Was it able to display the string? David From: Huynh Ngoc Huy [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: What can I do to display unicode-string in struts tag? Date: Sun, 17 Nov 2002 16:45:22 -0800 (PST) I didn't mean the unicode-string was a string that contains non-Latin characters. This is a unicode-string Ä?ây là má»t dòng unicode. JSP could display this line correctly, but the html:textarea struts tag couldn't. Thanks, Huy --- Martin Cooper [EMAIL PROTECTED] wrote: On Thu, 14 Nov 2002, Huynh Ngoc Huy wrote: I'm using struts version 1.1b2. The followings are my snippet codes: * struts-config.xml * ... form-bean name=aForm type=org.apache.struts.action.DynaActionForm form-property name=msg type=java.lang.String/ ... action path=/aPath type=anAction name=aForm forward name=target path=/result.jsp/ /action ... * anAction.java * ... String s = a unicode-string from mysql database; PropertyUtils.setSimpleProperty(form, msg, s); ... return mapping.findForward(target); * index.jsp * %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % html:link page=/aPath.dogo/html:link * result.jsp * %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % html:form action=/aPath.do html:textarea property=msg cols=30 rows=5/ /html:form * In the result.jsp, the textarea cannot display the unicode-string correctly. What do you mean by unicode-string? Strings in Java are always Unicode. Perhaps you mean a string that contains non-Latin characters? If that's the case, you'll need to specify the encoding you want in the JSP page. The pages above do not specify an encoding, so they are defaulting to ISO-8859-1, which may not be what you want. Also, I've seen a couple of people mention problems related to storing non-Latin characters in a MySql database. I don't use MySql, so I can't help you with that, but you'll probably find more information in the mailing list archives. -- Martin Cooper Any help is appreciated ! Thanks in advance, Huy __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Enabling Disabling
Hi , Again the problem here is we need to extract the Attribute and use the correct variable in JSP page. I am not sure is there any other option. What I would like to do is Suppose I have a text field NAME I will use a NAME_CTRL_FLG (Naming will be standardised) in my Bean. We have some complecated logic to decide whether this field should be enabled/disabled, and we will set the value of NAME_CTRL_FLG to true/false in action. So my requirement is just to reffer the Attribute name of the Bean in the Custom Tag and then enabling disabling should be handled by the Custom Tag. In this case binding is by naming standardization. Pls suggest if there is a better way /Is STRUTS doing something similar already? Thanks in Advance Savant -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, November 15, 2002 1:27 PM To: [EMAIL PROTECTED] Subject: Re: Enabling Disabling Chennamakal == Chennamakal Subramanian Savantraj Savantraj writes: Chennamakal Hi, Chennamakal Pls share with me if anybody implemented the following concept. Chennamakal1. Enable and Disable HTML controls based on some control flags on Chennamakal FormBean. Chennamakal2. Not by using disabled attribute in each custom tag. Chennamakal3. Idea is to prevent Decision making statements in JSP pages. Also Chennamakal want to handle some complex logics to decide enabling and disabling(For Chennamakal Example, using same form for Enquiry,Edit,Insert operations and make Chennamakal controls enabled or disabled based on the operation) Your disabled attribute in each tag can reference an array entry of an array of booleans, one for each operation type. These values will be set in your action, not in the jsp page. There is no decision making in the JSP page. Use Struts-EL to make the variable references cleaner. -- === David M. Karr ; Java/J2EE/XML/Unix/C++ [EMAIL PROTECTED] ; SCJP -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] --- This email is confidential and intended only for the use of the individual or entity named above and may contain information that is privileged. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this email is strictly prohibited. If you have received this email in error, please notify us immediately by return email or telephone and destroy the original message. Thank you. - This mail is sent via Sony Asia Pacific Mail Gateway. --- -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
In which cases should we use DiskFile?
Hi all, In which cases should we use DiskFile? Thanks, Huy __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: The content of html:file tag
Just curious, why do want to have a default value for html:file? Do you expect most likely that the user would enter same full path name of the client side file? -Dan - Original Message - From: Huynh Ngoc Huy [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, November 17, 2002 4:31 PM Subject: Re: The content of html:file tag Dear, How can I set the initial value for html:file tag? Thanks, Huy --- Craig R. McClanahan [EMAIL PROTECTED] wrote: On Fri, 15 Nov 2002, Huynh Ngoc Huy wrote: Date: Fri, 15 Nov 2002 19:38:26 -0800 (PST) From: Huynh Ngoc Huy [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: The content of html:file tag Dear group, How can we get the content of the html:file struts tag ? Thanks, Huy You might want to look at the source code for the struts-upload.war example application to get a feel for the ways you can do this. Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
[Struts Tip] #15 Use chained exceptions
Many Java mavens recommend that business objects throw their own exceptions. Internally, a component may catching a SQL or IO exception, but what we really need to tell the user is that a data access error occurred. Of course, at the same time, you do not want to sacrifice any detail from the original exception. Retaining detail from the exception can especially important in a layered, multi-tiered, or multi-platform application.. The business component may not have direct access to the log, and the exception is its only way of telling us what went wrong. [more ... http://husted.com/struts/tips/015.html] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: The content of html:file tag
Because I've thought that there's no way to do that. Is that right? Huy --- Dan Tran [EMAIL PROTECTED] wrote: Just curious, why do want to have a default value for html:file? Do you expect most likely that the user would enter same full path name of the client side file? -Dan - Original Message - From: Huynh Ngoc Huy [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, November 17, 2002 4:31 PM Subject: Re: The content of html:file tag Dear, How can I set the initial value for html:file tag? Thanks, Huy --- Craig R. McClanahan [EMAIL PROTECTED] wrote: On Fri, 15 Nov 2002, Huynh Ngoc Huy wrote: Date: Fri, 15 Nov 2002 19:38:26 -0800 (PST) From: Huynh Ngoc Huy [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: The content of html:file tag Dear group, How can we get the content of the html:file struts tag ? Thanks, Huy You might want to look at the source code for the struts-upload.war example application to get a feel for the ways you can do this. Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: What can I do to display unicode-string in struts tag?
I meant that unicode-string was got from database. Thanks, Huy --- David Graham [EMAIL PROTECTED] wrote: Did you try coding a regular textarea tag without struts? Was it able to display the string? David From: Huynh Ngoc Huy [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: What can I do to display unicode-string in struts tag? Date: Sun, 17 Nov 2002 16:45:22 -0800 (PST) I didn't mean the unicode-string was a string that contains non-Latin characters. This is a unicode-string Ŀây là một dòng unicode. JSP could display this line correctly, but the html:textarea struts tag couldn't. Thanks, Huy --- Martin Cooper [EMAIL PROTECTED] wrote: On Thu, 14 Nov 2002, Huynh Ngoc Huy wrote: I'm using struts version 1.1b2. The followings are my snippet codes: * struts-config.xml * ... form-bean name=aForm type=org.apache.struts.action.DynaActionForm form-property name=msg type=java.lang.String/ ... action path=/aPath type=anAction name=aForm forward name=target path=/result.jsp/ /action ... * anAction.java * ... String s = a unicode-string from mysql database; PropertyUtils.setSimpleProperty(form, msg, s); ... return mapping.findForward(target); * index.jsp * %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % html:link page=/aPath.dogo/html:link * result.jsp * %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % html:form action=/aPath.do html:textarea property=msg cols=30 rows=5/ /html:form * In the result.jsp, the textarea cannot display the unicode-string correctly. What do you mean by unicode-string? Strings in Java are always Unicode. Perhaps you mean a string that contains non-Latin characters? If that's the case, you'll need to specify the encoding you want in the JSP page. The pages above do not specify an encoding, so they are defaulting to ISO-8859-1, which may not be what you want. Also, I've seen a couple of people mention problems related to storing non-Latin characters in a MySql database. I don't use MySql, so I can't help you with that, but you'll probably find more information in the mailing list archives. -- Martin Cooper Any help is appreciated ! Thanks in advance, Huy __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: What can I do to display unicode-string in struts tag?
Yes, but you say that the struts textarea tag can't display this string. Can a regular, manually coded, textarea tag display it properly? David From: Huynh Ngoc Huy [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: What can I do to display unicode-string in struts tag? Date: Sun, 17 Nov 2002 19:09:11 -0800 (PST) I meant that unicode-string was got from database. Thanks, Huy --- David Graham [EMAIL PROTECTED] wrote: Did you try coding a regular textarea tag without struts? Was it able to display the string? David From: Huynh Ngoc Huy [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: What can I do to display unicode-string in struts tag? Date: Sun, 17 Nov 2002 16:45:22 -0800 (PST) I didn't mean the unicode-string was a string that contains non-Latin characters. This is a unicode-string Ŀây là một dòng unicode. JSP could display this line correctly, but the html:textarea struts tag couldn't. Thanks, Huy --- Martin Cooper [EMAIL PROTECTED] wrote: On Thu, 14 Nov 2002, Huynh Ngoc Huy wrote: I'm using struts version 1.1b2. The followings are my snippet codes: * struts-config.xml * ... form-bean name=aForm type=org.apache.struts.action.DynaActionForm form-property name=msg type=java.lang.String/ ... action path=/aPath type=anAction name=aForm forward name=target path=/result.jsp/ /action ... * anAction.java * ... String s = a unicode-string from mysql database; PropertyUtils.setSimpleProperty(form, msg, s); ... return mapping.findForward(target); * index.jsp * %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % html:link page=/aPath.dogo/html:link * result.jsp * %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % html:form action=/aPath.do html:textarea property=msg cols=30 rows=5/ /html:form * In the result.jsp, the textarea cannot display the unicode-string correctly. What do you mean by unicode-string? Strings in Java are always Unicode. Perhaps you mean a string that contains non-Latin characters? If that's the case, you'll need to specify the encoding you want in the JSP page. The pages above do not specify an encoding, so they are defaulting to ISO-8859-1, which may not be what you want. Also, I've seen a couple of people mention problems related to storing non-Latin characters in a MySql database. I don't use MySql, so I can't help you with that, but you'll probably find more information in the mailing list archives. -- Martin Cooper Any help is appreciated ! Thanks in advance, Huy __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Enabling Disabling
Chennamakal == Chennamakal Subramanian Savantraj Savantraj writes: Chennamakal Hi , Chennamakal Again the problem here is we need to extract the Attribute and use the Chennamakal correct variable in JSP page. Chennamakal I am not sure is there any other option. Chennamakal What I would like to do is Chennamakal Suppose I have a text field NAME Chennamakal I will use a NAME_CTRL_FLG (Naming will be standardised) in my Bean. Chennamakal We have some complecated logic to decide whether this field should be Chennamakal enabled/disabled, and we will set the value Chennamakal of NAME_CTRL_FLG to true/false in action. Chennamakal So my requirement is just to reffer the Attribute name of the Bean in the Chennamakal Custom Tag and then enabling disabling should be handled by the Custom Tag. Chennamakal In this case binding is by naming standardization. Chennamakal Pls suggest if there is a better way /Is STRUTS doing something similar Chennamakal already? This (untested) is how you you specify that a text field is disabled or not: html:text name=formname property=textProperty disabled=%= formname.getNameCtrlFlag() %/ Using Struts-EL, it would look like this: html-el:text name=formname property=textProperty disabled=${formname.nameCtrlFlag}/ -- === David M. Karr ; Java/J2EE/XML/Unix/C++ [EMAIL PROTECTED] ; SCJP -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: The content of html:file tag
You cannot set a default value for a file input. This is for security reasons. Think about it. The web just wouldn't be same if: input type=file name=whatever value=C:\winnt\something\really\important.dat style=display:none James Mitchell Software Engineer/Struts Evangelist http://www.open-tools.org If you were plowing a field, which would you rather use? Two strong oxen or 1024 chickens? - Seymour Cray (1925-1996), father of supercomputing -Original Message- From: Huynh Ngoc Huy [mailto:[EMAIL PROTECTED]] Sent: Sunday, November 17, 2002 9:56 PM To: Struts Users Mailing List Subject: Re: The content of html:file tag Because I've thought that there's no way to do that. Is that right? Huy --- Dan Tran [EMAIL PROTECTED] wrote: Just curious, why do want to have a default value for html:file? Do you expect most likely that the user would enter same full path name of the client side file? -Dan - Original Message - From: Huynh Ngoc Huy [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, November 17, 2002 4:31 PM Subject: Re: The content of html:file tag Dear, How can I set the initial value for html:file tag? Thanks, Huy --- Craig R. McClanahan [EMAIL PROTECTED] wrote: On Fri, 15 Nov 2002, Huynh Ngoc Huy wrote: Date: Fri, 15 Nov 2002 19:38:26 -0800 (PST) From: Huynh Ngoc Huy [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: The content of html:file tag Dear group, How can we get the content of the html:file struts tag ? Thanks, Huy You might want to look at the source code for the struts-upload.war example application to get a feel for the ways you can do this. Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: The content of html:file tag
I reckon you should be allowed to specify a file, but of course the browser should prompt the user for permission first. Alas the PTB see things differently... Of course Ive yet to meet a user who actually reads a dialog box before hitting ok, but the onus of responsibility would have been shifted to their head so its their problem if something bad happens ;-) btw Id take the oxen. I'd have enough trouble keeping one chook in line never mind 1024... /btw -Original Message- From: James Mitchell [mailto:[EMAIL PROTECTED]] Sent: Monday, November 18, 2002 12:14 To: Struts Users Mailing List Subject: RE: The content of html:file tag You cannot set a default value for a file input. This is for security reasons. Think about it. The web just wouldn't be same if: input type=file name=whatever value=C:\winnt\something\really\important.dat style=display:none James Mitchell Software Engineer/Struts Evangelist http://www.open-tools.org If you were plowing a field, which would you rather use? Two strong oxen or 1024 chickens? - Seymour Cray (1925-1996), father of supercomputing -Original Message- From: Huynh Ngoc Huy [mailto:[EMAIL PROTECTED]] Sent: Sunday, November 17, 2002 9:56 PM To: Struts Users Mailing List Subject: Re: The content of html:file tag Because I've thought that there's no way to do that. Is that right? Huy --- Dan Tran [EMAIL PROTECTED] wrote: Just curious, why do want to have a default value for html:file? Do you expect most likely that the user would enter same full path name of the client side file? -Dan - Original Message - From: Huynh Ngoc Huy [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Sunday, November 17, 2002 4:31 PM Subject: Re: The content of html:file tag Dear, How can I set the initial value for html:file tag? Thanks, Huy --- Craig R. McClanahan [EMAIL PROTECTED] wrote: On Fri, 15 Nov 2002, Huynh Ngoc Huy wrote: Date: Fri, 15 Nov 2002 19:38:26 -0800 (PST) From: Huynh Ngoc Huy [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: The content of html:file tag Dear group, How can we get the content of the html:file struts tag ? Thanks, Huy You might want to look at the source code for the struts-upload.war example application to get a feel for the ways you can do this. Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Struts At ApacheCon 2002
If you're coming to Las Vegas this week for ApacheCon, there will be two sessions and a BOF specifically focused on Struts: * Session TU07 (Tuesday, 1:30-2:30) - What's New In Struts 1.1 * Session WE06 (Wednesday, 10:00-11:00) - Building Web Applications With Struts * BOF BOF03 (Tuesday, 8:00p-9:00p) - Struts After 1.1 -- Where Do We Go From Here? The BOF is primarily an opportunity to gather input from folks on our initial thinking about the 1.2 and 2.0 roadmaps, and to answer any general questions that people have. I look forward to meeting any Struts users (and developers) attending the conference. You can find me at one of these sessions, or hanging around the Sun booths in the Exhibit Hall. Craig McClanahan -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
dynamic img with EL
Hi, We are using EL(JSTL) to display dynamic img tags. html:img src=${image.name} width=730 height=350 border=0 usemap=#Map/ Is this valid ? It doesn't really pick up the value of the 'src' tag. Having read the archives I've decided that there is no other way. We need URL rewriting. Thanks, Mohan -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Question about object in struts form
Hello, I'm new to struts and have tried looking through the archives here as well as around the web and am unable to find the answer to my question. I'm guessing that it's not possible to do what I want, but figured I'd ask before giving up... So, I have a class User that contains a String for the name, and an Address object for the address (the Address object contains more Strings, etc for city, state, zip, address1, etc). I have defined all the get/set functions. I have a form that I want to use to edit the user info. No problem to edit the name. Problem is that I also want to edit the address fields. So, what I was hoping to be able to do was declare my dyna-form in struts-config to have a form-property with name=user and type=org.blah.blah.dao.User. Then in the jsp code I would refer to user.name, user.address.city, etc. I got this to work fine for creating and populating the edit page. The problem comes about when I try to save the changes. No matter what I try I get all kinds of errors in the BeanUtils populate. One that I can't seem to get around is that it seems to want me to have a hidden type for my user object, and when I do that it complains that it can't conver from type String to type User. The other weird thing is that in the logs it gives me the following: [Thread-4] DEBUG org.apache.struts.util.RequestUtils - -- DynaActionForm[dynaClass=userForm,user=org.taprootfoundation.trweb.dao.User@181497d] [Thread-4] DEBUG org.apache.struts.action.RequestProcessor - Storing ActionForm bean instance in scope 'session' under attribute key 'userForm' [Thread-4] DEBUG org.apache.struts.action.RequestProcessor - Populating bean properties from this request [Thread-4] DEBUG org.apache.commons.beanutils.BeanUtils - BeanUtils.populate(DynaActionForm[dynaClass=userForm,user=NULL] I don't understand why it has a value for user within the userForm, and then seems to lose it. Before I made my scope session (was request before), it had NULL throughout the logs. Any suggestions, or examples, or statements that you can't do what I'm trying to do are appreciated. Thanks, Wendy [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Question about object in struts form
You input field will be something like html:text name=myForm property=address.line1/ Or if you only want to display bean:write name=myForm property=address.line1/ This assumes you have a form called myForm with your address object called getAddress() and your address object has getLine1(). -Original Message- From: Wendy Krehbiel [mailto:[EMAIL PROTECTED]] Sent: 18 November, 2002 08:27 To: [EMAIL PROTECTED] Subject: Question about object in struts form Hello, I'm new to struts and have tried looking through the archives here as well as around the web and am unable to find the answer to my question. I'm guessing that it's not possible to do what I want, but figured I'd ask before giving up... So, I have a class User that contains a String for the name, and an Address object for the address (the Address object contains more Strings, etc for city, state, zip, address1, etc). I have defined all the get/set functions. I have a form that I want to use to edit the user info. No problem to edit the name. Problem is that I also want to edit the address fields. So, what I was hoping to be able to do was declare my dyna-form in struts-config to have a form-property with name=user and type=org.blah.blah.dao.User. Then in the jsp code I would refer to user.name, user.address.city, etc. I got this to work fine for creating and populating the edit page. The problem comes about when I try to save the changes. No matter what I try I get all kinds of errors in the BeanUtils populate. One that I can't seem to get around is that it seems to want me to have a hidden type for my user object, and when I do that it complains that it can't conver from type String to type User. The other weird thing is that in the logs it gives me the following: [Thread-4] DEBUG org.apache.struts.util.RequestUtils - -- DynaActionForm[dynaClass=userForm,user=org.taprootfoundation.trweb.dao.User@ 181497d] [Thread-4] DEBUG org.apache.struts.action.RequestProcessor - Storing ActionForm bean instance in scope 'session' under attribute key 'userForm' [Thread-4] DEBUG org.apache.struts.action.RequestProcessor - Populating bean properties from this request [Thread-4] DEBUG org.apache.commons.beanutils.BeanUtils - BeanUtils.populate(DynaActionForm[dynaClass=userForm,user=NULL] I don't understand why it has a value for user within the userForm, and then seems to lose it. Before I made my scope session (was request before), it had NULL throughout the logs. Any suggestions, or examples, or statements that you can't do what I'm trying to do are appreciated. Thanks, Wendy [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Web Hosting - Let the expert host your site http://webhosting.yahoo.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] __ Disclaimer and confidentiality note Everything in this e-mail and any attachments relating to the official business of Standard Bank Group Limited is proprietary to the company. It is confidential, legally privileged and protected by law. Standard Bank does not own and endorse any other content. Views and opinions are those of the sender unless clearly stated as being that of Standard Bank. The person addressed in the e-mail is the sole authorised recipient. Please notify the sender immediately if it has unintentionally reached you and do not read, disclose or use the content in any way. Standard Bank can not assure that the integrity of this communication has been maintained nor that it is free of errors, virus, interception or interference. __ -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: anyone had the chance to evaluate any Struts books?
Why don't u have a look at the Chuck Cavaness book(all chapters for review purpose) hosted attheserverside.com Link is: http://www2.theserverside.com/resources/strutsreview.jsp Happy Reading and exploring... Shalu -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: ArrayList disappeared in ActionForm
Hi all! Thanks to both for your reply. Sorry for my late reply (and my poor english) but in the weekend I cant write to the group. Here some code of my classes (comments are in spanish, sorry): My ActionForm has: public class FichaUsuarioActionForm extends ActionForm { /** Datos del usuario */ private FichaUsuarioDataBean ficha; /** Roles posibles para situar en el formulario */ private ArrayList rolesPosibles; public FichaUsuarioActionForm() { log.debug(Constructor iniciado); ficha = new FichaUsuarioDataBean(); log.debug(Constructor finalizado); } public FichaUsuarioDataBean getUserDataBean() { log.debug(getUserDataBean ejecutado); return ficha; } public void setUserDataBean(FichaUsuarioDataBean user) { log.debug(setLoginDataBean ejecutado); ficha = user; } public ArrayList getRolesPosibles() { log.debug(getRolesPosibles ejecutado); return rolesPosibles; } public void setRolesPosibles(ArrayList _roles) { log.debug(setRolesPosibles ejecutado); rolesPosibles = _roles; } . } --- ficha is used to retrieve the values of a HTML form. rolesPosibles is an ArrayList that I must use in the same HTML form (in a multicheck tag). They are private, so I must set its values using the set function, and this function writes to the log a message. The constructor writes to the log too. In the Action before the HTML form, I use the setRolesPosibles() to put an inicial ArrayList. My HTML form is in the way (login/editarUsuario.jsp): -- html:form action=/modificaUsuarioAction.do focus=userDataBean.user enctype=multipart/form-data html:text name=fichaUsuario property=userDataBean.user size=60 / .. logic:iterate name=fichaUsuario property=rolesPosibles id=elementoListadoRoles html:multibox name=fichaUsuario property=userDataBean.rol bean:write name=elementoListadoRoles property=string1/ /html:multibox bean:write name=elementoListadoRoles property=string2 /br /logic:iterate So I use the rolesPosibles to put a list of checkbox in my HTML form. The struts-config.xml is like: --- form-bean name=fichaUsuario type=es.mulria.bonsai.login.actionform.FichaUsuarioActionForm/ actionpath=/modificaUsuarioAction type=es.mulria.bonsai.login.action.ModificarUsuariosAction name=fichaUsuario input=/login/editarUsuario.jsp validate=true /action ... --- My problem is that if the validate() of the ActionForm has errors, and returns to the HTML form, the ArrayList rolesPosibles has disappear (null), but the ficha not, and has all the values the user puts in the HTML form. The log is like (I only put the ActionForm log): -- # The Action before the JSP creates the ActionForm with the ArrayList, and puts it in the request 15 nov 2002 19:25:54,280 [Thread-7] DEBUG es.mulria.bonsai.login.actionform.FichaUsuarioActionForm - Constructor iniciado 15 nov 2002 19:25:54,280 [Thread-7] DEBUG es.mulria.bonsai.login.actionform.FichaUsuarioActionForm - Constructor finalizado 15 nov 2002 19:25:54,340 [Thread-7] DEBUG es.mulria.bonsai.login.actionform.FichaUsuarioActionForm - setRolesPosibles ejecutado # Here rolesPosibles has an ArrayList. I can see it if I print it in the log. # Now, the JSP prints all the values in the HTML form (they are in the UserDataBean 15 nov 2002 19:25:54,431 [Thread-7] DEBUG es.mulria.bonsai.login.actionform.FichaUsuarioActionForm - getUserDataBean ejecutado 15 nov 2002 19:25:54,511 [Thread-7] DEBUG es.mulria.bonsai.login.actionform.FichaUsuarioActionForm - getUserDataBean ejecutado # To put the list of checkbox in the page, it calls the ArrayList 15 nov 2002 19:25:54,561 [Thread-7] DEBUG es.mulria.bonsai.login.actionform.FichaUsuarioActionForm - getRolesPosibles ejecutado # All OK, the ArrayList continues in the ActionForm, and the JSP is displayed. # Now, I submit it. Struts takes the UserDataBean to put the values, the problem is that now, the ArrayList doesnt exist (is null), Without calling the constructor and without calling the setX (the log dont appear). How can Struts change the ArrayList without calling any of that? Of course, the others functions in the class dont use the ArrayList for nothing. 15 nov 2002 19:26:50,301 [Thread-7] DEBUG es.mulria.bonsai.login.actionform.FichaUsuarioActionForm - getUserDataBean ejecutado --- So, if the validate has some error and returns to the JSP, it has an error when tries to retrieve the ArrayList of checkbox (null). Some idea? Thanks for read all this (and sorry for my english) Miguel -Mensaje original- De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Enviado el: viernes, 15 de noviembre de
Struts-el/JSTL/dynamic img
Hi, I didn't make it clear. We are actually mixing JSTL and struts. Is that disaster ? Our tag html:img src=${image.name} width=730 height=350 border=0 usemap=#Map/ generates img src=${image.name} height=350 width=730 border=0 usemap=#Map The html:img is inside a JSTL loop.We are not using struts-el. Thanks, Mohan Did you load tld file correctly in web.xml and declare struts-el in your jsp file? -Dan - Original Message - From: Mohan Radhakrishnan [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, November 17, 2002 5:27 AM Subject: Struts-el/JSTL/dynamic img Hi, Eddie bush wrote. From the archives --- ... and if you happen to be able to use the JSTL ... David Karr wrote a taglib for struts which should soon be in the contrib directory. It's called Struts-EL, and it incorporates the JSTL's EL engine into the standard Struts tags we all know and love. Using his taglib, you could do the following: html:img src=${BEAN.property}/ Nice, eh? Search the archive for struts-el, and you're bound to happen across how you can get the taglib. If you're stuck using the HTML img src=... go with Martin's suggestion. My question is. Is this valid ? html:img src=${BEAN.property}/ Though we are using JSTL, we are assuming it is the same as the Struts-el. Same engine ? Our tag html:img src=${image.name} width=730 height=350 border=0 usemap=#Map/ generates img src=${image.name} height=350 width=730 border=0 usemap=#Map Do you see something wrong here ? Thanks, Mohan -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]