Tag: jsp

使用Sessions将值存储和检索到servlet

我有login.jsp页面,我尝试用户名和文本框中的密码通过会话传递给servlet。 代码o login.jsp如下: UserName: Password: 我想检索login.jsp中设置的用户名和密码到servlet。 我尝试使用以下代码,但它给了我null值。 我在servlet中使用的java代码如下: HttpSession session = request.getSession(true); String name=(String)session.getAttribute(“name”); System.out.println(“Welcome”+name); 谁能告诉我在哪里弄错了。 我需要在会话中存储用户名,以便我可以在该servlet中使用它来处理多个请求

javaList中的ArrayList最后插入的值?

我有以下java类 package com.picvik.model; import java.util.Date; public class ViewAlbum { private Integer albumid; private String albumname; private String description; private String location; private Date date; private Integer uid; public Integer getAlbumid() { return albumid; } public void setAlbumid(Integer albumid) { this.albumid = albumid; } public String getAlbumname() { return albumname; } public void setAlbumname(String albumname) { […]

如何在JSP中将值插入数据库到derby?

我在JSP中创建了一个表单,用于在德比中将数据插入数据库,但它不起作用。 数据库名称为CUSTOMER。 表格: ID (int), CNAME (varchar), ADDRESS (varchar), PHONENUMBER (varchar) client.jsp的内容: JSP Page Name Address TelNumber <input type="submit" name="OK" onclick=" ” value=”OK”/> client.java的内容。 package database; public class Client implements DatabaseConnection{ private static Connection conn = null; private static void createConnection(){ try { conn = DriverManager.getConnection(URL, USER, PASSWORD); } catch (SQLException ex) { Logger.getLogger(client.class.getName()).log(Level.SEVERE, null, […]

spring-boot基本JSP 404未找到

无法使用spring-boot加载非常简单的JSP页面,获得404 Not Found。 的src /主/爪哇/ SampleWebJspApplication.java @Configuration @EnableAutoConfiguration @ComponentScan public class SampleWebJspApplication extends SpringBootServletInitializer { public static void main(String[] args) throws Exception { SpringApplication.run(SampleWebJspApplication.class, args); } } 的src /主/爪哇/ WebController.java @Controller public class WebController { @RequestMapping(“/”) public String welcome() { return “welcome”; } } 的src /主/ web应用/ WEB-INF / JSP /的welcome.jsp Hello. 即使调试器显示从Controller RequestMapping返回“welcome”,也获得404。 白标错误页面 […]

在Java Play上运行JSP

我刚开始使用Java Play framework ,我有几个问题…… 我开发了一个Web应用程序,它使用Maven 3.0进行管理,托管在Tomcat 7.0 ,并包含大量JSP文件。 我们的团队最近决定使用Play框架运行所有内容,我只是想知道是否有一种快速方法将我的原始项目导入Play? 另外,Play如何识别JSP文件? 把它们放在哪里? 谢谢

在jsp中使用foreach显示列表中的列表

是否可以在jsp中使用foreach在列表中显示列表的元素? List<List> elements; 我在想的是:

JSP无法找到样式表

层次: WEB-INF / JSP WEB-INF /风格 我在JSP文件中链接样式表,该文件位于WEB-INF / jsp中: 但它不起作用! 当我打开我的应用程序时,没有样式和Tomcat的写入: Apache Tomcat/7.0.14 – Error report HTTP Status 404 – type Status reportmessage description The requested resource () is not available.Apache Tomcat/7.0.14 我怎么能克服它? 我的项目: http : //img835.imageshack.us/img835/6159/73536381.jpg 我正在使用spring框架3.我已经将我的文件夹与WEB-INF之外的样式和图像放在一起,但它仍然不起作用。 我写的是我的jsp文件: 它不起作用……

如何比较Struts 2中url请求参数中的单个字符

我正在读取具有单个字符的url参数。 它将是Y或N 我必须写一个条件来检查它是Y还是N并做相应的事情。 这是我写的,但似乎没有用(总是去其他)。 url是 http://wwww.helloworld.com/showInfo?thecountry=us&theconditionTypeInUrl=Y 我也试过了 struts.xml包含 dis.Info dis.noInfo

在尝试设置spring servlet时获取“WARN org.springframework.web.servlet.PageNotFound – 没有为带有URI的HTTP请求找到映射…”

我正在尝试设置一个Spring MVC项目。 我添加了一个调度程序servlet,一个jsp并设置了web.xml文件。 但我一直在努力 警告org.springframework.web.servlet.PageNotFound – 在名为“HelloWeb”的DispatcherServlet中找不到带有URI [/safesite/WEB-INF/jsp/hello.jsp]的HTTP请求的映射 这是我的web.xml … Vaadin production mode productionMode true org.activiti.explorer.servlet.WebConfigurer org.springframework.web.context.request.RequestContextListener UIFilter org.activiti.explorer.filter.ExplorerFilter JSONPFilter org.activiti.explorer.servlet.JsonpCallbackFilter UIFilter /o/* JSONPFilter /service/* Vaadin Application Servlet org.activiti.explorer.servlet.ExplorerApplicationServlet widgetset org.activiti.explorer.CustomWidgetset Vaadin Application Servlet /ui/* Vaadin Application Servlet /VAADIN/* HelloWeb org.springframework.web.servlet.DispatcherServlet 1 HelloWeb *.jsp 480 这是我的HelloWeb-servlet.xml 我的HelloController package org.activiti.explorer.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; […]

在提交弹簧mvc上绑定子对象

我是Java的新手,所以这个问题看起来很简单。 我有一个模型: @Entity(name=”website”) public class Website { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name=”websiteId”, nullable=false, unique=true) private long websiteId; @ManyToOne @JoinColumn(name = “publisherId”) private Publisher publisher; public Website() { } //… all getter and setter…. } 你看,在网站类中,我有一个Publisher类型的对象: @Entity(name=”publisher”) public class Publisher { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name=”publisherId”, nullable=false, unique=true) private long publisherId; private String publisherName; @OneToMany(fetch=FetchType.EAGER, cascade = CascadeType.ALL) @JoinColumn(name=”publisherId”) private […]