how to action fire in Struts2 - java

This is My JSP Page .
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%# taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type="text/css">
b {
color: navy;
background-color: orange;
}
</style>
<title>Struts2-Spring-Tiles integration | dineshonjava.com</title>
</head>
<body>
<h2>Add User</h2>
<b> <s:form action="addUsermenu">
<s:textfield name="userName" key="user.name" />
<s:textfield name="userAge" key="user.age" value="" />
<s:radio name="userGender" key="user.gender" list="{'Male','Female'}" />
<s:select name="userJob" key="user.job"
list="%{#{'Software':'Software','Hardware':'Hardware','Networking':'Networking','Marketing':'Marketing'}}" />
<s:checkboxlist name="userHobbies" key="user.hobby"
list="{'Cricket','Football','Drawing','Cooking','Driving','Movie'}" />
<s:submit key="submit" align="center" />
</s:form> </b>
<s:if test="%{users.isEmpty()}">
</s:if>
<s:else>
<b>List of Users</b>
<table border="1">
<tr>
<td><b>Name</b></td>
<td><b>Age</b></td>
<td><b>Gender</b></td>
<td><b>Job Type</b></td>
<td><b>Hobbies</b></td>
</tr>
<s:iterator value="users">
<tr>
<td><s:property value="userName" /></td>
<td><s:property value="userAge" /></td>
<td><s:property value="userGender" /></td>
<td><s:property value="userJob" /></td>
<td><s:property value="userHobbies" /></td>
<td>Delete
<td>Update
</td>
</tr>
</s:iterator>
</table>
</s:else>
</body>
</html
This is My StrutsConfig.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />
<constant name="struts.custom.i18n.resources" value="myapp" />
<package name="user" extends="struts-default" namespace="/">
<result-types>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<action name="user" class="user" method="execute">
<result name="user" type="tiles">mainTemplate</result>
</action>
<action name="*menu" class="user" method="{1}">
<result name="user" type="tiles">mainTemplate</result>
<result name="madhuri" type="tiles">madhuri</result>
<result name="alia" type="tiles">alia</result>
<result name="addUser" type="tiles">mainTemplate</result>
<result name="deleteUser" type="tiles">mainTemplate</result>
</action>
</package>
</struts>
this is my USerAction.jsp:
public class UserAction extends ActionSupport implements ModelDriven<UserBean>{
private static final long serialVersionUID = 1L;
#Autowired
private UserBean userBean;
#Autowired
private UserService userService;
private List<UserBean> users;
public String execute() {
users = CommonUtility.createUserBeanList(userService.getUserList());
return "user";
}
public String addUser(){
userService.saveUser(CommonUtility.createModel(userBean));
users = CommonUtility.createUserBeanList(userService.getUserList());
return "addUser";
}
public String deleteUser(){
userService.deleteUser(CommonUtility.createModel(userBean));
users = CommonUtility.createUserBeanList(userService.getUserList());
return "deleteUser";
}
public String listUser(){
users = CommonUtility.createUserBeanList(userService.getUserList());
return "users";
}
#Override
public UserBean getModel() {
return userBean;
}
public String alia() {
return "alia";
}
public String madhuri() {
return "madhuri";
}
public String user() {
return "user";
}
public List<UserBean> getUsers() {
return users;
}
public void setUsers(List<UserBean> users) {
this.users = users;
}
}
public String deleteUser(){
userService.deleteUser(CommonUtility.createModel(userBean));
users = CommonUtility.createUserBeanList(userService.getUserList());
return "deleteUser";
}
function is not working i am stucking where am doing wrong Please help me i think there is minor mistake so i Could not able to find that Error .

The form is submiting an action name as addUsermenu.
In your struts.xml, you have an action tag to point to all the methods, that matches *menu. So your addUsermenu will find its corresponding method. ie addUser().
But in the case of delete you must change the action name to deleteUsermenu inorder to find the function deleteUser()
Solution
Change the delete Link to this
Delete
to this
Delete

Related

Unable to set jsp form values to class variables

