473,322 Members | 1,307 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Pre-Populate a Form that nested tags

I have a Struts action form which contains a bean. I am trying to
display a bean retrieved from the database in this form using the
nested tag. Can anyone help me? I continue to get an error message
see end for stack trace.

Struts config
<form-bean name="newBean" type="com.NewForm" />
......
<action path="/new-action" type="com.NewAction"
name="newBean" scope="session">
<forward name="blah" path="/New.jsp"/>
</action>

Bean
public class Program implements Serializable {

private int prg_pk;
private String prg_prog_name = null;
private Set courses;

getters()/setters()
Form
public class NewForm extends ActionForm {

private Program program;

/**
* Returns the program.
* @return Program
*/
public Program getTheProgram() {
return program;
}

/**
* Sets the program.
* @param program The program to set
*/
public void setTheProgram(Program program) {
this.program = program;
}

public void reset(ActionMapping mapping, HttpServletRequest
request) {

HttpSession session = request.getSession();
setTheProgram((Program) session.getAttribute("PROGRAM"));

}

}
JSP
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<nested:form action="/new-action.do">
<nested:nest property="program" >
<nested:write property="prg_prog_name"/>
</nested:nest>
</nested:form>
Stack Trace
java.lang.NullPointerException
at java.util.Hashtable.get(Hashtable.java:315)
at org.apache.jasper.runtime.PageContextImpl.findAttr ibute(PageContextImpl.java:303)
at org.apache.struts.util.RequestUtils.lookup(Request Utils.java:663)
at org.apache.struts.util.RequestUtils.lookup(Request Utils.java:710)
at org.apache.struts.taglib.bean.WriteTag.doStartTag( WriteTag.java:290)
at org.apache.struts.taglib.nested.bean.NestedWriteTa g.doStartTag(Unknown
Source)
at org.apache.jsp.New$jsp._jspService(New$jsp.java:11 4)
at org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWra pper.service(JspServlet.java:201)
at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:853)
at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNe xt(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNe xt(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(St andardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNe xt(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.in voke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNe xt(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNe xt(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:468)
at org.apache.catalina.core.StandardPipeline.invokeNe xt(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNe xt(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.p rocess(HttpProcessor.java:1027)
at org.apache.catalina.connector.http.HttpProcessor.r un(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:479)
Jul 17 '05 #1
0 2859

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: GriffithsJ | last post by:
Hi I have been given some text that needs to be displayed on a web page. The text is pre-formatted (includes things like lists etc) and displays okay if I wrap it using the <pre/> tag. ...
3
Pre
by: Neal | last post by:
A few questions about pre... When presenting preformatted text using the white-space: pre; property/value, Opera renders long lines at small viewport widths as exiting the borders of the...
7
by: Alan Illeman | last post by:
How do I set several different properties for PRE in a CSS stylesheet, rather than resorting to this: <BODY> <PRE STYLE="font-family:monospace; font-size:0.95em; width:40%; border:red 2px...
7
by: Roderik | last post by:
Hi, When I use <pre> inside my <td> cells, the text won't flow to a new line and the table gets to large in width. This will appear in Firefox this way, Internet Explorer will wrap the lines,...
5
by: Porthos | last post by:
I'm authoring an XML document and using the <pre> html tag for the portions that are not dynamically generated. The <pre> text is displaying in a smaller font size (and I believe different font)...
5
by: Michael Shell | last post by:
Greetings, Consider the XHTML document attached at the end of this post. When viewed under Firefox 1.0.5 on Linux, highlighting and pasting (into a text editor) the <pre> tag listing will...
1
by: R0bert Nev1lle | last post by:
Here's my next IE challenge (or frustration). It deals with the overflow attribute. Overflow property was a challenge on my page since the page emulates position fixed for IE. The present...
9
by: Eric Lindsay | last post by:
I can't figure how to best display little snippets of shell script using <pre>. I just got around to organising to bulk validate some of my web pages, and one of the problems occurs with Bash...
7
by: Paul Connolly | last post by:
char *s = "Hello"; s = 'J'; puts(s); might print "Jello" in a pre-ANSI compiler - is the behaviour of this program undefined in any pre-ANSI compiler - or would it always have printed "Jello"...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.