struts

displaying dynamic values in jsp without usinf scriplet using struts mvc

断了今生、忘了曾经 提交于 2019-12-08 06:40:46
问题 i am using mvc struts framework in my web application. i am displaying dynamic values from my database in jsp page using scrilets <% %> its been bad practice doing that way but i followed links of how to do it without scriptlets but cant understand much ..i am using struts and i have action and bean class this is my jsp page <%@page import="java.sql.ResultSet"%> <%@page import="com.pra.sql.SQLC"%> <%@page import="java.util.ArrayList"%> <%@page contentType="text/html" pageEncoding="UTF-8"%>

encoding filter , struts working just when using html:form tag

淺唱寂寞╮ 提交于 2019-12-08 05:36:09
问题 I face this problem. I have a filter that sets the character encoding of the request according to the filter's config (for example, to UTF-8). This works with forms coded using the struts html:form tag. However, if I use the ordinary HTML form tag, the data are not encoded correctly. This is the filter definition in the web.xml: <filter> <filter-name>Encoding Filter</filter-name> <filter-class>EncodingFilter</filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8<

Problem with moving JSPs under WEB-INF directory

泄露秘密 提交于 2019-12-08 04:29:59
问题 I am facing a problem when I move my JSP files along with CSS and JS files under WEB-INF/web/ directory. The problem is that, when a JSP page loads, it does not load CSS and JS files. Please help if you have any idea about it. Thanks Umar 回答1: Unless you want to write controllers to serve the css/js files in the WEB-INF folder, you will need to move those files out of WEB-INF so that they can be served as static files by the app server. 回答2: WEB-INF is not web accessible, you need to put css

How to pass an array of string in a url

帅比萌擦擦* 提交于 2019-12-08 03:54:40
问题 Hello i have an url in my jsp and i want to pass an array of string in this url to recover in my ActionForm 回答1: You can use 'standard' html way of passing arrays of data: http://mywebsite/mypage?myarray=value1&myarray=value2&myarray=value3 . Then you can fetch all values of parameter myarray from request object (if framework doesn't provide more elegant ways of handling arrays). But seeing your comment, I would recommend to leave JavaScript and just declare a form for it. If you need a link

CSS and alignement in Struts 2 form

て烟熏妆下的殇ゞ 提交于 2019-12-08 03:29:53
问题 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>

How to set a value in application scope in struts2?

前提是你 提交于 2019-12-08 02:41:23
问题 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 回答1: 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

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

我的未来我决定 提交于 2019-12-08 02:23:57
问题 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 ? 回答1: Migrating an existing J2EE project is easy. You will get rid of a lot of

Struts 1 redirect from action to action with parameters as POST request

左心房为你撑大大i 提交于 2019-12-08 01:57:32
问题 now am trying to redirect to action class from action class with some parameters in my Struts 1.3 web application, here is my code ActionRedirect redirect = new ActionRedirect(mapping.findForward(forwardPage)); redirect.addParameter("method", forwardPage); redirect.addParameter("username", "user"); redirect.addParameter("password", "PWD"); redirect.addParameter("forwardPage", "success"); return redirect; it's working fine, but all parameters are showed in address bar, how can i redirect it as

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

时光总嘲笑我的痴心妄想 提交于 2019-12-08 01:16:32
问题 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; }

Change of Index page based on subdomain/domain name

强颜欢笑 提交于 2019-12-08 00:04:11
问题 Problem and my idea on it is just vague as I'm still in design phase. I just wanted to know something to get a head start on the problem and how/where to proceed to solve it. Problem Part: There's one web app built using struts-2 JSP/servlet, with the URL mywebapp.com . The requirement is every client can access this mywebapp.com using their subdomain, like webapp.abc.com, myapp.xyz.com, etc. I have to filter based on the domain name to give them a customized login page. I have saved their