Re: About Message Icons
On Mon, Mar 24, 2008 at 10:58 PM, Chen Chunwei [EMAIL PROTECTED] wrote: Maybe some pre-defined style of message display or something else. I know I can do these all myself. But if there's already something can do this, why not just use it? There are the s:actionerror, s:actionmessage, and s:fielderror tags, but I don't believe they use any standard images. You might look into the theme support built into Struts2, you may be able to define your own theme that includes the proper images in the above tags. (*Chris*) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: About Message Icons
Thanks Chris - Original Message - From: Chris Pratt [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Tuesday, March 25, 2008 2:01 PM Subject: Re: About Message Icons On Mon, Mar 24, 2008 at 10:58 PM, Chen Chunwei [EMAIL PROTECTED] wrote: Maybe some pre-defined style of message display or something else. I know I can do these all myself. But if there's already something can do this, why not just use it? There are the s:actionerror, s:actionmessage, and s:fielderror tags, but I don't believe they use any standard images. You might look into the theme support built into Struts2, you may be able to define your own theme that includes the proper images in the above tags. (*Chris*) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to eliminate an entry from an array with s2 tags
Hi, in my jsp, i have an array of ids and i will like to remove one of that ids using s2 tags: I have tried the following, but it doesn't work :( s:set name=allIDs value=#parameters.productCode/ s:set name=newID value=/ s:iterator value=#allIDs status=stat s:set name=myID value=top/ s:if test='%{ idToRemove != #myID }' s:set name=newID[#stat] value=#myID/ /s:if /s:iterator Does anyone know how to do it ? thanks. Ezequiel.
Re: How to eliminate an entry from an array with s2 tags
--- Ezequiel Puig [EMAIL PROTECTED] wrote: in my jsp, i have an array of ids and i will like to remove one of that ids using s2 tags: I have tried the following, but it doesn't work :( s:set name=allIDs value=#parameters.productCode/ s:set name=newID value=/ s:iterator value=#allIDs status=stat s:set name=myID value=top/ s:if test='%{ idToRemove != #myID }' s:set name=newID[#stat] value=#myID/ /s:if /s:iterator Does anyone know how to do it ? Depending on the underlying collection type you might get an exception. You're not removing anything in the above code anyway, you're replacing a value. You're also using the status value like it's an index, but it's not [1]. But why? You'd have to work hard to convince me that the JSP is the place to do something like that. Dave [1] http://struts.apache.org/2.0.11.1/struts2-core/apidocs/org/apache/struts2/views/jsp/IteratorStatus.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Multiple Select
2008/3/22, Thangalin [EMAIL PROTECTED]: html:select property=%= select_name % multiple=true size=5 styleClass=filter Does select_name have the value fiscal_year? Antonio
Re: Multiple Selects and optionsCollection
2008/3/24, Tom Holmes Jr. [EMAIL PROTECTED]: The number of combo-boxes will change dynamically ... based on previous information. I think that, in your case, you need to manage HttpServletRequest parameters directly. There's nothing wrong with it :-) Antonio
HashMap and updates
Hi, I am having a problem in updates. I have a base class Employee.java. I have subclasses HourlyEmployee.java, ContractEmployee.java, FullTimeEmployee.java. I display these three types of employees under 3 tabs on my JSP. I create 3 lists for each type of employees and put these lists in a HashMap with different keys. Map employeeMap = new HashMap(); employeeMap.put (HE, hourlyEmployeeList); employeeMap.put (CE, contractEmployeeList); employeeMap.put (FE, fullTimeEmployeeList); I am able to display the list of employees properly. But when I change the values and submit the form, the new values dont show up in the action. Can anyone help please. Thanks. - Never miss a thing. Make Yahoo your homepage.
Re: Running a prepare method before the assigned action method
Still no solution to this problem. How come parameters in actions with wildcards (for example myapp/modelObject/*) aren't parsed in the prepare method? They work fine when I parse them in my assigned action method :( meeboo wrote: Hey again I'm posting via nabble, and it seems to strip out my wildcards, basically my action looks like this now action name=update/modelObject/* class=net.schemer.web.ObjectModelActions interceptor-ref name=paramsPrepareParamsStack/ param name= id { 1 } result/models/objectModel/update.jsp/result /action Hopefully this is viewable. newton.dave wrote: --- meeboo [EMAIL PROTECTED] wrote: won't work with a wildcard parameter mapping Dave action name=update/modelObject/* class=net.myapp.web.ModelObjectActions method=update Your first post didn't have a wildcard mapping. The parameter simply isn't parsed in the prepare method unless it's in the form of update/modelObject.action?id=22 Do you mean parsed by the parameter interceptor? this is what I'm currently doing update/modelObject/22.action The parameter is parsed in the update method, but not in the prepare method Are you using the standard action mapper? Any plugins? The mapping you posted in your follow-up message did not come through properly; please make sure you're sending plain-text messages. This is what I saw: action name=update/user/* class=net.myapp.web.UserActions interceptor-ref name=paramsPrepareParamsStack/ {1} result/models/user/update.jsp/result /action I don't really know what you're trying to do or how you're going about trying to do it. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Running-a-prepare-method-before-the-assigned-action-method-tp16219260p16274676.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
S2: Actions/DAO interaction getting messy...
I'm starting to get some rather stinky code in one of my projects and wanted to ask for some advice. ( Its a Struts2/Spring2/JPA(Hibernate) based project. I'm using a slightly modified version of the Generic DAO pattern shown in the Java persistence with Hibernate book and/or the IBM ThoughtWorks very similar example. (Modified to allow Spring Based Injection of the JPA EntityManger, while falling back to a native Hibernate session inside the DAOs to allow a few more optimizations). So its basically Business Objects (POJOs) ---1:1--- DAOs which is a relatively normal pattern I beleive. Now I'm working on an Action that creates an object that contains lots of references to other objects. A bug tracker would be a reasonable facsimile of my domain object -- when creating a bug, you select a severity, a project, a module, a found in version, possibly you're assigning it to someone, etc. Most of these options come from a drop-down on the view page, however they are all backed by their own domain object -- ie its not just id/string display name lookup-table backing the drop down. So the form submits a whole suite of IDs or String natural keys and I need to build an Defect/Bug and then persist it. In building the Defect I need to convert all the keys to domain objects. This is where things begin to fall apart. To covert the keys to domain object seems to require injecting all the subordinate object DAOs into the Action, its not a big deal but its starting to feel like the subordinate DAOs are taking over the action. Furthermore, its slightly annoying from a performance stand-point that I need to retrieve all the objects from the DB, just to set a foreign key -- I will never be updating the details on the subordinate object from the master only changing which one I'm linked to. [As a side issue: this is a place where the Get (returning a proxy/lazy load thunk with only the ID set without hitting the DB) versus Load could be useful, but I've never seen any of the generic DAO approaches expose that level of control in their API -- does anyone know why?] Here's an example (not from live code, please ignore any minor typos) representing the current state of application and test code. Afterwards I'll list a few of the approaches I've considered for cleaning it up: AddBug.java code: public class AddBug extends ActionSupport { private BugDAO bugService; private UserDAO userService; private ProjectDAO projectService; private ModuleDAO moduleService; private VersionDAO versionService; private String submitterUsername; private String assigneeUsername; private Long projectID; private Long moduleID; private ListLong affectedVersionIDs; public String execute() { Bug bug = new Bug(); // The following lines are what feel unclean to me bug.setSubmitter(userService.findByUsername(getSubmitterUsername())); bug.setAssignee(userService.findByUsername(getAssigneeUsername())); bug.setProject(projectService.find(getProjectID())); bug.setModule(moduleService.find(getModuleID())); for( Long versionID : getAffectedVersionIDs()) { bug.addAffectedVersion(versionService.find(versionID)); } bugDAO.persist(bug); return SUCCESS; } // This block of setters also seems to be wrong... Only the first one // should really be required by this action I think public void setBugService(final BugDAO bs) {bugService=bs;} public void setUserService(final UserDAO us) {userService=us;} public void setProjectService(final ProjectDAO ps) {projectService=ps;} public void setModuleService(final ModuleDAO ms) {moduleService=ms;} public void setVersionService(final VersionDAO vs) {versionService=vs;} public void setSubmitterUsername(final String username) {submitterUsername=username;} public void setAssigneeUsername(final String username) {assigneeUsername=username;} public void setProjectID(final Long id) {projectID=id;} public void setModuleID(final Long id) {moduleID=id;} public void setAffectedVersionIDs(final ListLong ids) {affectedVersionIDs=ids;} public String getSubmitterUsername() {return submitterUsername;} public String getAssigneeUsername() {return assigneeUsername;} public Long getProjectID() {return projectID;} public Long getModuleID() {return moduleID;} public ListLong getAffectedVersionIDs() {return affectedVersionIDs;} } TestAddBug.java (Sorry this is purely from memory so I know I'm missing some of my infrastructure) code: public void testAddBug() { String submitterUsername=TestUser; String assigneeUsername=TestVictim; User submitter=new User(submitterUsername); User assignee=new User(assigneeUsername); UserDAO userService = createMock(UserDAO.class);
Javascript error using struts select tag
I am trying to use the html:select tag in my jsp page but am getting the following javascript error, Microsoft JScript runtime error: Object expected. In my jsp page I have: table align=left class=tableGold tr th align=left bgcolor=#EEE8AAfont size=-1 color=#ff*/fontbean:message key=table.head.category//th /tr tr td align=center valign=middle div div style={float: left;} html:select styleId=category property=devicecategoryid onchange=selectDevOrStent() html:option value=bean:message key=select.list.device.category//html:option html:options collection=DeviceCategory property=id labelProperty=description/ /html:select /div div id=otherdev style={float: left; display: none; font-family: Arial, Helvetica, sans-serif; font-size: xx-small; vertical-align: middle; padding-left: 50px; line-height: 1.2em} html:text property=other size=35 maxlength=60 onfocus=clearOther() value = Enter Device Description / /div /div /td /tr /table Here is the javascript funtion that is called when a onchange event is detected: function selectDevOrStent(){ alert(In SelectDevOrStent); var category = id(category).options[id(category).selectedIndex].value; var categoryText = id(category).options[id(category).selectedIndex].text; //alert(categoryText = + categoryText); if(categoryText == 'Stents'){ //alert(Stent selected); id(stent).style.display = block; id(dev).style.display = none; id(otherdev).style.display = none; getSelectList(category, StentManufacturerSelect.do, stentmanufcallback); }else if(categoryText == 'Joint Replacement'){ //alert(Joint Replacement selected); document.DeviceInputForm.devicetypeid.disabled='true'; document.DeviceInputForm.manufacturer.disabled='true'; document.DeviceInputForm.modelnumber.disabled='true'; getSelectList(category, DeviceLocationSelect.do?devicecategoryid= + escape(id(category).value), locationcallback); id(dev).style.display = block; id(stent).style.display = none; id(otherdev).style.display = none; }else if(categoryText == 'Other'){ //alert(Other selected); id(otherdev).style.display = block; id(stent).style.display = none; id(dev).style.display = none; }else{ //alert(Stent not selected); id(stent).style.display = none; id(dev).style.display = block; id(otherdev).style.display = none; getSelectList(category, DeviceTypeSelect.do?devicecategoryid= + escape(id(category).value), devicecallback); } } Everything is fine, I can see the select box and all the options are there but when I trigger a onchange event I get the error. Can anyone see what I am doing wrong? Thanks.
Re: struts 2 jsf plugin problem
I have done that. Every time i get this error. I have no idea why this is thrown, and i don't know what he wants. Is there no librabry loaded for parsing the jsf page? I have no idea. On Mon, Mar 24, 2008 at 4:03 PM, Randy Burgess [EMAIL PROTECTED] wrote: I would take everything out of your JSF page and then start adding things in one by one until you find what is causing the missing the property editor error. Regards, Randy Burgess Sr. Web Applications Developer Nuvox Communications From: Daniel [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org Date: Sat, 22 Mar 2008 22:53:09 +0200 To: Struts Users Mailing List user@struts.apache.org Subject: Re: struts 2 jsf plugin problem At first i have tried to make the portlet only with JSF. Unfortunately Weblogic has some problems , many problems, it's the first time when i use weblogic and it's not worthing it's money. After i failed making the portlet with pure JSF i said to make a try with struts 2 and jsf plugin. Using this method i have reached far than using pure JSF. I will try more to see if there is any hope with this solution. On Fri, Mar 21, 2008 at 5:55 PM, Nils-Helge Garli Hegvik [EMAIL PROTECTED] wrote: Sorry, no clue. As I said, I have no idea if this combination will work at all. Maybe someone with JSF experience can point out what's wrong. At least it looks like the portlet dispatcher has been able to execute the action, but it's failing with the JSF result. You might want to consider creating your portlet with either JSF or Struts 2 instead of combining them both. Nils-H On Fri, Mar 21, 2008 at 1:55 PM, Daniel [EMAIL PROTECTED] wrote: I've done what you have said, unfortunately without results. I still receive index.jsp:16:26: No property editor found for the bean javax.el.ValueExpression. Any other ideas? On Thu, Mar 20, 2008 at 12:43 PM, Nils-Helge Garli Hegvik [EMAIL PROTECTED] wrote: First of all, I'm not even sure if it's possible to use the portlet and the jsf plugin at the same time. I have not tried, but there might be issues with it if they try to do conflicting things in the interceptors and the results. struts.xml package name=default extends=portlet-jsf-default namespace=/view action name=index class=com.mycompany.HelloAction interceptor-ref name=basicStack/ interceptor-ref name=jsfStack/ result name=success type=jsf/ result/WEB-INF/jsp/view/index.jsp/result /action /package A couple of things here. You're extending portlet-jsf-default, which still has the jsfStack as the default interceptor ref. Since you have defined a jsf package that extends portlet-jsf-default, you should probably extend the jsf package instead. However, it's probably just as easy configuring the correct interceptor stack and default interceptor ref right there in the portlet-jsf-default package. In addition, you're overriding the default interceptor stack in your action definition, so it's not really using the portletDefaultStack, even if you had configured your default interceptor stack correctly. Unless you need to use different interceptors in your action, there's no need configuring those interceptor-refs there. You could also try swapping the order of the portletDefaultStack and the jsfStack and see if that makes a difference. Nils-H - 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] This email and any attachments (Message) may contain legally privileged and/or confidential information. If you are not the addressee, or if this Message has been addressed to you in error, you are not authorized to read, copy, or distribute it, and we ask that you please delete it (including all copies) and notify the sender by return email. Delivery of this Message to any person other than the intended recipient(s) shall not be deemed a waiver of confidentiality and/or a privilege. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [struts] Running a prepare method before the assigned action method
meeboo wrote: Still no solution to this problem. How come parameters in actions with wildcards (for example myapp/modelObject/*) aren't parsed in the prepare method? They work fine when I parse them in my assigned action method :( If you're using 2.1, there are now a number of ways in which parameters can be set on your action, each with separate interceptors: params actionMappingParams staticParams You might need to update your interceptor stack. -Dale - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Problem with dojo loading dynamic html source
My problem arises when I write out html to a jsp in a way like out.println(s:a href...);. Well the s:a html is built on server side with theme=ajax and targets set to a panel div. The line is similar to s:a theme=ajax targets=somePanelDiv href=...Link/s:a When dojo renders this source I get an error of: DEBUG: DEPRECATED: dojo.widget.Manager.getImplementationName Could not locate widget implementation for a in s.widget registered to namespace s. Developers must specify correct namespaces for all non-Dojo widgets -- will be removed in version: 0.5 DEBUG: dojo.widget.Parse: error:Error: Could not locate widget implementation for a in s.widget registered to namespace s This is returned for each link. Now I can confirm that all links that I am streaming onto the jsp do work, but they work only when statically embedded, this error is thrown when using out.println. I looked around to if or how to specify the namespace in this instance, but one, I couldnt locate any sound sources, and two I am confused on why this is not a problem when the source is statically placed inside the jsp. If anyone can lend some inisight on this problem I am having, or a direction to point me in I would appretiate it. -- View this message in context: http://www.nabble.com/Problem-with-dojo-loading-dynamic-html-source-tp16282902p16282902.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with dojo loading dynamic html source
--- cree [EMAIL PROTECTED] wrote: My problem arises when I write out html to a jsp in a way like out.println(s:a href...);. Well the s:a html is built on server side with theme=ajax and targets set to a panel div. That's not how things work. JSPs are compiled (by the container) into a servlet; you don't have a JSP, you have an output stream, so there's no compilation process, hence no custom tags will be executed. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: About Message Icons
Chris Pratt wrote: On Mon, Mar 24, 2008 at 10:58 PM, Chen Chunwei [EMAIL PROTECTED] wrote: Maybe some pre-defined style of message display or something else. I know I can do these all myself. But if there's already something can do this, why not just use it? There are the s:actionerror, s:actionmessage, and s:fielderror tags, but I don't believe they use any standard images. You might look into the theme support built into Struts2, you may be able to define your own theme that includes the proper images in the above tags. (*Chris*) You could also use the cssClass/cssStyle/etc attributes with those tags rather than customizing the templates, though customizing the templates is probably easier if you aren't using the simple theme (and therefore aren't using those tags to render error messages yourself). L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Actions not called from their expected forms
wwwclaes wrote: Hi, we have an S2 application with a lot of actions that are supposed to be called from html forms. Since a few weeks ago something or someone has started calling these actions directly, hence the required input values are missing (which generate a lot of error mails to us administrators). What might be causing this? Of course, we may have gotten some new, very stubborn, users but due to the sudden frequency and pattern of the calls my first bet would be some kind of automatic crawler. Some of the actions require authentication, so it is not Google Co. Could some kind of web page prefetching cause this? Or any other ideas? Anyway, I guess one solution would be to mark all expected input values as required using S2 validation. However, it would be a bit cumbersome and repetitive. To keep the application clean, I don't think it would be bad to keep its current design with relying on form input values to be there (if it's a combo box for instance, of course not for user entered text fields). Can you think of some simpler means to stop these errors from occurring and still keep it simple and Struts-wise? If inputs are required they absolutely should be marked as such in the validation rules. Leaving out such checks leaves you wide open to data integrity issues at the very least. As far as figuring out where these 'bogus' requests originate, look at the referer logs or add some network-level monitoring. Fixing you validation so error messages go to the users rather than the administrators is probably the sane solution, though :-) L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to implement browsing history
Hi guys, Is there standard or preferable way to enable user to go back when he/she browses website? As of now I can think only of caching something like http://acegisecurity.org/acegi-security/xref/org/acegisecurity/ui/savedrequest/SavedRequest.htmlor request.getRequestURL()+request.getQueryString() (in case of GET request) in user session. Thanks, Andriy
Re: How to implement browsing history
On Tue, Mar 25, 2008 at 1:23 PM, Andriy Kharchuk [EMAIL PROTECTED] wrote: Hi guys, Is there standard or preferable way to enable user to go back when he/she browses website? As of now I can think only of caching something like http://acegisecurity.org/acegi-security/xref/org/acegisecurity/ui/savedrequest/SavedRequest.htmlor request.getRequestURL()+request.getQueryString() (in case of GET request) in user session. Thanks, Andriy You might want to look for a breadcrumb solution. That is a very common way to provide users a path backwards through your site. (*Chris*) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: HashMap and updates
Kalpesh Modi wrote: Hi, I am having a problem in updates. I have a base class Employee.java. I have subclasses HourlyEmployee.java, ContractEmployee.java, FullTimeEmployee.java. I display these three types of employees under 3 tabs on my JSP. I create 3 lists for each type of employees and put these lists in a HashMap with different keys. Map employeeMap = new HashMap(); employeeMap.put (HE, hourlyEmployeeList); employeeMap.put (CE, contractEmployeeList); employeeMap.put (FE, fullTimeEmployeeList); I am able to display the list of employees properly. But when I change the values and submit the form, the new values dont show up in the action. That's definately doable, so it's probably a simple tag usage error. You don't include your code, so it's impossible to say where the problem is, but I'd suggest you start by simplifying things down; start by making sure you can edit a single employee; then get it working with a list of employees; then with a list in a map. Along the way you'll probably discover which asspect of your data addressing is incorrect. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: S2: Actions/DAO interaction getting messy...
Eric D Nielsen wrote: I'm starting to get some rather stinky code in one of my projects and wanted to ask for some advice. ( Its a Struts2/Spring2/JPA(Hibernate) based project. I'm using a slightly modified version of the Generic DAO pattern shown in the Java persistence with Hibernate book and/or the IBM ThoughtWorks very similar example. (Modified to allow Spring Based Injection of the JPA EntityManger, while falling back to a native Hibernate session inside the DAOs to allow a few more optimizations). So its basically Business Objects (POJOs) ---1:1--- DAOs which is a relatively normal pattern I beleive. Now I'm working on an Action that creates an object that contains lots of references to other objects. A bug tracker would be a reasonable facsimile of my domain object -- when creating a bug, you select a severity, a project, a module, a found in version, possibly you're assigning it to someone, etc. Most of these options come from a drop-down on the view page, however they are all backed by their own domain object -- ie its not just id/string display name lookup-table backing the drop down. So the form submits a whole suite of IDs or String natural keys and I need to build an Defect/Bug and then persist it. In building the Defect I need to convert all the keys to domain objects. This is where things begin to fall apart. To covert the keys to domain object seems to require injecting all the subordinate object DAOs into the Action, its not a big deal but its starting to feel like the subordinate DAOs are taking over the action. Furthermore, its slightly annoying from a performance stand-point that I need to retrieve all the objects from the DB, just to set a foreign key -- I will never be updating the details on the subordinate object from the master only changing which one I'm linked to. [As a side issue: this is a place where the Get (returning a proxy/lazy load thunk with only the ID set without hitting the DB) versus Load could be useful, but I've never seen any of the generic DAO approaches expose that level of control in their API -- does anyone know why?] Here's an example (not from live code, please ignore any minor typos) representing the current state of application and test code. Afterwards I'll list a few of the approaches I've considered for cleaning it up: AddBug.java code: public class AddBug extends ActionSupport { private BugDAO bugService; private UserDAO userService; private ProjectDAO projectService; private ModuleDAO moduleService; private VersionDAO versionService; private String submitterUsername; private String assigneeUsername; private Long projectID; private Long moduleID; private ListLong affectedVersionIDs; public String execute() { Bug bug = new Bug(); // The following lines are what feel unclean to me bug.setSubmitter(userService.findByUsername(getSubmitterUsername())); bug.setAssignee(userService.findByUsername(getAssigneeUsername())); bug.setProject(projectService.find(getProjectID())); bug.setModule(moduleService.find(getModuleID())); for( Long versionID : getAffectedVersionIDs()) { bug.addAffectedVersion(versionService.find(versionID)); } bugDAO.persist(bug); return SUCCESS; } // This block of setters also seems to be wrong... Only the first one // should really be required by this action I think public void setBugService(final BugDAO bs) {bugService=bs;} public void setUserService(final UserDAO us) {userService=us;} public void setProjectService(final ProjectDAO ps) {projectService=ps;} public void setModuleService(final ModuleDAO ms) {moduleService=ms;} public void setVersionService(final VersionDAO vs) {versionService=vs;} public void setSubmitterUsername(final String username) {submitterUsername=username;} public void setAssigneeUsername(final String username) {assigneeUsername=username;} public void setProjectID(final Long id) {projectID=id;} public void setModuleID(final Long id) {moduleID=id;} public void setAffectedVersionIDs(final ListLong ids) {affectedVersionIDs=ids;} public String getSubmitterUsername() {return submitterUsername;} public String getAssigneeUsername() {return assigneeUsername;} public Long getProjectID() {return projectID;} public Long getModuleID() {return moduleID;} public ListLong getAffectedVersionIDs() {return affectedVersionIDs;} } TestAddBug.java (Sorry this is purely from memory so I know I'm missing some of my infrastructure) code: public void testAddBug() { String submitterUsername=TestUser; String assigneeUsername=TestVictim; User submitter=new User(submitterUsername); User assignee=new User(assigneeUsername); UserDAO userService = createMock(UserDAO.class);
Re: Javascript error using struts select tag
Since html:submit doesn't emit any Javascrip, the error has to be in your custom Javascript code. That came through somewhat unreadably formatted, though, and you didn't include its dependencies so it's tough to debug from here... I would strongly recommend installing Firefox + Firebug and stepping through your code in the debugger to figure out the problem. L. Joe Yuen wrote: I am trying to use the html:select tag in my jsp page but am getting the following javascript error, Microsoft JScript runtime error: Object expected. In my jsp page I have: table align=left class=tableGold tr th align=left bgcolor=#EEE8AAfont size=-1 color=#ff*/fontbean:message key=table.head.category//th /tr tr td align=center valign=middle div div style={float: left;} html:select styleId=category property=devicecategoryid onchange=selectDevOrStent() html:option value=bean:message key=select.list.device.category//html:option html:options collection=DeviceCategory property=id labelProperty=description/ /html:select /div div id=otherdev style={float: left; display: none; font-family: Arial, Helvetica, sans-serif; font-size: xx-small; vertical-align: middle; padding-left: 50px; line-height: 1.2em} html:text property=other size=35 maxlength=60 onfocus=clearOther() value = Enter Device Description / /div /div /td /tr /table Here is the javascript funtion that is called when a onchange event is detected: function selectDevOrStent(){ alert(In SelectDevOrStent); var category = id(category).options[id(category).selectedIndex].value; var categoryText = id(category).options[id(category).selectedIndex].text; //alert(categoryText = + categoryText); if(categoryText == 'Stents'){ //alert(Stent selected); id(stent).style.display = block; id(dev).style.display = none; id(otherdev).style.display = none; getSelectList(category, StentManufacturerSelect.do, stentmanufcallback); }else if(categoryText == 'Joint Replacement'){ //alert(Joint Replacement selected); document.DeviceInputForm.devicetypeid.disabled='true'; document.DeviceInputForm.manufacturer.disabled='true'; document.DeviceInputForm.modelnumber.disabled='true'; getSelectList(category, DeviceLocationSelect.do?devicecategoryid= + escape(id(category).value), locationcallback); id(dev).style.display = block; id(stent).style.display = none; id(otherdev).style.display = none; }else if(categoryText == 'Other'){ //alert(Other selected); id(otherdev).style.display = block; id(stent).style.display = none; id(dev).style.display = none; }else{ //alert(Stent not selected); id(stent).style.display = none; id(dev).style.display = block; id(otherdev).style.display = none; getSelectList(category, DeviceTypeSelect.do?devicecategoryid= + escape(id(category).value), devicecallback); } } Everything is fine, I can see the select box and all the options are there but when I trigger a onchange event I get the error. Can anyone see what I am doing wrong? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Best way to get request information
Struts 2 - Java - JSP For storing user login information in the database, when a user logs in I need to get the following types of information: Hostname, IP address, User-Agent, sessionId, etc. Before using Struts2, I would access the HTTPSession and request object and use methods such as: request.getHeader() request.getHeaderNames() request.getRemoteAddr() What is the best practice to access this information using Struts 2 actions? -- View this message in context: http://www.nabble.com/Best-way-to-get-request-information-tp16288480p16288480.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Best way to get request information
mojoRising wrote: Struts 2 - Java - JSP For storing user login information in the database, when a user logs in I need to get the following types of information: Hostname, IP address, User-Agent, sessionId, etc. Before using Struts2, I would access the HTTPSession and request object and use methods such as: request.getHeader() request.getHeaderNames() request.getRemoteAddr() What is the best practice to access this information using Struts 2 actions? http://struts.apache.org/2.0.11/docs/how-do-we-get-access-to-the-session.html http://struts.apache.org/2.0.11/docs/how-can-we-access-the-httpservletrequest.html http://struts.apache.org/2.0.11/docs/how-can-we-access-the-httpservletresponse.html L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: S2: Actions/DAO interaction getting messy...
Eric D Nielsen on 25/03/08 14:29, wrote: Its a Struts2/Spring2/JPA(Hibernate) based project. I'm using a slightly modified version of the Generic DAO pattern shown in the Java persistence with Hibernate book and/or the IBM ThoughtWorks very similar example. (Modified to allow Spring Based Injection of the JPA EntityManger, while falling back to a native Hibernate session inside the DAOs to allow a few more optimizations). So its basically Business Objects (POJOs) ---1:1--- DAOs which is a relatively normal pattern I beleive. Is it normal with that Generic DAO pattern to name the DAOs 'services'? In the Domain-Driven-Design paradigm that I generally follow, the services are objects which carry out operations that you don't want to specifically assign to one domain object. [As a side issue: this is a place where the Get (returning a proxy/lazy load thunk with only the ID set without hitting the DB) versus Load could be useful, but I've never seen any of the generic DAO approaches expose that level of control in their API -- does anyone know why?] that's a pure Hibernate thing, I think, not a JPA distinction. just use POJOs there. I believe this approach would work with the Model-Driven idea, but it feels a little odd to me to mark up the domain object with HTTP-specific details Yes it would do, but what do you mean by 'mark up the domain object with HTTP-specific details'? I don't think you have to touch the domain objects to code the re-construction of your incoming Bug POJO. Regards Adam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
The validator does not work
Hi all, It seems that my struts application's validator does not work. I've add plug-in className=org.apache.struts.validator.ValidatorPlugIn set-property property=pathnames value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml / /plug-in to my struts-config.xml and these two files surely exist. Actually, it did work yesterday and I don't remember there are any change applied to my application. But the validator just does not work. Have you ever met with this situation? Or is there any way to find out the reason why the validator doesn't work? I can debug my application. Thanks. Talos
Re: The validator does not work
Finally I found the problem! I did apply a slight change to the validator.xml yesterday: just added the following xml header. !DOCTYPE form-validation PUBLIC -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1//EN http://jakarta.apache.org/commons/dtds/validator_1_1.dtd; But in the above header, the version of validator is declared as 1.1 while in my validator-rules.xml, the version is 1.0! So, obviously there is a version conflict which caused the validator did not work. Talos - Original Message - From: Chen Chunwei [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Wednesday, March 26, 2008 9:45 AM Subject: The validator does not work Hi all, It seems that my struts application's validator does not work. I've add plug-in className=org.apache.struts.validator.ValidatorPlugIn set-property property=pathnames value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml / /plug-in to my struts-config.xml and these two files surely exist. Actually, it did work yesterday and I don't remember there are any change applied to my application. But the validator just does not work. Have you ever met with this situation? Or is there any way to find out the reason why the validator doesn't work? I can debug my application. Thanks. Talos
Re: [struts] S2: Actions/DAO interaction getting messy...
The other benefit of the DAO / Manager / Action layers is that you can use spring to wire up the Manager/Service methods as the transaction boundaries. Sets of changes you want to all succeed or fail atomically? Put it in the manager. Managers are where business logic belongs, DAO's where DB maintenance logic belongs, Actions are just one interface into this, as you can expose managers as web services, too... -Dale - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Replacement For MessageResourceConfig and MessageResourceFactory in struts-2
Hi All, Does someone now the replacement for MessageResourceConfig and MessageResourceFactory in struts2. And also need a brief description for using message resources in struts 2. Thanks in Advance, Sandeep -- View this message in context: http://www.nabble.com/Replacement-For-MessageResourceConfig-and-MessageResourceFactory-in-struts-2-tp16295690p16295690.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]