Mallory Liz

Greenhorn
+ Follow
since Apr 15, 2013
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Mallory Liz

I have a form which has five tabs. In one of the tabs(background.jsp) on change of a checkbox(be in checked or unchecked) I am trying to set the flag of (hasGenderChanged) in jsp to true and use a request type to send it to my java code.

Below is the code structure. I am getting an error which reads: Cannot find bean org.apache.struts.taglib.html.BEAN in any scope in edit_Education.jsp. Below is the code structure. Any help will be greatly appreciated.



Introduction.jsp has all the header tabs and at the end of it has
<template: get name='content-area'/>
On click of save button in this page I want to send if a check box has been changed during filling up a form. If changed want to send true to java component from JSP.


In edit_Education.jsp:

<template: insert template='education/Introduction.jsp'>

<logic:equal name="educationForm" property="selectedOption" value="0">
<template:put name='content-area' content='education/background.jsp'/>
</logic:equal>

<logic:equal name="educationForm" property="selectedOption" value="1">
<template:put name='content-area' content='education/eduqualification.jsp'/>
</logic:equal>

<logic:equal name="educationForm" property="selectedOption" value="2">
<template:put name='content-area' content='education/workexperience.jsp'/>
</logic:equal>
</template: insert




Since the forms on each tab are huge I want to trigger an action only if a checkbox has been checkbox in background.jsp

In background.jsp

Inside the html tags of a checkbox this is the function I have


><script>
function validate(){

document.educationForm.hasGenderChanged.value="true";
}
<html:form action="/processEducationAction" target="CONTENT-AREA">
<html: hidden property="hasGenderChanged"/>
<input type="hidden" name="hasGenderChanged" value="" scope="request"/>


</script>

<tr>
<html:checkbox property="selectOptions.selectGender" onchange="validate()"/>
<bean:message key="education.selectedOptions.label.selectGender"/>
<tr>
</html:form>

In educationForm.java I have a boolean hasGenderChanged; variable and setters and getters for this.

I am not sure how this value, hasGenderChanged in background.jsp can be made accessable to in edit_Education.jsp.

Thanks in advance for the help.


10 years ago
Hello,

I have just started learning about Struts and I have started with the Hello World Program. When I run my program I get the following error.
HTTP Status 404 -
type Status report
message
description The requested resource is not available.


Could some one kindly help me with debugging my program. I am not sure what needs to be done.

Thanks a lot in advance.

Details:

1. web.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>StrutsLearning</display-name>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>


2. struts-config.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://struts.apache.org/dtds/struts-config_1_3.dtd">

<struts-config>

<form-beans>
<form-bean name="HelloWorldForm" type="com.home.form.HelloWorldForm"/>
</form-beans>

<global-forwards>
<forward name="helloWorld" path="/helloWorld.do"/>
</global-forwards>

<action-mappings>
<action path="/helloWorld" type="com.home.action.HelloWorldAction" name="HelloWorldForm">
<forward name="success" path="/helloWorld.jsp" />
</action>
</action-mappings>

</struts-config>

11 years ago
Hello All,

I have a method that returns a collection. The aim is to filter out data such that this collection has all ratings greater than 0 and less than 3 into it.

My expression is not working well. Is this the right format for using to select ratings greater than 0 and less than 3 as my collection is returning all the values. Any help with this will be highly appreciated.

public DBCollection displayRatingzerotothree() {
BasicDBObject query = new BasicDBObject();
collection = db.getCollection(Collections.COLLECTION.getName());
query.put("rating", new BasicDBObject("$gt", 0.0).append("$lte", 3.0));
DBCursor cursor = collection.find(query);
return collection;
}

11 years ago