当前控制器代码:
@RequestMapping(value = "/city", method = RequestMethod.POST)
public String getWeather(@RequestParam("city") int city_id,
@RequestParam("text") String days, //this gives errrors, when i remove this line, then it is okay
Model model) {
logger.debug("Received request to show cities page");
//int city =
// Attach list of subscriptions to the Model
model.addAttribute("city", service.getCity(city_id));
// This will resolve to /WEB-INF/jsp/subscribers.jsp
return "city";
}
Run Code Online (Sandbox Code Playgroud)
这是我的JSP文件(视图):
<form method="post" action="/spring/krams/show/city">
Vali linn
<select name="city">
<c:forEach items="${cities}" var="city">
<option value="<c:out value="${city.id}" />"><c:out value="${city.city}" /></option>
</c:forEach>
</select><br>
Vali prognoos N …Run Code Online (Sandbox Code Playgroud) 似乎Apache ivy仅从http://mvnrepository.com/和其他几个地方下载工件,但所有的jar都在那里过时了.
所以我想为Ivy添加自定义存储库.我正在使用存储库Ivy RoundUp:http://code.google.com/p/ivyroundup/
这是我的配置,但收到错误:
build.xml文件:
<target name="update" depends="init-ivy" description="Download project dependencies">
<!-- edited for brevity -->
<ivy:settings file="ivysettings.xml" />
<ivy:retrieve pattern="war/WEB-INF/lib/[artifact]-[revision].[ext]" />
<!-- edited for brevity -->
</target>
Run Code Online (Sandbox Code Playgroud)
ivy.xml:
<ivy-module version="2.0">
<info organisation="org.apache" module="hello-ivy"/>
<dependencies>
<dependency org="org.springframework" name="spring" rev="3.0.6" conf="default->master"/>
</dependencies>
</ivy-module>
Run Code Online (Sandbox Code Playgroud)
ivysettings.xml:
<ivysettings>
<resolvers>
<packager name="roundup" buildRoot="${user.home}/.ivy2/packager/build" resourceCache="${user.home}/.ivy2/packager/cache">
<ivy pattern="http://ivyroundup.googlecode.com/svn/trunk/repo/modules/[organisation]/[module]/[revision]/ivy.xml"/>
<artifact pattern="http://ivyroundup.googlecode.com/svn/trunk/repo/modules/[organisation]/[module]/[revision]/packager.xml"/>
</packager>
</resolvers>
</ivysettings>
Run Code Online (Sandbox Code Playgroud)
错误:
Buildfile: C:\Users\Jansu\workspace\HibernateSpring\build.xml
build:
deploywar:
[war] Building war: C:\Users\Jansu\workspace\HibernateSpring\hibernate.war
[copy] Copying 1 file to C:\apache-tomcat-7.0.20\webapps
download-ivy:
[get] Getting: …Run Code Online (Sandbox Code Playgroud) JSP:
<form:form commandName="editWeather" method="post" action="../edit">
<!-- Input fields -->
<input type="submit" value="Submit">
</form:form>
Run Code Online (Sandbox Code Playgroud)
这就是我在Spring中获得模型的方式:
@ModelAttribute("DONTGIVEADAMN") Weather weather
Run Code Online (Sandbox Code Playgroud)
我仍然可以使用weather它来做我的操作,它工作得很好,例如:
weatherService.editWeather(weather);
Run Code Online (Sandbox Code Playgroud)
我的问题是......为什么这样做?
我有包裹:
com.google.*.*.*
Run Code Online (Sandbox Code Playgroud)
可能有许多子包.
我有一个班级 foo.java
如何检查它是否在主包内 com.google
当我使用时Class.getPackage(),它只给出整个包,如下所示:
com.google.util.domain.sup
我必须真正使用以下功能:substring() , split().或者是否有一种奇特的方法来检查它是否属于某些父包?
我有情景:我想等,直到某些事情是假的.通常需要20秒左右.
while(foo) {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud)
或者就这样去?
while(foo) {
}
Run Code Online (Sandbox Code Playgroud) Private Function GetLastSameRow(ByVal row, initialValue) As Integer
.
.
.
If (nextCell.Value = initialValue) Then
GetLastSameRow = GetLastSameRow(row + 1, initialValue)
End If
MsgBox ("returning : " & row)
GetLastSameRow = row
End Function
Run Code Online (Sandbox Code Playgroud)
完成if语句后,行为真的很奇怪.
我在它上运行调试器,这就是它跳转的方式:
1. End If '
2. MsgBox ("returning : " & row) ' row value is 3
3. GetLastSameRow = row '
4. MsgBox ("returning : " & row) ' row value is 2 ????????
5. GetLastSameRow = row '
Run Code Online (Sandbox Code Playgroud)
所以基本上它想要返回correct值,但然后跳回到End if …
这是我的调试代码:
log.error(u.getName() + " - " + u.getName().length() + " - host_node" + " - " + u.equals("host_node"));
Run Code Online (Sandbox Code Playgroud)
我的日志:
11:27:16 [main] ERROR com.google - host_node - 9 - host_node - false
Run Code Online (Sandbox Code Playgroud)
为什么它不相等,我甚至检查长度,看看是否首先包含空格.但事实并非如此.