我有一个简单的网络应用程序
webapp
static
images
- a.gif
pages
- test.html
WEB-INF
pages
- test.jsp
Run Code Online (Sandbox Code Playgroud)
在test.html中,有
<img src="/static/images/a.gif"/>
Run Code Online (Sandbox Code Playgroud)
问题是,在我将uri更改为之前,图像不会显示
<img src="/web app name/static/images/a.gif"/>
Run Code Online (Sandbox Code Playgroud)
但是我在URI上加载test.html
http://server/web app name/static/pages/test.html
Run Code Online (Sandbox Code Playgroud)
我在web.xml中配置了静态资源映射,如下所示.
<servlet>
<servlet-name>springWeb</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext-web.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springWeb</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>resourceServlet</servlet-name>
<servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>resourceServlet</servlet-name>
<url-pattern>/static/*</url-pattern>
</servlet-mapping>
Run Code Online (Sandbox Code Playgroud)
我错过了什么吗?我确实希望在DEV阶段将这些静态资源保留在应用程序中,而不是将它们移动到HTTP服务器.
非常感谢.
我正在尝试创建一些图表,以便在我的网站上在线发布,作为PNG图像.我不想使用像Photoshop或类似的任何图像编辑器.相反,我想使用一些纯文本格式和编译器.到目前为止我唯一知道的工具是Graphviz/DOT,它有一些缺点.有哪些替代方案?
我使用扩展的UserProfile.现在我想制作个人资料版.我需要从原始用户模型中放置所有自定义配置文件字段和电子邮件,名字,姓氏.我尝试这样做,但不能使它工作.电子邮件字段未显示.没有显示用户模型.
我的表格:
class MainUserProfile(ModelForm):
class Meta:
model = User
fields = ('email',)
class UserProf(MainUserProfile):
class Meta:
model = UserProfile
Run Code Online (Sandbox Code Playgroud)
我的看法:
form = UserProf(instance=request.user.get_profile())
Run Code Online (Sandbox Code Playgroud)
更新:
我做到了:)这是代码:
class EditCustomerForm(ModelForm):
def __init__(self, *args, **kwargs):
super(EditCustomerForm, self).__init__(*args, **kwargs)
try:
self.fields['email'].initial = self.instance.user.email
self.fields['first_name'].initial = self.instance.user.first_name
self.fields['last_name'].initial = self.instance.user.last_name
except User.DoesNotExist:
pass
required_css_class = 'required'
error_css_class = 'error'
email = forms.EmailField(label=_(u"Email"))
first_name = forms.CharField(max_length=30, required=True, label=_(u'Forname'))
last_name = forms.CharField(max_length=30, required=True, label=_(u'Surname'))
address = forms.CharField(max_length=255, min_length=10, required=True, label=_(u'Address'))
class Meta:
model = UserProfile
fields = ('email', …Run Code Online (Sandbox Code Playgroud) 我正在使用Galileo Eclipse,我下载了WTP插件,但是当我尝试添加Tomcat服务器时没有Apache Tomcat插件...
任何快速的想法?
我想将一些二进制图像数据编码/压缩为序列(如果是位).(通常,此序列的长度不能完全适合整数个标准整数类型.)
如何在不浪费空间的情况下做到这一点?(我意识到,除非比特序列具有"漂亮"的长度,否则在最后总是必须有少量[<1字节]的剩余空间.)
FWIW,我估计,对于我想要编码的每个符号,最多需要3位.Python有这种工作的内置工具吗?
我的团队愿意开始编写代码的单元测试(我们甚至会尝试TDD).
是否有一些好的示例Flex项目具有良好的单元测试?
我(尝试)了解仿制药,我认为我理解它们.我有以下泛型类的代码:
/// <summary>
/// generics
/// </summary>
class Point<T> where T : IConvertible
{
public T X;
NumberFormatInfo nf = NumberFormatInfo.CurrentInfo;
public double Subtract(Point<T> pt)
{
return (X.ToDouble(nf) + pt.X.ToDouble(nf));
}
}
Run Code Online (Sandbox Code Playgroud)
在Main(),我可以创建对象罚款:
Point<int> pt = new Point<int>();
Point<double> pt2 = new Point<double>();
Point<string> pt3 = new Point<string>();
pt.X = 10;
pt2.X = 10;
pt3.X = "10";
Run Code Online (Sandbox Code Playgroud)
现在,我可以Subtract在两个ints,doubles甚至strings 上运行Method ,但我不能运行混合,我认为我可以因为.ToDouble转换而运行.
如果我尝试运行,Console.WriteLine(pt.Subtract(pt2));我会收到以下错误:
Error 1 The best overloaded …Run Code Online (Sandbox Code Playgroud) clock_gettime()什么时候会返回一个较小的值,使用CLOCK_MONOTONIC,因为它达到了它的最大值?我并不是说那些被描述为错误的小扭曲,而是像计数器重置一样.
是时间测量,还是与蜱的绝对数量相关?
我必须实现一个计时器(1或2秒间隔),我不需要那么多精度.但该应用程序可能会运行几个小时而无需重新启动.(我估计最多1天).
我不会害羞,我不会犯任何可能导致它停止交流的错误.
timerfd是否已经解决了这个问题?
java ×2
.net ×1
apache-flex ×1
bit-packing ×1
c ×1
c# ×1
contextpath ×1
diagram ×1
django ×1
django-forms ×1
eclipse ×1
eclipse-wtp ×1
generics ×1
graphics ×1
graphviz ×1
linux ×1
math ×1
memory ×1
plugins ×1
python ×1
resources ×1
spring-mvc ×1
syntax ×1
tdd ×1
time ×1
tomcat ×1
unit-testing ×1