struts

3.3 Struts2标签库应用

放肆的年华 提交于 2019-12-06 20:55:02
Struts2 把 所有标签都定义在URI 为 /struts-tags的 命名空间下 。可以分为3类: UI标签 (主要用于生成HTML元素的标签,可分为 表单标签和非表单标签 )、 非UI标签 (主要用于 数据访问和逻辑控制 等,分为 数据标签和控制标签 )和 Ajax标签 (主要用于Ajax支持的标签)。 3.3.1 Struts 2的OGNL表达式 1.OGNL表达式 OGNL ( Object Graphic Navigation Language , 对象图导航语言 ), 是个开源项目 。OGNL是一种 功能强大的EL ( Expression Language,表达式语言 ),可以通 过简单的表达式来访问Java对象中的属性 。 OGNL首先在WebWork项目中得到应用,OGNL是Struts2框架视图 默认的表达式语言 ,OGNL表达式是Struts 2框架的 特点之一 。 标准的OGNL 会设定一个根对象(root对象 )。假设使用标准OGNL表达式来求值(不是Struts 2 OGNL),如果OGNL上下文有两个对象,foo对象和bar对象,同时foo对象被设置为根对象(root),则利用下面的OGNL表达式求值。 #foo.blah // 返回foo.getBlah() #bar.blah // 返回bar.getBlah() blah // 返回foo

How to “logic:iterate” just one object?

和自甴很熟 提交于 2019-12-06 16:41:10
So, I have this code: logic:iterate name="nameForm" property="name" id="nameId" indexId="index" bean:write name="nameId" property="field1"/ bean:write name="nameId" property="field2"/ This works great because I'm receiving a "table of objects" so I can do the iterate without issues. Now, on another page I need to do the same but the issue is I am not receiving a "table of objects" but an object itself. I tried it nonetheless and - as expected - got the error: Cannot create iterator for this collection I've RTFM'd and I'm still more confused than before. I get how the "name" inside the "logic

Why html checkbox function only works in IE but not in Firefox or Chrome?

依然范特西╮ 提交于 2019-12-06 16:24:43
I'm debugging a JavaScript/JSP/Struts app, it has a checkbox, for advanced search, when it's checked, other 2 items are supposed to show up on the page for user to enter more info, yet this only works in IE, but not Firefox or Chrome, no response at all when it's checked on the other 2 browsers, why ? And how to make it work in all browsers ? <script type="text/javascript"> function checkAdvSearch(checked) { if(checked) { document.getElementById("searchTerm2").style.display = ''; document.getElementById("searchField2").style.display = ''; }else { document.getElementById("searchTerm2").style

CSS and alignement in Struts 2 form

梦想的初衷 提交于 2019-12-06 16:00:28
Before using Struts2 I had the following code : <form class="form-horizontal" role="form"> <div style="margin-bottom: 25px" class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span> <input id="login-username" type="text" class="form-control" placeholder="Identifiant" name="username" value="" required autofocus> </div> <div style="margin-bottom: 25px" class="input-group"> <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span> <input id="login-password" type="password" placeholder="Mot de passe" class="form-control" name=

Does Java 11 or 12 supports Struts 1.3?

北慕城南 提交于 2019-12-06 15:24:38
问题 Am trying to upgrade maven Struts 1.3 built using Java 1.7 to Java 1.8 and was able to successfully launch the application after changing all possible library files. Now, it has been instructed to upgrade the application to Java 11 or 12. Does Java 11 or 12 supports Struts 1.3 ? Can I proceed to make this changes? Your thoughts please. 来源: https://stackoverflow.com/questions/56521038/does-java-11-or-12-supports-struts-1-3

Tomcat adds [/] to the URL, Struts can't get the correct action name?

大兔子大兔子 提交于 2019-12-06 14:37:15
I have this project was working fine in Jetty, recently as requested, I'm testing it on Tomcat, but i found a problem. we're using Struts2, and the action mapping is defined with no extension, such as http://www.somehost.com/projectname/home when i get everything deployed into Tomcat and access the url above and i got this error: "There is no Action mapped for namespace [/] and action name [home/]" clearly somehow Tomcat added an extra / to the url, so the struts thinks the action name is home/ instead of home . and if I changed the action config from home to home/ , it works fine. but i don't

How to set a value in application scope in struts2?

荒凉一梦 提交于 2019-12-06 14:01:37
I have a list that is accessible to all user of my application.I am currently adding it to session of a particular user.But i want it to be in application scope rather than session scope.Please help also provide reference/link to any example herti I am not sure how you want to use the list: you want to display that list to the screen or you just need it as configuration. To display it you could: create your list statically in your Action, then display it in the JSP you could take the list dynamically from a database, then display it in the JSP To use it as configuration: some data can be made

Can a simple JSp and servlet code be migrated to Spring framework?

岁酱吖の 提交于 2019-12-06 13:17:47
I am a newbie in web development. I'm using servlets and JSP for web development.However, I've learnt lately that Spring Framework is apt for that which incorporate servlets, jsp etc. So, my question is that can I now run my program using Spring framework ? Like, I have 2 jsp codes, and 1 servlet class. So, how can I migrate the code in Spring Framework ? what additional things or codes do I need to maintain ? Migrating an existing J2EE project is easy. You will get rid of a lot of "boilerplate" code in the process. The easiest way to do it in my opinion will be to use SpringToolSuite. Import

Struts - Using multiple submit buttons for one form? (How to know which was clicked)

怎甘沉沦 提交于 2019-12-06 11:34:37
I have 3 buttons for a form I would like to submit. I'm new to struts and I was wondering, is there a way to find which button was clicked? In my html I have this <html:form action="myAction.jspa"> <div align="right"> <html:submit value="back" /> <html:submit value="continue Later" /> <html:submit value="submit" /> </div> </html:form> And in my Java Action class in the execute() method, I attempt using request.getParameter("back") to check if the back button has been pressed but it doesn't work. How does one handle multiple submit buttons in struts? Thanks for help in advance :) Anthony Grist

javax.el.PropertyNotFoundException: Property 'tname' not found on type java.lang.String

你离开我真会死。 提交于 2019-12-06 11:32:16
I was using scriptlets earlier, but now I switched to the mvc. I am not able to retrieve values on to the JSP page and getting errors: javax.el.PropertyNotFoundException: Property 'tname' not found on type java.lang.String Code of the Bean: public class regForm extends org.apache.struts.validator.ValidatorForm implements Iprafunctions { private String tname = null; private String tfee = null; public String getTfee() { return tfee; } public void setTfee(String tfee) { this.tfee = tfee; } public String getTname() { return tname; } public void setTname(String tname) { this.tname = tname; } public