我搜索了列中的重复条目和Oracle:在select查询中找到重复的行,但似乎无法得到任何答案...
我有一些看起来像这样的数据
columnA columnB columnC
1111111 emailID1 true
1111111 emailID2 false
1111222 emailID3 true
1111339 emailID4 true
2384398 emailID5 true
Run Code Online (Sandbox Code Playgroud)
我想只显示这些列在columnA中具有相同值但在columnB和/或C中可能不同的列:
columnA columnB columnC
1111111 emailID1 true
1111111 emailID2 false
Run Code Online (Sandbox Code Playgroud)
使用>> 1似乎并没有抓住这个,任何想法?谢谢.
目前我正在为我的工作项目使用struts2 Framework,在设计我的DAO类时,我在脑海中有一个问题需要改进设计模式.
在我的搜索功能上,我有3种搜索
我的问题是,DAO方法的最佳方法是什么?
在我的struts2方法中,我有
public String execute() {
//assuming these are passed in from JSP
if ("searchByAnId".equals(paramSearch))
{
List<DTO> datalist = this.someDao.implementList(theIdParam);
} else if("searchByAnOtherParam".equals(paramSearch))
{
List<DTO> datalist = this.someDao.implementAnotherList(param1, param2, param3, param4)
// more params
} else
{
List<DTO> datalist = this.someDao.implementListAll();
}
return "success";
}
Run Code Online (Sandbox Code Playgroud)
我正在阅读设计模式,如工厂方法,装饰器方法,观察者方法,但我不确定哪一个是最适合的(或其他没有第三方插件的东西)适合这个?
是否可以使用返回Integer或Float的函数?如果可能的话,我想让2个函数成为一个函数:
private static Integer parseStringFormatInt(String val){
System.out.println(Integer.parseInt(val.substring(0, val.indexOf("."))));
return Integer.parseInt(val.substring(0, val.indexOf(".")));
}
private static Float parseStringFormatFloat(String val){
System.out.println(Float.parseFloat(val.substring(0, val.indexOf("."))));
return Float.parseFloat(val.substring(0, val.indexOf(".")));
}
Run Code Online (Sandbox Code Playgroud) 我还有另一个关于Struts2的问题.
我正在做一张图表和一个数据表.发生的事情是在我的图表的第一次加载(并单击图表数据以链接到数据表),它工作正常.但是当我更改了我的图表中的参数并想重新填充数据表时,它给了我这个错误:
Error on line 69, column 13 in template/simple/select.ftl
stack.findValue('top') is undefined.
Run Code Online (Sandbox Code Playgroud)
它不能分配给itemKey
==> assignment: itemKey=stack.findValue('top') [on line 69, column 13 in
template/simple/select.ftl]
in user-directive s.iterator [on line 59, column 1 in template/simple/select.ftl]
Run Code Online (Sandbox Code Playgroud)
freemarker.core.InvalidReferenceException: Error on line 69, column 13 in template/simple/select.ftl
stack.findValue('top') is undefined.
It cannot be assigned to itemKey
at freemarker.core.Assignment.accept(Assignment.java:111)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.IfBlock.accept(IfBlock.java:82)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.Environment.visit(Environment.java:299)
at freemarker.core.UnifiedCall.accept(UnifiedCall.java:130)
at freemarker.core.Environment.visit(Environment.java:210)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:210) …Run Code Online (Sandbox Code Playgroud) 如何读取 xsl 中的复选框值?我有一个从数据库中读取的值,根据这个值,这个复选框将被选中或取消选中。我有这个片段,但即使 database_column 值为 1,复选框也不会检查。
<xsl:template.....>
<form....>
<input type="checkbox" id="functional_test" name="DATABASE_COLUMN">
<xsl:if test="//DATABASE_COLUMN='1'">
<xsl:attribute name="checked">checked</xsl:attribute>
</xsl:if>
</input>
</form>
</xsl:template>
Run Code Online (Sandbox Code Playgroud)
编辑:我在检索 textarea 值时也遇到问题。这个 textarea 值实际上来自一个选择选项。但是,当从数据库中检索该值时,我不知道为什么该值没有出现。我的代码如下所示:
<label class="control-label Mandatory" for="txtRecommendedAction"> Recommended Action*
<button type="button" class="btn btn-default" href="#modalRecommended" data-toggle="modal"> Retrieve </button>
</label>
<textarea class="form-control" id="txtRecommendedAction" name="recommended_action" rows="6" value="{//RECOMMENDED_ACTION}"/>
Run Code Online (Sandbox Code Playgroud)
它只是没有在 textarea 中显示正确的值。知道我错过了什么吗?
我脑子里有一些困扰我的东西已经有一段时间了,希望我能得到一些善良的帮助......:D
无论如何,这就是我想做的事情:
我确实有一些清单,比方说
List<String> a = {"for testA1", "for testA2", "for testA3"};
List<String> b; = {"for testB1", "for testB2", "for testB3"};
List<String> c; = {"for testC1", "for testC2", "for testC3"};
Run Code Online (Sandbox Code Playgroud)
我有一个对象的数组列表,我想将这些字符串添加到其中,即
List<ObjectA> thislist = new ArrayList<ObjectA>();
Run Code Online (Sandbox Code Playgroud)
在我的ObjectA类中,我有:
public class ObjectA{
String testA;
String testB;
String testC;
}
Run Code Online (Sandbox Code Playgroud)
我的最终输出应该是:
List<ObjectA> -
Run Code Online (Sandbox Code Playgroud)
testC1
testA2
testC2
testA3
如何从给定的个人列表中设置我的对象中的这些字符串?
抱歉我的英语不好,我希望这是可以理解的.
我有这个想法,但不太明白.
我的代码是
List<String> aList = ....;
List<String> bList = ....;
List<String> cList = ....;
List<ObjectA> someList = …Run Code Online (Sandbox Code Playgroud) 我试图在2个ArrayList 对象的 String中获取"tags"的araylist时遇到问题.我尝试了以下但看起来我的理想输出不是我所期望的.
这是代码:
public class TestList {
public static void main(String []args) {
Tag tag1 = new Tag();
tag1.setId(15);
tag1.setTag("Test");
Tag tag2 = new Tag();
tag2.setId(15);
tag2.setTag("Oracle");
Tag tag3 = new Tag();
tag3.setId(16);
tag1.setTag("OHNO CANNOE");
List<Tag> tagList = new ArrayList<Tag>();
tagList.add(tag1);
tagList.add(tag2);
tagList.add(tag3);
System.out.println(tagList.size());
AnotherTest test1 = new AnotherTest();
test1.setId(15);
test1.setTestcol("Another test col");
AnotherTest test2 = new AnotherTest();
test2.setId(15);
test2.setTestcol("HAHAHA");
List<AnotherTest> anotherTests = new ArrayList<AnotherTest>();
anotherTests.add(test1);
anotherTests.add(test2);
System.out.println(anotherTests.size());
List<String> getTaglist = new ArrayList<String>();
for(AnotherTest anotherTest : anotherTests) {
for(Tag …Run Code Online (Sandbox Code Playgroud)