When I try to fetch the values from class, which were set in jsp, null is shown.
Following error is observed in dev mode:
ERROR ParametersInterceptor Developer Notification (set struts.devMode to false to disable this message):
Unexpected Exception caught setting 'name' on 'class org.ravi.EmployeeAction: Error setting expression 'name' with value 't'
Below are my various pages
struts.xml
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<package name="default" extends="struts-default">
<action name="addEmployeeAction" class="org.ravi.EmployeeAction">
<interceptor-ref name="params" />
<interceptor-ref name="modelDriven"/>
<result name="success">/Add.jsp</result>
</action>
<action name="EmployeeAction" class="org.ravi.EmployeeAction" method="execute">
<interceptor-ref name="params" />
<interceptor-ref name="modelDriven"/>
<result name="success">/index.jsp</result>
</action>
</package>
</struts>
index.jsp
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" import="java.util.*,java.io.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%#taglib uri="/struts-tags" prefix="s"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<s:form action="Add.jsp" name="addForm">
<table border="1" cellpadding="5">
<tr>
<th>Select</th>
<th>EmpID</th>
<th>Name</th>
<th>City</th>
<th>DoB</th>
</tr>
<tr>
<th><input type="radio" name="record"
onClick="radioValidate(this, 'record')" value="%{var}">
</th>
<th><s:property value="empid"/></th>
<th><s:property value="name"/></th>
<th><s:property value="city"/></th>
<th><s:property value="dob"/></th>
</s:form>
</body>
</html>
Add.jsp
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%#taglib uri="/struts-tags" prefix="s"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h1>Add New User</h1>
<s:form action="EmployeeAction" >
<s:textfield label="Emp Id" name="empid" />
<s:textfield label="Name" name="name" />
<s:textfield label="City" name="city" />
<s:textfield label="DoB" name="dob" />
<s:submit />
</s:form>
</body>
</html>
EmployeeAction.java
package org.ravi;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
public class EmployeeAction extends ActionSupport implements ModelDriven<Employee> {
private static final long serialVersionUID = -8136507522861159378L;
private Employee employee=new Employee();
public Employee getEmployee()
{
return employee;
}
public void setEmployee(Employee employee)
{
this.employee=employee;
}
public String execute() throws Exception
{
return SUCCESS;
}
#Override
public Employee getModel()
{
return employee;
}
}
Employee.java
package org.ravi;
import java.io.Serializable;
public class Employee implements Serializable{
static final long serialVersionUID = 1L;
private String empid;
private String name;
private String city;
private String dob;
public void setempid(String empid) {
this.empid = empid;
}
public void setname(String name) {
this.name = name;
}
public void setcity(String city) {
this.city = city;
}
public void setdob(String dob) {
this.dob = dob;
}
public String getempid() {
return this.empid;
}
public String getname() {
return this.name;
}
public String getcity() {
return this.city;
}
public String getdob() {
return this.dob;
}
}
public void setname(String name) {
this.name = name;
}
You need to name all of these properly, ie setName(String name)
same for setEmpId and so on. Struts cannot find your getters/setters because they don't follow naming conventions.
You're committing several errors, the worst is that
you're generating getters and setters manually (a lot of useless work), and you're also doing it wrongly: the first letter of the variable name must be capitalized:
setName( instead of setname( for variable name.
You should (for simplicity and consistency) also do it for every word of your variables with more than one word:
setEmpId( for variable empId.
You should also consider avoiding the redundancy when possible. If you have an ID field on a class Employee, just call it id, not empId... if it's inside Emp, it's obvious it's emp id and not something else id.
Use ModelDriven only if you enjoy pain. For any other purpose, it is as useful as a sausage in your pocket when facing a pack of hungry stray dogs.
Use the HTML5 DTD <!DOCTYPE html> also if you're targeting old browsers, there's no need to use 4.01 nowadays.
Never call JSPs directly like you do in your first form, always pass through actions first.
Start with this. There's plenty more.
Must read
Camel Case
Java Beans specifications

Struts 2, Error 404

I have tried many things, but not able to solve the issue of Error 404 while I click the submit button of the HR form. I need to get redirected to the output.jsp page as soon as I submit the form of HR. Can anyone help?
Web.Xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>input.jsp</welcome-file>
</welcome-file-list>
</web-app>
Struts.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"//Apache Software foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<package name="default" extends="struts-default">
<action name="output" class="com.vcm.login.LoginAction" method="execute">
<result name="success">/output.jsp</result>
<result name="input">/input.jsp</result>
</action>
</package>
</struts>
LoginAction.java
package com.vcm.login;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
public class LoginAction extends ActionSupport{
/**
*
*/
private static final long serialVersionUID = 1L;
private String username;
private String password;
private String message;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String execute(){
if(username.equals("jyotsna")&& password.equals("jyotsna")){
return Action.SUCCESS;
}
else{
addActionError("NOT a VALID user");
return Action.LOGIN;
}
}
public void validate(){
if((username==null) || (username.trim().equals("")))
addFieldError("username","ID cannot be blank");
if(password==null || password.trim().equals(""))
addFieldError("password","password incorrect");
}
}
Input.jsp
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<table style="align:center">
<tr>
<td width="25%" style="background-color:#33CCFF">
<form action="output">
<p style="color:white"><b><i>HR LOGIN</i></b></p><br>
HR id:<input type="text" name="username" value="" /><br><br>
Psswd:<input type="password" name="password" value="" /><br><br>
<input type="submit" value="login">
</form>
</td>
<td width="70%">
<img src="https://assets.dice.com/external/images/empLogos/6fccd30f19c09f1afee9414a18 5fde3d.jpg" height="100%" width="100%"></td>
<td width="25%" style="background-color:#33CCFF">
<form method="post" action=" ">
<p style="align:center;color:white"><b><i>EMPLOYEE LOGIN</i></b></p><br>
Emp id:<input type="text" name="id" value="" /><br><br>
Psswd :<input type="password" name="psswd" value="" /><br><br>
<input type="submit" value="login">
</form>
</td>
</tr>
</table>
</body>
</html>
Output.jsp
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>output</title>
</head>
<body>
<p>
Page of a HR
</p>
</body>
</html>
Use the struts tags.
Load them by adding this at the beginning:
<%# taglib prefix="s" uri="/struts-tags" %>
Use them like this:
<s:form action="output" method="post">
<s:textfield key="username" label="HR id:" />
<s:textfield key="password" label="Psswd:" />
<s:submit type="button">login</s:submit>
</s:form>
Alter the layout by switching/altering the struts ui theme and by using css.

Struts 2 Login Form Problems

I want to create a simple login form in Struts 2 but I'm having problems at seeing the input fields for some reason and after I submit the name of the user doesn't appear.
Here is the code:
Struts redirects to my struts.xml.
my struts.xml
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false"/>
<!-- devMode equals mode debug information and reload everything for every request -->
<constant name="struts.devMode" value="true" />
<package name="user" namespace="/User" extends="struts-default">
<action name="Login">
<result>Login.jsp</result>
</action>
<action name="DashboardAction" class="action.DashboardAction">
<result name="success">Dashboard.jsp</result>
</action>
</package>
</struts>
The Bean class
DashboardAction.java:
package action;
public class DashboardAction {
private String username;
public String execute(){
return "success";
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
The JSPs
Login.jsp
<%#page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Login</title>
</head>
<body>
<h1>Struts 2 Login Test</h1>
<form action="DashboardAction" id="form1" method="post" autocomplete="off">
<div class="input placeholder">
<s:textfield name="username" label="Utilizador"/>
</div>
<div class="input placeholder">
<s:password name="password" label="Password"/>
</div>
<div class="submit">
<s:submit value="Entrar" method="execute"/>
</div>
</form>
</body>
</html>
Dashboard.jsp:
<%#page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Welcome User</title>
</head>
<body>
<h1>Hello
<s:property value="username"/>
</h1>
</body>
</html>
Why doesn't this work after I press submit? It's supposed to go to Dashboard.jsp?
Here you go :
<result name="success">/Dashboard.jsp</result>
You need to specify the full-path to the JSPs in your results. Notice the /. You need to do the same to your other result pages including Login.jsp
You should map the form to the action that accept data submitted. Use Struts tags
<%# taglib prefix="s" uri="/struts-tags" %>
<s:form action="Welcome" ...
<s:textfield name="username" ...
<s:password name="unknown" ...
couldn't map the password field because in your action there's not a property. May be if you create it
private String unknown;
public String getUnknown() {
return unknown;
}
public void setUnknown(String unknown) {
this.unknown = unknown;
}
Define property password in your action class like below.
DashboardAction.java
package action;
public class DashboardAction {
private String username;
private String password; // you don't have this line in your action class.
public String execute(){
return "success";
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}

Struts2 validation message appearing twice

I am trying struts validation but the error messages are getting printed twice. my action class is as follow.OSAction.java . I am so using hibernate in it. I think the validate method is called twice,
package net.ajeet.os.view;
import java.util.List;
import net.ajeet.os.controller.OSManager;
import net.ajeet.os.model.OSDetail;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
public class OSAction extends ActionSupport {
private static final long serialVersionUID = 9149826260758390091L;
public OSDetail osdetail= new OSDetail();
private List<OSDetail> osdetails_list;
public OSDetail getOsdetail() {
return osdetail;
}
public void setOsdetail(OSDetail osdetail) {
this.osdetail = osdetail;
}
private Long id;
private OSManager linkController= new OSManager();
/* #Override
public OSDetail getModel() {
return osdetail;
}*/
/* public OSAction() {
linkController = new OSManager();
}
public String execute() {
this.osdetails_list = linkController.list();
return SUCCESS;
}
*/
public String add() {
try {
linkController.add(getOsdetail());
//linkController.add(osdetail);
} catch (Exception e) {
e.printStackTrace();
}
this.osdetails_list = linkController.list();
return SUCCESS;
}
/* public String delete() {
linkController.delete(getid());
return SUCCESS;
}*/
public List<OSDetail> getOsdetails_list() {
return osdetails_list;
}
public void setOsdetails_list(List<OSDetail> osdetails_list) {
this.osdetails_list = osdetails_list;
}
/* public Long getid() {
return id;
}
public void setid(Long id) {
this.id = id;
}
*/
public void validate()
{
if (osdetail.getOSname() == null || osdetail.getOSname().trim().equals(""))
{
addFieldError("osdetail.OSname","The OS Name is required");
}
if (osdetail.getOSversion() == null || osdetail.getOSversion().trim().equals(""))
{
addFieldError("osdetail.OSversion","The OS Version is required");
}
}
}
My Index.jsp is below
<%# page contentType="text/html; charset=UTF-8"%>
<%# taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
    <title>OS Manager - Struts2 Hibernate Example</title>
</head>
<body>
 
<h1>OS Manager</h1>
<s:actionerror/>
 
<s:form action="add" method="post" >
<s:hidden name="OSid" value="%{id}" />
    <s:textfield name="osdetail.OSname" label="name" />
    <s:textfield name="osdetail.OSversion" label="version"/>
    <s:textfield name="osdetail.OSnotes" label="notes"/>
    <s:submit value="Add OS Details" align="center"/>
<s:reset value="Reset" />
</s:form>
 
 
<h2>OS Details</h2>
<table>
<tr>
    <th>OS Name</th>
    <th>OS Version</th>
    <th>OS Notes</th>
</tr>
<s:iterator value="osdetails_list" var="osdetail">
    <tr>
        <td><s:property value="OSname"/></td>
        <td><s:property value="OSversion"/></td>
        <td><s:property value="OSnotes"/></td>
    </tr>
</s:iterator>
</table>
</body>
</html>
Struts.xml is below
![<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation"
value="false" />
<constant name="struts.devMode" value="false" />
<package name="default" extends="struts-default" namespace="/">
<action name="add"
class="net.ajeet.os.view.OSAction" method="add">
<result name="success" type="chain">index</result>
<result name="input" type="chain">index</result>
</action>
<action name="index"
class="net.ajeet.os.view.OSAction">
<result name="success">index.jsp</result>
<result name="input">/index.jsp</result>
</action>
</package>
</struts>][2]
enter code here
This is because you are incorrectly using a "chain" result. Don't use it unless you know what are you doing. To fix error you should change the configuration like this
<action name="add" class="net.ajeet.os.view.OSAction" method="add">
<result type="redirectAction">index</result>
<result name="input">/index.jsp</result>
</action>
<action name="index" class="net.ajeet.os.view.OSAction">
<result>/index.jsp</result>
</action>
Just implement interceptor-ref name="defaultStack" before your action in struts.xml

WARNING: StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception java.lang.NullPointerException

I keep getting this warning, on a VERY simple JSP/Bean Page,
I am practicing for exams, and I can't get past this.
Could someone point out my foolishness please?
<html>
<head>
<title>JSP Page</title>
</head>
<h1>Enter Details!</h1>
<body>
<form action="Display.jsp" method="post">
<center>
Enter Name :<input type="text" name="Name"/><br/>
Etv :<input type="radio" name="Channel" value="Etv" /><br/>
Mnet :<input type="radio" name="Channel" value="Mnet" /><br/>
Mtv :<input type="radio" name="Channel" value="Mtv" /><br/>
FTV :<input type="radio" name="Channel" value="FTV" /><br/>
Blue :<input type="checkbox" name="Blue" value="1" /><br/>
Yellow :<input type="checkbox" name="Yellow" value="1" /><br/>
Green :<input type="checkbox" name="Green" value="1" /><br/>
Red :<input type="checkbox" name="Red" value="1" /><br/>
<br/>
<br/>
<input type="submit" value="Submit" />
</center>
</form>
</body>
</html>
My Javabean:
package Beans;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.beans.*;
import java.io.Serializable;
/**
*
* #author Ross
*/
public class NewBean implements Serializable {
private String Name;
private String Channel;
private int Blue;
private int Yellow;
private int Green;
private int Red ;
public NewBean() {
}
public NewBean(String tName,String tChannel,int tBlue,int tYellow,int tGreen,int tRed) {
Name=tName;
Channel=tChannel;
Blue=tBlue;
Yellow=tYellow;
Green=tGreen;
Red=tRed;
}
public String getName(){
return this.Name;
}
public String getChannel(){
return this.Channel;
}
public int getBlue(){
return this.Blue;
}
public int getYellow(){
return this.Yellow;
}
public int getGreen(){
return this.Green;
}
public int getRed(){
return this.Red;
}
public void setName(String tName){
this.Name = tName;
}
public void setChannel(String tChannel){
this.Channel = tChannel;
}
public void setBlue(int tBlue){
this.Blue = tBlue;
}
public void setYellow(int tYellow){
this.Yellow = tYellow;
}
public void setGreen(int tGreen){
this.Green = tGreen;
}
public void setRed(int tRed){
this.Red = tRed;
}
}
My JSP to display the javabean:
<html>
<head>
<title>Display</title>
</head>
<body>
<h1>Result</h1>
<center>
<jsp:useBean id="NewBean"class="Beans.NewBean">
<jsp:setProperty name="index" property="Name" param="Name"/>
<jsp:setProperty name="index" property="Channel" param="Channel"/>
<jsp:setProperty name="index" property="Blue" param="Blue"/>
<jsp:setProperty name="index" property="Yellow" param="Yellow"/>
<jsp:setProperty name="index" property="Green" param="Green"/>
<jsp:setProperty name="index" property="Red" param="Red"/>
</jsp:useBean>
<b>Displayed.</b>
<jsp:getProperty name="index" property="Name"/>
<jsp:getProperty name="index" property="Channel"/>
<jsp:getProperty name="index" property="Blue"/>
<jsp:getProperty name="index" property="Yellow"/>
<jsp:getProperty name="index" property="Green"/>
<jsp:getProperty name="index" property="Red"/>
</center>
</body>
</html>
You should follow the java naming conventions for variables (camel case). I.e.
//private String Name;
private String name;
and
public void setName(String tName){
//this.Name = tName;
this.name = tName;
}
should be referred by a lower case property "name":
<!-- jsp:setProperty name="index" property="Name" param="Name"/ -->
<jsp:setProperty name="index" property="name" param="Name"/>

Categories