我有一个Bean来保存结果.我需要使用JSTL迭代它并呈现结果.这是豆子:
public class DetResults
{
private List<String> headings;
private List<Class<?>> types;
private List<Object[]> data;
public DetResults() {}
public List<String> getHeadings() { return this.headings; }
public String getHeading(int which) { return this.headings.get(which); }
public List<Class<?>> getTypes() { return this.types; }
public Class<?> getType(int which) { return this.types.get(which); }
public List<Object[]> getData( ) { return this.data; }
public Object[] getDataAtRow( int row ) { return this.data.get(row); }
public void setHeadings( List<String> val ) { this.headings = val; }
public void setHeadings( String[] …Run Code Online (Sandbox Code Playgroud) 您好我从webservice回来了一个字符串.
我需要解析此字符串并获取错误消息中的文本?
我的字符串看起来像这样:
<response>
<returnCode>-2</returnCode>
<error>
<errorCode>100</errorCode>
<errorMessage>ERROR HERE!!!</errorMessage>
</error>
</response>
Run Code Online (Sandbox Code Playgroud)
解析字符串或转换为xml然后解析是否更好?
我只想读取文本文件的第一行,并将第一行放在字符串数组中.
这是我所拥有的,但它读取整个文件.
myTextFile中的ex文本:
Header1,Header2,Header3,Header4,Header5
1,2,3,4,5
6,7,8,9,10
String line= System.getProperty("line.separator");
String strArray[] = new String[5];
String text = null;
BufferedReader brTest = new BufferedReader(new FileReader(myTextFile));
text = brTest .readLine();
while (text != line) {
System.out.println("text = " + text );
strArray= text.split(",");
}
Run Code Online (Sandbox Code Playgroud) 因此,我已经阅读了有关此问题的其他线程,但尚未找到解决方案。
我遇到的问题是因为我设置了“access-control-allow-methods”“true”我不能使用 setHeader("Access-Control-Allow-Origin", "*");
我需要设置两个特定的域...任何帮助表示赞赏。
我们正在对表单变量进行一些奇怪的处理.无论如何,我已经设法从请求中获取变量,所以我可以做一些数据库的东西.现在我想回发自,因此选择框可以填充原始选择.
以下是选择字段的示例:
JSP:
Condition Code:
<select size="1" name="filterCriteria('CONDITION_CODE').values">
<option value=""> </option>
<c:forEach var="bean" items="${conditions}">
<option value="'${bean.code}'"<c:if test="${bean.code == form.filterCriteria('CONDITION_CODE').values}"> selected="selected"</c:if>>${bean.code}: ${bean.description}</option>
</c:forEach>
</select>
<input type="hidden" name="filterCriteria('CONDITION_CODE').fieldName" value="CONDITION_CODE"/>
<input type="hidden" name="filterCriteria('CONDITION_CODE').operation" value="="/>
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,名称是表单中的函数: name="filterCriteria('CONDITION_CODE').values
这是表格:
private String[] fieldNames;
private Map<String, FilterCriteriaForm> filters =
new HashMap<String, FilterCriteriaForm>();
public String[] getFieldNames() { return this.fieldNames; }
public Map<String, FilterCriteriaForm> getFilters() { return this.filters; }
public FilterCriteriaForm getFilterCriteria(String fieldName)
throws ServletException
{
FilterCriteriaForm filter = (FilterCriteriaForm)filters.get(fieldName);
if (filter == null)
{
filter = new DetFilterCriteriaForm( requestAction ); …Run Code Online (Sandbox Code Playgroud) 您好,我目前正在迭代并显示表中的字段集列表。为了尝试使布局有点体面。每次循环到达第 5 个 fieldSet 时,我都想创建一个新行。谢谢
JSP:
<div class="det" id="displayFields">
<table class="det">
<tr>
<td>
<c:forEach items="${detFieldMap}" var="detFieldEntry">
<fieldset class="det">
<legend>${detFieldEntry.key}</legend>
<c:forEach items="${detFieldEntry.value}" var="detBean">
<input type="checkbox" name="fieldNames" value="${detBean.fieldName}" <c:if test="${preselectionMap[detBean.fieldName]}">checked="checked"</c:if>>${detBean.displayName}</input>
</br>
</c:forEach>
</fieldset>
</c:forEach>
</td>
</tr>
</table>
</div>
Run Code Online (Sandbox Code Playgroud) 好吧,我正在尝试做一些有条件的检查,并注意到这返回了假......我错过了什么?
int test = 1;
int[] testing= {1,3};
System.out.println(Arrays.asList(testing).contains(test) ); //false???
Run Code Online (Sandbox Code Playgroud) 我有2列我想转换为varchars并串联以将它们放在一列中:
我将如何在Hive中做到这一点?当我尝试使用sql的常规方法时,我一直遇到问题...
round(min(temp) over (partition by temp2, temp3) min,
round(max(temp)) over (partition by temp2, temp3) max
*original columns*
min max
0 100
Run Code Online (Sandbox Code Playgroud)
====================================
*new column*
min-max
$0-$100
Run Code Online (Sandbox Code Playgroud)
回答:
这对我有用.....
concat('$',cast(round(min(temp)) as string), ' - $', cast(round(max(temp)) as string)) over (partition by temp2, temp3) newColumn
我正在尝试使用"ApplicationIntent=readonly"连接字符串来访问 sql server 2012 DB 上的辅助节点。
它仍然命中主节点,不知道为什么。
我正在使用sqljdbc4-4.0罐子
java JDBC 调用:
ResultSet results = null;
PreparedStatement preparedStatement = null;
Connection conn = null;
String SQL_SERVER_DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
Class.forName(SQL_SERVER_DRIVER);
String dbString = "jdbc:sqlserver://*****;applicationIntent=ReadOnly;databaseName=****;user=*****;password=****;";
conn = DriverManager.getConnection(dbString);
preparedStatement = conn.prepareStatement("some_sql");
results = preparedStatement.executeQuery();
Run Code Online (Sandbox Code Playgroud) 好的,我有List a和List b
有没有办法检查两者之间是否存在价值?
List a // 1,2,4,5
List B // 1,6,7,8
Run Code Online (Sandbox Code Playgroud)
两个列表之间 // 1 FAILURE
java ×7
jsp ×3
jstl ×2
foreach ×1
hive ×1
hql ×1
html ×1
http-headers ×1
jdbc ×1
sql ×1
sql-server ×1
web-services ×1
xml ×1