struts

Can't get request attribute in struts action class

a 夏天 提交于 2019-12-07 20:25:31
问题 I have a jsp page. I am calling the jsp page in a iframe and appending new parameter to the url. The usrl looks like http:\localhost:8080\Search.pp?blah=true; So when as the search page called has got some filters so in the action class i have code like this String Parameter = request.getParameter(blah); if (StringUtils.isNotEmpty(Parameter)) { Search = Boolean.parseBoolean(campaignSearchParameter); } and then in the jsp page i do something like final Boolean Search = (Boolean) request

What's the Difference Between <s:property ..> and ${param}

这一生的挚爱 提交于 2019-12-07 10:22:08
问题 In struts I notice there are two different ways to access variables. I am curious what the difference is and when to properly use each one. For example, suppose we set the variable height like so: <s:set var="height">300px</s:set> Now I can use it two ways: <div style="height: ${height}"> </div> ..or.. <div style="height: <s:property value='#height' />"> </div> What is the difference, and which is better to use? 回答1: The struts2 <property> provides additional functionality beyond what ${}

Executing multiple actions one after another

时光怂恿深爱的人放手 提交于 2019-12-07 06:32:21
问题 I am in need of a way of executing multiple struts actions with one request. The goal is to minimize the need of request against the server. So what i need is something like a "MultiAction" which gets a list of actions as its parameters which it should execute and then return a "combined" result of this actions. For example: The client is split up in a lot of modules One module needs to get information from the server There is a proxy at the client handling this request This proxy now goes

Struts <bean:write> tags

浪子不回头ぞ 提交于 2019-12-07 05:43:43
问题 How do I escape character like '&' in struts tags. For example we can mention. <a href="./testaction.do?testmethod=bookResult&bookTitle=<bean:write name="booklist" property="title"/>" class="nLink"><bean:write name="booklist" property="title"/></a></small> I'm iteration over a book list array (booklist) and setting book titles one by one.In this scenario I need to escape characters like '&' within the 'title' property in order execute the respective logic for that particular action. Thanks.

Multiple Submit button in Struts 1.3

爱⌒轻易说出口 提交于 2019-12-07 05:17:16
问题 I have this code in my JSP: <%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%> .. .. <html:form action="update" > .. .. <html:submit value="delete" /> <html:submit value="edit" /> <html:sumit value="update" /> </html:form> And this in the struts-config.xml file: <action path="/delete" name="currentTimeForm" input="/viewall.jsp" type="com.action.DeleteProduct"> <forward name="success" path="/viewall.jsp" /> <forward name="failure" path="/viewall.jsp" /> </action> Like the

ModelDriven on struts 2

≯℡__Kan透↙ 提交于 2019-12-07 03:07:36
I am developing a project using hibernate, struts2 and spring, but my problems are with struts. I have created 3 classes extending ActionSupport and are implementing modeldriven for the same class in all of them. I have implemented some methods to be executed when the actions are called. The structure for the classes is like (Class1Action.java): public class Class1Action extends ActionSupport implements ModelDriven<ModelDrivenClass> { private ModelDrivenClass modelDrivenClass; // getter and setter for modelDrivenClass public String methodName() { System.out.println("Entrou!"); return SUCCESS;

displaying dynamic values in jsp without usinf scriplet using struts mvc

柔情痞子 提交于 2019-12-07 03:06:24
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"%> <table align="left" width="346" border="0"> <tr><td align="center" colspan="2" style="font-size:20px;"

read the contents of a file upload in java

泄露秘密 提交于 2019-12-07 02:32:13
问题 I know how to upload a file: <html> <head> <title>File Uploading Form</title> </head> <body> <form action="UploadServlet" method="post" enctype="multipart/form-data"> File :<input type="file" name="file" size="50" /> <input type="submit" value="Upload File"/> </form> </body> </html> This is the class for reading the file: import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class BufferedReaderExample { public static void main(String[] args) { try

Supplying credentials safely to a RESTFUL API

感情迁移 提交于 2019-12-07 02:26:50
问题 I've created a RESTful server app that sits and services requests at useful URLs such as www.site.com/get/someinfo. It's built in Spring. However, these accesses are password protected. I'm now building a client app that will connect to this RESTful app and request data via a URL. How can I pass the credentials across? Currently, it just pops up the user/password box to the user, but I want the user to be able to type the username and password into a box on the client app, and have the client

java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction exception occur in MYSQL

Deadly 提交于 2019-12-07 01:54:30
I am Using a table name "test" in MYSQL that is lock during a transaction T1 that will be complete with in 20 minutes. When I am updating this table by another transaction T2 within these 20 minutes . I am getting an exception:- 11:58:38,584 ERROR [STDERR] java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction 11:58:38,584 ERROR [STDERR] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2928) 11:58:38,584 ERROR [STDERR] at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571) 11:58:38,584 ERROR [STDERR] at com.mysql.jdbc.ServerPreparedStatement.serverExecute